Articles from spicy chicken bear personal blog: https://eeeje.com Welcome, to get a better reading experience.
background
A few days ago to see the server to expire, did not go to him, to forget the results, expired early this morning, this Ali cloud 2 East China (Shanghai) also used the machines for nearly two years, the physical location in Shanghai let me uncomfortable obsessive-compulsive disorder, 40G and 30G of the plate are used (anyway, is go to the trouble of giving themselves an excuse), see the new machine has a student can be purchased at East 1 (Hangzhou) decisively release the original server, new purchased in Hangzhou node
before a pagoda made a backup strategy, so the data are stored in my OSS inside
a few days ago with hexo posted blog on github, but only on my own computer compilation, there are some limitations, so install hexo used to compile the blog in the clouds on this server.
Incidentally, found a BUG, Ali cloud student computers within the certification period, seems to be an unlimited number of renewals, the point I am going to keep the cost of living continued to try him eight or ten years.
Ado
When released findings blog Park Markdown preformatted text is really annoying, and some code directly display the text
installation
connect to the server
You tube cmd, xshell, hyper, putty or something, even on the get away
Installation node.js
This is a JavaScript runtime environment
It further recommends that operate in a particular directory
Please do not tell me linux foundation
mkdir /soft
mkdir /soft/hexo
cd /soft/hexo
- From the official website to download the linux version of node.js or directly using wget to download
Use wget to download here
wget https://nodejs.org/dist/v10.9.0/node-v10.9.0-linux-x64.tar.xz
He unzipped
tar xf node-v10.9.0-linux-x64.tar.xz
After extracting test whether the installation is successful
Move to the directory
cd node-v10.9.0-linux-x64/
Excuting an order
./bin/node -v // 如果出现版本号,说明安装成功
Modify node-v10.9.0-linux-x64 folder name for nodejs
cd ..
mv node-v10.9.0-linux-x64 nodejs
Set the connection
ln -s /soft/hexo/nodejs/bin/node /usr/local/bin/node
ln -s /soft/hexo/nodejs/bin/npm /usr/local/bin/npm
git installation
Installation dependencies
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker
Command git --version
can see, Git current version number is 1.8.3.1, too old, we need to put it removed.
Uninstall the old version of Git
yum remove git
Then move to the / usr / local /
cd /usr/local/
Download and unzip
https://github.com/git/git/archive/v2.9.2.tar.gz wget
tar -zxvf v2.9.2.tar.gz // extract the
mv git-2.9.2 git // renameCompile and install
cd git // into the folder
make prefix = / usr / local / git all // compile source
mounted to the / usr / local / git path make prefix = / usr / local / git install //
Compile time configuration determines the speed of the machine, please be patient.
Open environment variable configuration file
vim /etc/profile
In the bottom of the configuration file to add the following.
PATH=$PATH:/usr/local/git/bin // git 的目录
export PATH
Two statements should be added
Refresh environment variable
source /etc/profile
Finally, use git --version
your version number, 2.9.2 already
Installation hexo
npm install hexo-cli -g
Build a blog basis
Add hexo first command to the global: hexo lib in the nodejs / node_modules / hexo-cli / bin command can be found hexo way is to use flexible connections
ln -s /soft/hexo/nodejs/lib/node_modules/hexo-cli/bin/hexo /usr/local/bin/hexo
Hexo blog deployment environment: this can be placed outside nodejs, easy to open
next cd to a directory and nodejs (I was on the root directory) and then:HEXO mkdir
cd HEXO
HEXO the init // will automatically download a good resource file
Explain
node_modules: dependencies is
public: is stored in the page generated
scaffolds: command to generate articles and other templates
source: Create a command of various articles
themes: Theme
_config.yml: entire blog configuration
db.json: source parsing the the resulting
package.json: the configuration information required for the project module project
- Bypass to github
Create a repo, the name of yourname.github.io
which is yourname github name (I already have, not a screenshot)
Below each step, you should yourname exchange for their github name, youremail exchange for their email github
Configuration github account information
git config --global user.name "yourname"
git config --global user.email "youremail"
Creating SSH
Input: ssh-keygen -t rsa -C "youremail"
generating ssh
The following tips can place all the way round
Then find generated sshkey
cd ~/.ssh
cat id_rsa.pub
Copy out of those characters back
SSH and GPG keys found on github the setting, click the New SSH key
title taken lightly, key to fill that period just ssh
Verify added successfully in gitbash in:ssh -T [email protected]
- a step far
By editor, open your blog project, _config.yml modify some configuration files (after the colon is a half-size space) changed your attention YourgithubName
deploy:
type: git
repo: https://github.com/YourgithubName/YourgithubName.github.io.git
branch: master
Like this need to enter your password every time, every time, then you do not want to enter a password to https://github.com/YourgithubName/YourgithubName.github.io.git
be changed[email protected]:YourgithubName/YourgithubName.github.io.git
Gitbash back in, into your blog directory, respectively, execute the following command
hexo clean
hexo server
Start the test environment
hexo s
Enter yourip:4000/
to access the page
If a server, I was Ali cloud server, you need to configure security group to open the 4000 port, so you can visit
or linux virtual machine, you need to test whether the normal communication both inside and outside
each edited perform the following command to upload
hexo clean
hexo g //编译
hexo d //上传
Thus, the basic hexo to build a good environment.