I got Jekyll up and running on my server, and most of the time it was simply a matter of following the instructions. But some steps were not so obvious, so for posterity, here it is.
Installing Jekyll via gems and Ruby
gem is a Ruby command, so we will need to install Ruby first and then Rubygems.
There are many ways to install Ruby, but since the Debian/Ubuntu repos tend to be slightly outdated
Downloaded and ran the RVM installation script
\curl -sSL https://get.rvm.io | bash -s stable
To test that RVM has been properly installed, we can issue
type rvm | head -n 1
and should get
rvm is a function back. We have thus successfully installed RVM. But we have not installed Ruby yet.
RVM gives us plenty of choice when it comes to the flavour of Ruby we want, and it took some googling to figure out what distinguishes them. It turns out, not so much, and since we are noobs, we will go with MRI Ruby which is the original implementation, named after Ruby inventor and author Yukihiro Matsumoto.
rvm install 2.1.1
We installed MRI Ruby 2.1.1. Now we need to tell RVM to use this as default for new shells.
rvm use 2.1.1 --default
That’s it for Ruby.
This is fairly straight-forward. Download, unpack and install the latest rubygems.
wget http://production.cf.rubygems.org/rubygems/rubygems-2.3.0.zip unzip rubygems-2.3.0.zip cd rubygems-2.3.0 ruby setup.rb
That’s it for RubyGems.
This is another requirement of Jekyll. On a recent Ubuntu install, it would be as easy as
apt-get install nodejs
but on Debian, it is available through Wheezy backports or you’ll have to build from source. The former is easier so we’ll add the backport repo and install as usual.
echo "deb http://ftp.us.debian.org/debian wheezy-backports main" >> /etc/apt/sources.list apt-get update apt-get install nodejs
Now we can install Jekyll by running:
gem install jekyll
(this will install a bunch of other gems as well).
At this point, running
jekyll without any arguments should present you with
jekyll 2.1.1 -- Jekyll is a blog-aware, static site generator in Ruby
followed by jekyll’s help message.
Creating and building the site
I put the source directory in my home directory tree, and the site folder in the
The initial source skeleton was created using
jekyll new, and after making some changes to
_config.yml I built the site using
jekyll build --source $SOURCE --destination $DESTINATION where
$DESTINATION were the path of the source directory (in the home tree) and the path of the destination directory (in the webserver tree), respectively.
Note that it was very important to set the
baseurl: property in
_config.yml so that it corresponds to where the destination directory resides. For example, if the site is placed in
/var/www/blog, we should set
baseurl: /blog. At first, I did not realise this, and the site rendered very poorly due to all relative links being broken, including those that pointed to the css-files.
Actually, I ended up removing the option
baseurl altogether from
_config.yml. Turns out
baseurl can be quirky.