一、安装新版本的nodejs和npm
安装n模块:
npm install -g n升级node.js到最新稳定版
n stable二、安装hexo
note: 参考github,不要去其官网
安装Hexo
npm install hexo-cli -gSetup your blog
hexo init blemesh
cd blemesh安装Cactus主题,众多开源主题中比较简洁的一个:
主题页
Cactus页
git clone https://github.com/probberechts/hexo-theme-cactus.git themes/cactus修改主题配置:
vim _config.yml
# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
## theme: landscape
theme: cactus
theme_config:
colorscheme: whiteCreate pages and articles with the hexo new [layout] <title> command. For example, to create an “about me” page, run:
hexo new page aboutThis will create a new file in source/about/index.md Similary, you can create a new article with
hexo new post "hello world"and add some interesting content in source/_posts/hello-world.md.
Start the server:
hexo server8001 port:
hexo server -p 8001三、安装hexo-admin并配置
安装:
npm install --save hexo-admin打开目录下的_config.yml配置hexo-admin:
admin:
username: XXXX(自己设置用户名)
password_hash: XXXXXXXXX(密码,但是是明文经过bcrypt hash加密后生成的)
secret: hey hexo(用于cookie安全)
deployCommand: './admin_script/hexo-generate.sh'(调用该脚本)注:
1)其中password_hash是你自己的明文密码经过加密后的字符串,但是如果用类似下面的网址: https://bcrypt-generator.com/ 会生成:$2y$10$pJjIxxxxxfMn9U/xxxxxNuuA20kh1eoB7vZxxxxx/7WpeV7IOxxxx类似的加密串,但是运行会报invalid salt revision错误,其原因是:
➜ blemesh cat node_modules/hexo-admin/www/bundle.js | head -4851 | tail -10
if (salt.charAt(0) != '$' || salt.charAt(1) != '2')
throw "Invalid salt version";
if (salt.charAt(2) == '$')
off = 3;
else {
minor = salt.charAt(2);
if (minor != 'a' || salt.charAt(3) != '$')
throw "Invalid salt revision";
off = 4;
}需要版本号是2a的加密方式,因此只能用python自己写了:









