Install Ruby and dependencies
sudo apt install ruby-full build-essential zlib1g-dev
Then add following environment variables to .bashrc
# Install Ruby Gems to ~/gems
export GEM_HOME="$HOME/gems"
export PATH=$HOME/gems/bin:$PATH
Enable the modification
source .bashrc
Then install Jekyll & Bundler
gem install jekyll bundler
Navigate to the source root of the site.
Initiate project
bundle init
Add following lines to Gemfile
gem "jekyll"
Then there are 2 options:
-
Build only:
Builds the site and outputs a static site to a directory called
_site
.jekyll build
-
Build & Monitor:
Does
jekyll build
and runs it on a local web server athttp://localhost:4000
, rebuilding the site any time you make a change.jekyll serve
Or the following command (This restricts your Ruby environment to only use gems set in your
Gemfile
)bundle exec jekyll serve
Install here.
If the following error occur:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
run the following commands:
$ source ~/.rvm/scripts/rvm
$ type rvm | head -n 1
If it returns "rvm is a function", the problem is solved.