title: deepin/ubuntu下搭建Jekyll环境

最近用github搭建了个博客,正好也学习一下markdown语法,由于markdown写完后不是立即可见,所以每次写完文章都要经过在线调试,而在线调试就得上线文章,每次上线都得重复git add, git commit, git push这三步。

安装ruby

$ sudo apt install ruby

$ sudo apt-get install ruby-dev

设置国内ruby的源

$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/

$ gem sources -l

$ sudo gem install rails

如果你使用 Gemfile 和 Bundle (例如:Rails 项目)

你可以用 Bundler 的 Gem 源代码镜像命令

$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org

这样你不用改你的 Gemfile 的 source。

source 'https://rubygems.org/'
gem 'rails', '4.1.0'

更多设置,请参考阿里巴巴的ruby镜像

安装部分依赖

ubuntu下需要自己安装nodejs, 等一些其他的包(如果没安装下面的包,运行jekyll server会遇到ExecJS::RuntimeUnavailable错误)

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs

或者使用NVM的安装方式来进行nodejs的安装

安装jekyll

$ sudo gem install jekyll
admin@admin-pc:~$ sudo gem install jekyll
Fetching: public_suffix-2.0.5.gem (100%)
Successfully installed public_suffix-2.0.5
Fetching: addressable-2.5.1.gem (100%)
Successfully installed addressable-2.5.1
Fetching: colorator-1.1.0.gem (100%)
Successfully installed colorator-1.1.0
Fetching: sass-3.4.23.gem (100%)
Successfully installed sass-3.4.23
Fetching: jekyll-sass-converter-1.5.0.gem (100%)
Successfully installed jekyll-sass-converter-1.5.0
Fetching: rb-fsevent-0.9.8.gem (100%)
Successfully installed rb-fsevent-0.9.8
Fetching: ffi-1.9.18.gem (100%)
Building native extensions. This could take a while...
Successfully installed ffi-1.9.18
Fetching: rb-inotify-0.9.8.gem (100%)
Successfully installed rb-inotify-0.9.8
Fetching: listen-3.0.8.gem (100%)
Successfully installed listen-3.0.8
Fetching: jekyll-watch-1.5.0.gem (100%)
Successfully installed jekyll-watch-1.5.0
Fetching: kramdown-1.13.2.gem (100%)
Successfully installed kramdown-1.13.2
Fetching: liquid-3.0.6.gem (100%)
Successfully installed liquid-3.0.6
Fetching: mercenary-0.3.6.gem (100%)
Successfully installed mercenary-0.3.6
Fetching: forwardable-extended-2.6.0.gem (100%)
Successfully installed forwardable-extended-2.6.0
Fetching: pathutil-0.14.0.gem (100%)
Successfully installed pathutil-0.14.0
Fetching: rouge-1.11.1.gem (100%)
Successfully installed rouge-1.11.1
Fetching: safe_yaml-1.0.4.gem (100%)
Successfully installed safe_yaml-1.0.4
Fetching: jekyll-3.4.3.gem (100%)
Successfully installed jekyll-3.4.3
Parsing documentation for public_suffix-2.0.5
Installing ri documentation for public_suffix-2.0.5
Parsing documentation for addressable-2.5.1
Installing ri documentation for addressable-2.5.1
Parsing documentation for colorator-1.1.0
Installing ri documentation for colorator-1.1.0
Parsing documentation for sass-3.4.23
Installing ri documentation for sass-3.4.23
Parsing documentation for jekyll-sass-converter-1.5.0
Installing ri documentation for jekyll-sass-converter-1.5.0
Parsing documentation for rb-fsevent-0.9.8
Installing ri documentation for rb-fsevent-0.9.8
Parsing documentation for ffi-1.9.18
Installing ri documentation for ffi-1.9.18
Parsing documentation for rb-inotify-0.9.8
Installing ri documentation for rb-inotify-0.9.8
Parsing documentation for listen-3.0.8
Installing ri documentation for listen-3.0.8
Parsing documentation for jekyll-watch-1.5.0
Installing ri documentation for jekyll-watch-1.5.0
Parsing documentation for kramdown-1.13.2
Installing ri documentation for kramdown-1.13.2
Parsing documentation for liquid-3.0.6
Installing ri documentation for liquid-3.0.6
Parsing documentation for mercenary-0.3.6
Installing ri documentation for mercenary-0.3.6
Parsing documentation for forwardable-extended-2.6.0
Installing ri documentation for forwardable-extended-2.6.0
Parsing documentation for pathutil-0.14.0
Installing ri documentation for pathutil-0.14.0
Parsing documentation for rouge-1.11.1
Installing ri documentation for rouge-1.11.1
Parsing documentation for safe_yaml-1.0.4
Installing ri documentation for safe_yaml-1.0.4
Parsing documentation for jekyll-3.4.3
Installing ri documentation for jekyll-3.4.3
Done installing documentation for public_suffix, addressable, colorator, sass, jekyll-sass-converter, rb-fsevent, ffi, rb-inotify, listen, jekyll-watch, kramdown, liquid, mercenary, forwardable-extended, pathutil, rouge, safe_yaml, jekyll after 29 seconds
18 gems installed

如果上一步安装过程中没有安装rdoc, rdiscount, kramdown,jekyll-sitemap 等,可以执行下面步骤安装

$ sudo gem install kramdown
$ sudo gem install rdoc
$ sudo gem install rdiscount
$ sudo gem install jekyll-sitemap
admin@admin-pc:~$ sudo gem install kramdown
Successfully installed kramdown-1.13.2
Parsing documentation for kramdown-1.13.2
Done installing documentation for kramdown after 2 seconds
1 gem installed admin@admin-pc:~$ sudo gem install rdoc
Fetching: rdoc-5.1.0.gem (100%)
Successfully installed rdoc-5.1.0
Parsing documentation for rdoc-5.1.0
Installing ri documentation for rdoc-5.1.0
Done installing documentation for rdoc after 10 seconds
1 gem installed admin@admin-pc:~$ sudo gem install rdiscount
Fetching: rdiscount-2.2.0.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed rdiscount-2.2.0.1
Parsing documentation for rdiscount-2.2.0.1
Installing ri documentation for rdiscount-2.2.0.1
Done installing documentation for rdiscount after 0 seconds
1 gem installed admin@admin-pc:~$ sudo gem install jekyll-sitemap
Fetching: jekyll-sitemap-1.1.1.gem (100%)
Successfully installed jekyll-sitemap-1.1.1
Parsing documentation for jekyll-sitemap-1.1.1
Installing ri documentation for jekyll-sitemap-1.1.1
Done installing documentation for jekyll-sitemap after 0 seconds
1 gem installed

上面步骤执行完后,本地的jekyll环境就搭建完成了,进入你博客的目录,运行下面的命令启动

可以从我的github上下载我现在使用的jekyll主题来作为自己的博客主题。

github地址:https://github.com/sixtrees/sixtrees.github.com.git

admin@admin-pc:~$ ls
Android Desktop Downloads Music Snapshots Steam Videos WebstormProjects
ch13 Documents IdeaProjects Pictures softs Story-writer-linux64.zip watchman
admin@admin-pc:~$ cd Documents/
admin@admin-pc:~/Documents$ ls
AwesomeProject
admin@admin-pc:~/Documents$ mkdir jekyll
admin@admin-pc:~/Documents$ cd jekyll/
admin@admin-pc:~/Documents/jekyll$ ls
admin@admin-pc:~/Documents/jekyll$ git clone https://github.com/sixtrees/sixtrees.github.com.git
正克隆到 'sixtrees.github.com'...
remote: Counting objects: 524, done.
remote: Total 524 (delta 0), reused 0 (delta 0), pack-reused 524
接收对象中: 100% (524/524), 347.10 KiB | 31.00 KiB/s, 完成.
处理 delta 中: 100% (301/301), 完成.

进入到项目中,执行下面的命令

$ jekyll server

之后会有提示,访问http://0.0.0.0:4000就可以啦。

admin@admin-pc:~/Documents/jekyll/sixtrees.github.com$ jekyll server
Configuration file: /home/admin/Documents/jekyll/sixtrees.github.com/_config.yml
Configuration file: /home/admin/Documents/jekyll/sixtrees.github.com/_config.yml
Source: /home/admin/Documents/jekyll/sixtrees.github.com
Destination: /home/admin/Documents/jekyll/sixtrees.github.com/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 2.371 seconds.
Auto-regeneration: enabled for '/home/admin/Documents/jekyll/sixtrees.github.com'
Configuration file: /home/admin/Documents/jekyll/sixtrees.github.com/_config.yml
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.

访问

可以看到和我在github上托管的gitpages一样。

deepin/ubuntu下搭建Jekyll环境的更多相关文章

  1. Linux之旅-ubuntu下搭建nodejs环境

    .NET Core也开源了,并且可移植到Linux下,而ubuntu作为linux发行版的翘楚,极大的方便了初学者的入门,搭建完ASP.NET Core运行环境后,作为半前半后的开发人员,就继续着搭建 ...

  2. 【转】Ubuntu下搭建SVN环境-Apache

    原文网址:http://www.cnblogs.com/candle806/archive/2012/12/20/2826280.html 环境描述:ubuntu server 12.04  / sv ...

  3. Ubuntu下搭建Mininet环境

    Mininet环境搭建分为两个步骤,如下: 1.从GITHUB上获取mininet源码到本地的opt目录下 打开Linux终端,切换目录到根目录 cd / 切换到Linux的opt目录下 cd opt ...

  4. Ubuntu下搭建WordPress环境

    WordPress是一种使用PHP语言开发的博客平台,用户可以在支持PHP和MySQL数据库的服务器上架设属于自己的网站.也可以把 WordPress当作一个内容管理系统(CMS)来使用.WordPr ...

  5. Ubuntu下搭建ryu环境

    RYU环境搭建总共四步: step1:首先下载相应的python套件,并且更新pip $ sudo apt-get install python-pip python-dev build-essent ...

  6. ubuntu下搭建LAMP环境

    本文参考:http://www.linuxdiyf.com/linux/21265.html 请支持原创. 步骤一:安装apache root@mrwang:~$ sudo apt install a ...

  7. ubuntu下搭建openGL环境

    1.      建立基本编译环境 sudo apt-get install build-essential 2.      安装OpenGL Library sudo apt-get install ...

  8. ubuntu下搭建车场环境(代码使用jekins构建)

    1.安装jdk,jre sudo apt-get update # 更新软件包管理器,如果已经执行过,则可以不用再执行 sudo apt-get install default-jdk # 安装默认的 ...

  9. Unix网络编程 -- ubuntu下搭建编译环境( 解决unp.h 编译等问题)

    1.安装编译器,安装build-essential sudo apt-get install build-essential 2.下载本书的头文件 下载unpv13e  http://ishare.i ...

随机推荐

  1. Confluence安装&破解&汉化

    p.MsoNormal,li.MsoNormal,div.MsoNormal { margin: 0cm; margin-bottom: .0001pt; text-align: justify; f ...

  2. 重温Javascript(四)-函数

    函数 函数声明提升,在执行代码之前会先读取函数声明 sayHi(); function sayHi(){ alert("Hi!"); } 递归 arguments.callee是指 ...

  3. 获取VB类模块成员函数指针(转)

    最近在做一些VB6.VBA的项目,被如何获取类模块中的函数指针这个问题所困扰,收集整理后,有2分资料值得收藏,特将关键部分留存,以备后续查找. 参照连接1:http://www.cnblogs.com ...

  4. 在hive中直接对timestamp类型取max报错

    之前直接对timestamp类型做max操作, select id,max(updatetime) updatetime from his.tag group by id; 结果查询的结果有的显示为1 ...

  5. java 基础知识九 类与对象

    java  基础知识九  类与对象 1.OO(Object–Oriented )面向对象,OO方法(Object-Oriented Method,面向对象方法,面向对象的方法)是一种把面向对象的思想应 ...

  6. JavaScript Array 技巧

    filter():返回该函数会返回true的项组成的数组 ,,,,]; var result = num.filter(function(item,index,array){ ); }) consol ...

  7. bigdecimal更精确的浮点处理方式

    Java在java.math包中提供的API类BigDecimal,用来对超过16位有效位的数进行精确的运算.双精度浮点型变量double可以处理16位内有效数,超过16位,double可能会出现内存 ...

  8. (function($){….})(jQuery)一种js插件写法

    我们先看第一个括号里边的内容:function($){….},这不就是一个匿名的函数吗?但是它的形参比较奇怪,是$,这里主要是为了不与其它的库冲突. 这样我们就比较容易理解第一个括号内的内容就是定义了 ...

  9. Nodejs核心模块

    (1)全局对象 在浏览器JS中,通常window是全局对象,而nodejs中的全局对象是global,所有全局变量都是global对象的属性. 在nodejs中能够直接访问到的对象通常都是global ...

  10. 腾讯AlloyTeam正式发布Canvas魔幻线条 - curvejs

    [原文链接] ## 写在前面 curvejs 中文读["克js"],是腾讯AlloyTeam打造的一款魔幻线条框架,让线条成为一名优秀的舞者,让线条们成为优秀的舞团,HTML5 ...