Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
用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