1. Introduction
This is a simple tutorial for deploying Jekyll and Github Pages on Ubuntu.
2. Content
2.1 Jekyll on Ubuntu
1. Requirements
Before you install Jekyll, you should install necessary required dependencies.
sudo apt-get install ruby ruby-dev build-essential
2. Add environment variables
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME=$HOME/gems' >> ~/.bashrc
echo 'export PATH=$HOME/gems/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
You can also use sudo vim ~/.bashrc to check the update.
3. Adding a New Gem Source
Because of slow download speed of official gem source, you need to substitute it with a reliable gem source.
- check current gem source
gem sources -l - remove official gem source
gem source --remove https://rubygems.org/ - add a new gem source
gem source --add https://gems.ruby-china.org/ - ensure official gem source not in the list
gem sources -l
4. Jekyll installation
gem install jekyll bundler
5. Start Jekyll
- create project directory
Jekyll new blog - start Jekyll
cd blog Jekyll serve
2.2 Attention
- version check
gem -v jekyll -v ruby -v -
mutply ruby versions
-
gem source
-
Jekyll update issue
In _config.yml, gem -> plugins - missing package
add package name to Gemfile
or
gem install package_name