Skip to content

Instantly share code, notes, and snippets.

@finghine
Created May 21, 2017 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finghine/32014696351e3033c73baaa0fa6f5776 to your computer and use it in GitHub Desktop.
Save finghine/32014696351e3033c73baaa0fa6f5776 to your computer and use it in GitHub Desktop.
用hexo 创建 blog 脚本
#!/bin/bash
# 用hexo 创建 blog 脚本
sudo apt-get update
sudo apt-get install npm nodejs-legacy git -y
sudo npm install hexo-cli -g
# 初始化
hexo init ~/blog
cd ~/blog
npm install
# 下载next 主题
git clone https://github.com/iissnan/hexo-theme-next themes/next
# 替换主题
sed '/theme: landscape/ ctheme: next' -i _config.yml
# 安装nginx,并配置
sudo apt-get install nginx -y
THEUSER=$USER
# replace /usr/share/nginx/html to blog dir
sudo sed "s/root \/usr\/share\/nginx\/html/root \/home\/${THEUSER}\/blog\/public/g" -i /etc/nginx/sites-enabled/default
sudo nginx -s reload
# 生成静态文件
hexo g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment