Hexo +gitee blogging for the most complete teaching

Hexo is a fast, concise and efficient blog framework.Hexo Use Markdown (or other rendering engine) parses the article an...
Environmental Science
install
GIT
hexo
To configure
Set ssh key
Pull Items
Building Station
Configuration_config.yaml
Generate page and submit
backups
recovery
Multi-terminal
epilogue

Hexo is a fast, concise and efficient blog framework.Hexo Use
Markdown (or other rendering engine) parses the article and generates a static web page with beautiful themes in seconds.

Hexo is one of the most popular blog frameworks, so I'll try to do some basic functionality testing myself.The reason I chose the code cloud instead of GitHub is that I don't need GitHub Pages for my own VPS, so there are no tutorials on how to use GitHub Pages. The second reason is that private warehouses on GitHub are charged and free private warehouses can be created on the code cloud.Others choose to use Docker to create a blog environment and make a mirror backup. If you don't use this scheme here, it's OK for each!

Environmental Science

Main Server System Version and Kernel Version:

[root@dbn-japan ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@dbn-japan ~]# uname -r 3.10.0-862.3.2.el7.x86_64

Test Server System Version and Kernel Version:

[root@host ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) [root@host ~]# uname -r 4.10.4-1.el7.elrepo.x86_64

install

wget

yum install -y wget

node.js

# Download the latest bin package for nodejs wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz # decompression xz -d node-v10.13.0-linux-x64.tar.xz tar -xf node-v10.13.0-linux-x64.tar # Move Directory mv node-v10.13.0-linux-x64 /usr/local/nodejs # Deployment File ln -s /usr/local/nodejs/bin/node /usr/bin/node ln -s /usr/local/nodejs/bin/npm /usr/bin/npm

OK to go Official website Download, the type I use here is: Linux Binaries (x64)
test

[root@dbn-japan packages]# node -v v10.13.0 [root@dbn-japan packages]# npm -v 6.4.1

If the version number is output, the installation is successful.

GIT

yum install -y git

Initialization settings:

git config --global user.email "[email protected]" git config --global user.name "BNDong"

hexo

npm install -g hexo-cli

Try to execute the command after installation: hexo

If the following output appears, solve it as I do below, and skip if none.

[root@dbn-japan packages]# hexo -bash: hexo: command not found

Edit the environment variable file: vim/etc/profile, adding the following settings at the end of the file:

export PATH=$PATH:/usr/local/nodejs/lib/node_modules/hexo-cli/bin

Refresh the environment variable: source/etc/profile, and then run the command hexo to get the correct output.

To configure

Create Project Branch

Create a new branch:sources

  • master: Stores static resources generated by Hexo compilation.
  • sources: Store the source file to back up the blog.

Set ssh key

Run the following command to create the SSH Key, and change the mailbox part to the mailbox you created when you created the account:

[root@dbn-japan blog.dbnuo.org]# ssh-keygen -t rsa -C "[email protected]" Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): # Catalog Enter passphrase (empty for no passphrase): # Enter a password to skip on return Enter same passphrase again: # Re-enter password

View public keys:

cat ~/.ssh/id_rsa.pub

Add a public key to the code cloud.

Pull Items

Jump to the root directory of the site and clone the item locally:

git clone https://gitee.com/dbnuo/bnd-hexo.git

Jump to the extracted project directory:

# Create a hexo directory mkdir hexo # Enter the hexo directory cd hexo/ # Initialize the hexo directory hexo init npm install # Install Plugins npm install hexo-generator-index --save npm install hexo-generator-archive --save npm install hexo-generator-category --save npm install hexo-generator-tag --save npm install hexo-server --save npm install hexo-deployer-git --save npm install hexo-deployer-heroku --save npm install hexo-deployer-rsync --save npm install hexo-deployer-openshift --save npm install hexo-renderer-marked --save npm install hexo-renderer-stylus --save npm install hexo-generator-feed --save npm install hexo-generator-sitemap --save

Building Station

First look at what's in the folder:

[root@dbn-japan hexo]# ls -a . .. _config.yml .gitignore node_modules package.json package-lock.json scaffolds source themes
  • _config.yml: Site configuration files, need to be backed up;
  • themes: Theme folder, need backup;
  • source: the.md file of the blog post, which needs to be backed up;
  • scaffolds: Template for article, need backup;
  • package.json: Name of installation package, need backup;
  • .gitignore: Limit which files can be ignored when push and need to be backed up;
  • .git: Both the theme and the site have a logo that this is a git project and does not require a backup;
  • node_modules: is the directory of the installation package, which is regenerated when npm install is executed, and no backup is required;
  • public: is a static web page generated by hexo g and does not require backup;
  • .deploy_git: As above, hexo g will also be generated and no backup is required;
  • db.json: File, no backup is required.

Configuration_config.yaml

Basic configuration is available for reference Official Documents Configuration instructions.Here you need to add the Git configuration at the end:

Generate page and submit

Run the command: After hexo Cl && hexo G-d enters the user name and password, the page code is submitted to the code cloud project.

Specify the site directory in the public folder of hexo to visit the site:

backups

Jump to project directory bnd-hexo:

git checkout -b sources # Create Switching Branch git push origin sources # Submit code to branch

Submit to CodeCloud Project Branch:

Now that this is done, the code is backed up in the project.To test backup recovery, I created a new article, test, and submitted it for testing.

recovery

Switch to a test server where the basic installation and setup can refer to the above process.

Jump to the root directory of the website:

# Pull Items to Local git clone https://gitee.com/dbnuo/bnd-hexo.git # Jump to Directory cd bnd-hexo # Create branch and pull git checkout -b sources origin/sources # Jump to Source File Directory cd hexo # Initial Installation npm install npm install hexo-generator-index --save npm install hexo-generator-archive --save npm install hexo-generator-category --save npm install hexo-generator-tag --save npm install hexo-server --save npm install hexo-deployer-git --save npm install hexo-deployer-heroku --save npm install hexo-deployer-rsync --save npm install hexo-deployer-openshift --save npm install hexo-renderer-marked --save npm install hexo-renderer-stylus --save npm install hexo-generator-feed --save npm install hexo-generator-sitemap --save

After execution, hexo is restored and can operate normally.

Multi-terminal

So far both servers are working on a project library, which can be said to be multi-terminal. I have created a new article on the test server: hexo new post "test2"

Submit upload after successful creation.

Switch back to the primary server:

# Jump to Project Directory cd bnd-hexo # Pull Items git pull origin sources # Jump to Source File Directory cd hexo/ # Recompile hexo cl && hexo g -d

Visit the website again:

See here the article test2, at most terminal editing operations succeeded.

epilogue

Here is a brief introduction to some necessary process operations. We recommend that you encapsulate some basic operations into scripts to operate. For topics and optimization, you can refer to some online resource tutorials. Thank you for reading. Thank you.

It's not easy to create. Give it a compliment!!

Copyright Statement: Articles are original on this site without special instructions. Please indicate where they were reproduced
Links to this article:https://blog.csdn.net/wsad861512140

24 June 2020, 22:26 | Views: 4108

Add new comment

For adding a comment, please log in
or create account

0 comments