Disclaimer: This article was originally written in a personal blog , and here is the author's own reprint.
We can easily build a personal blog through Github-Pages provided by Github, and the default build tool for Github-Pages is Jekyll.
This article mainly introduces how to install and configure Jekyll environment on Ubuntu system for building and debugging your Github-Pages project locally.
Pre-installed
Jekyll relies on the Ruby environment. Ruby and RubyGems must be installed before Jekyll is installed.
# 1.安装ruby
$ sudo apt install ruby-full ruby-bundler
# 2.验证ruby安装版本
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]
# 3.验证gem安装版本
$ gem -v
3.1.2
# 4.配置国内gem source(https://rubygems.org太慢)
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
# 5.验证gem source配置,确保只有 https://gems.ruby-china.com
$ gem sources -l
https://gems.ruby-china.com
At this point, the preparations for installing Jekyll are complete, and then start to install Jekyll.
Install Jekyll
The steps to install Jekyll are simple:
# 使用gem安装jekyll
$ sudo gem install jekyll
# 验证jekyll安装版本
$ jekyll -v
jekyll 4.2.0
At this point, Jekyll has been installed.
Build Github-Pages project locally
-
Move your Github-Pages project
clone
to the local and switch to the correct branch -
Start building
# 修改bundle镜像配置,这样就不用修改Gemfile中的source配置 $ bundle config mirror.https://rubygems.org https://gems.ruby-china.com # 先使用bundle安装Gemfile配置中的插件 $ bundle install # 启动项目 $ jekyll serve
-
Local default access address:
http://127.0.0.1:4000