Saturday, November 5, 2016

Setting up Jekyll on Ubuntu 16.04

I recently set up Jekyll 3 on Ubuntu 16.04. The procedure is simple, works on Ubuntu 14.04, and perhaps also works on other versions of Ubuntu and other Linux distributions.

  1. Create a directory for your Jekyll site. For instance, let us call it "mysite".
           mkdir mysite
  2. Go to the site directory, and create a file called "Gemfile". The file defines Ruby applications dependencies. Since Jekyll is a Ruby application. This file defines the dependencies for Jekyll. It is quite simple, and the following shell command will create the file with sufficient content.
           cd mysite
           echo "source ''" > Gemfile
           echo "gem 'execjs'" >> Gemfile
           echo "gem 'therubyracer'" >> Gemfile
           echo "gem 'github-pages', group: :jekyll_plugins" >> Gemfile
  3. Now install Ruby and other necessary packages.
           sudo apt-get install ruby ruby-dev ruby-bundler zlib1g-dev build-essential

  4. Finally, install Jekyll and its dependencies. On the site directory where Gemfile is, do the following,
           bundle install
  5. To build the Jekyll site, do the following on the site directory,
           bundle exec jekyll build
  6. You can serve the site by the following command,
           bundle exec jekyll serve --host= --port=4000


  1. I get an error performing step 4...

    Had a look at some places like here:

    and here:

    and here:

    Still running into problems..


    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory:
    /usr/bin/ruby2.3 -r ./siteconf20161112-7491-1elozhg.rb extconf.rb
    checking for main() in -lpthread... yes
    creating Makefile

    To see why this extension failed to compile, please check the mkmf.log which can be
    found here:


    current directory:
    make "DESTDIR=" clean

    current directory:
    make "DESTDIR="
    g++: error: unrecognized command line option ‘-Wdate-time’
    g++: error: unrecognized command line option ‘-fstack-protector-strong’
    Makefile:207: recipe for target 'accessor.o' failed
    make: *** [accessor.o] Error 1

    make failed, exit code 2

    Gem files will remain installed in
    /tmp/bundler20161112-7491-po5kaktherubyracer-0.12.2/gems/therubyracer-0.12.2 for
    Results logged to

    An error occurred while installing therubyracer (0.12.2), and Bundler
    cannot continue.
    Make sure that `gem install therubyracer -v '0.12.2'` succeeds before bundling.

    Any help would be appreciated.
    Thanks in advance.

    1. Please do the following before you do "bundle install",

      sudo apt-get update
      sudo apt-get upgrade