- 安装node.js
- 检验是否安装成功
node -v
npm -v
- 更换淘宝镜像源
npm install -g cnpm --registry=https://registry.npm.taobao.org
- 检查是否更换成功
cnpm -v
- 安装hexo框架
cnpm install -g hexo-cli
- 检查是否安装成功
hexo -v
- 建立一个空的文件夹
mkdir blog
- 进入blog
cd blog/
- 初始化hexo,搭建博客
sudo hexo init
- 启动博客
hexo s
发现在本地的localhost:4000端口启动
- 新建第一篇博客文章
hexo new "我的第一篇博客文章"
- 根据路径查看是否存在
/Users/liuguangquan/blog/source/_posts/
- 利用vim打开添加内容
- 清理,生成
hexo clean
hexo g
- 把博客推送到github上
登陆账号,新建仓库
注意:仓库名必须与用户名一致
- 安装git插件
cnpm install --save hexo-deployer-git
- 设置_config.yml
- 进入底部有个deploy
- 修改type
type: git
- 添加repo
repo: https://github.com/echo-machile/echo-machile.github.io.git
- 添加branch
branch: master
- 将博客部署到远端
hexo d
- 访问博客
- 修改博客样式
git clone https://github.com/litten/hexo-theme-yilia.git themes/yilia
- 编辑_config.yml文件
找到theme修改为yilia,保存退出
清理,生成,开启
hexo clean
hexo g
hexo s
- 推送到远端
hexo d