Created
May 21, 2017 13:12
-
-
Save finghine/32014696351e3033c73baaa0fa6f5776 to your computer and use it in GitHub Desktop.
用hexo 创建 blog 脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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