Nodejs
Install nodejs for running hexo blog framework.
First make sure you have curl, because we need to install nodejs through nodesource.
1 | sudo apt-get install -y curl |
curl to download the setup shell script and then run the script.
1 | curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh |
And then install nodejs.
1 | sudo apt-get install -y nodejs |
Use the following command to check if your nodejs install correctly.
1 | node -v |
Hexo
We need to install hexo-cli, but for the people who is super familar with hexo, they also can only install hexo.
1 | npm install -g hexo-cli |
If you find the following warning, it means that you run with a normal user, but npm install need a root user, so please use sudo
.
1 | npm error The operation was rejected by your operating system. |
For easily run command with in linux, we can add npm node_modules to environment variable.
1 | echo 'PATH="$PATH:./node_modules/.bin"' >> ~/.profile |
After install hexo, we can init the basic files in our blog directory. And then install the blog.
1 | hexo init dreamking60-blog |
The target blog directory file may be as following, this is using the [[tree]] command.
1 | ├── _config.landscape.yml |
Stellar
Go into our blog directory and then install the theme.
Install hexo-theme-steller by the following command.
1 | npm i hexo-theme-stellar |
And then modfiy the _config.yam file. Change the theme
to stellar
1 | theme: stellar |
According to the hexo offical document to configure the blog website.
Running
Running the server can along the hexo server command.
1 | hexo server -p 80 |
If we want to make it continue to run on our server. We should use the pm2 to manage the server.
1 | npm install -g pm2 |
And also remember to add the following command for futher configuration.
1 | pm2 startup |
Add Comment System
In the _config.stellar.yml
configure file,
Blog Update
Anytime you update the settings of the blog. Restart the pm2 to enable the new setting.
1 | sudo pm2 restart hexo |