您的位置:首页 > 运维架构 > Linux

Linux-github 搭建静态博客

2015-07-17 16:00 567 查看

1.在Github上创建一个新的Repository

到你的github上 https://github.com去create a new repository命名为 github.myblog



2.本地安装Jekyll-Bootstrap

如果本地centos没有git,使用yum安装

$ yum install git


克隆jekyll-bootstrap

$ git clone https://github.com/plusjade/jekyll-bootstrap.git myblog
$ cd myblog
$ git remote add origin-myblog https://github.com/csuldw/myblog.git $ git push origin-myblog master        #代码传至github




经过上面的代码之后,就可以看到自己的博客了:http://myblog.github.io/

github文件目录



3.安装Jekyll

使用下面代码看看是否安装了jekyll

$ git clone https://github.com/plusjade/jekyll-bootstrap.git $ cd jekyll-bootstrap
$ jekyll serve


根据网址http://localhost:4000. 看是否安装成功

如果没有安装成功,下面再centos中安装jekyll,参考:https://hack0nair.me/2013-10-31-config-jekyll-on-centos/

首先安装ruby:

$ sudo yum install ruby





接着安装jekyll

$ gem install jekyll


然后回到myblog目录,执行下列代码检测jekyll是否安装成功

$ jekyll server


如果出现下面情况,表示安装成功



4.创建一个页面

下载rake

$ gem install rake


创建页面

$ rake page name="about.md"


创建一个内部页面

rake page name="pages/about.md"





Create a page with a “pretty” path:

$ rake page name="pages/about"
# this will create the file: ./pages/about/index.html


The rake task automatically creates a page file with properly formatted filename and YAML Front Matter as well as includes the Jekyll Bootstrap “setup” file.

5.发布至github

$ git add .
$ git commit -m "Add new content"
$ git push origin master




附:jekyll支持主题定做 http://jekyllbootstrap.com/usage/jekyll-theming.html

主题目录位于:_includes/themes 下面.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: