教你在GitHub上搭建属于自己的博客

教你在GitHub上搭建属于自己的博客

0.环境

VMware + Ubuntu14.03

1.安装git

$ sudo apt-get install git

2.安装node.js

$ wget https://nodejs.org/dist/v9.2.0/node-v9.2.0.tar.gz .

$ cd node-v9.2.0
$ ./configure
$ make -j4
$ sudo make install
$ node -v
v9.2.0

参考BUILDING.md

3.安装hexo

$ mkdir hexo
$ cd hexo
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo generate
$ hexo server
INFO  Start processing
INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.
INFO  See you again

此时可以在Ubuntu中打开浏览器输入http://localhost:4000/或者在Windows本地打开浏览器输入http://IP地址:4000/即可看到效果。

4.登陆GitHub建仓

仓库名称格式:username/username.github.io

username是你的账号名

5.部署hexo至GitHub

首先安装deployer

$ npm install hexo-deployer-git --save

vim _config.yml 修改
deploy:
  type: git
  repo: git@github.com:LancerSky/LancerSky.github.io.git
  branch: master

最后执行

$ hexo deploy

现在可以直接访问https://lancersky.github.io/

6.修改主题

next主题:https://github.com/iissnan/hexo-theme-next

$ mkdir themes/next
$ curl -s https://api.github.com/repos/iissnan/hexo-theme-next/releases/latest | grep tarball_url | cut -d '"' -f 4 | wget -i - -O- | tar -zx -C themes/next --strip-components=1
$ ls themes/
landscape  next

vim _config.yml 修改

theme: next
$ hexo clean
$ hexo generate
$ hexo server --->可以本地查看效果
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值