Install Jekyll CMS on Ubuntu 18.10 in 3 steps THE RIGHT WAY

Jekyll meets Ubuntu
Image: Jekyll meets Ubuntu (License: CC-BY-SA Marcelo Canina)
Last modified:


Guide to install Jekyll on Ubuntu focusing in having the latest Jekyll version and without interfering with the native Ubuntu package manager (i.e.: apt1 / snap2).

For this we are going to use the Jekyll gem avoiding the usage of the distro packages.

The steps to follow are:

  1. install the required system packages using Ubuntu's apt tool
  2. configure paths/shell variables
  3. install Jekyll gem and Bundler

1. Install packages

We start installing the required dependencies to use Ruby Gems in our environment by install the following packages: sudo apt-get install ruby-full build-essential zlib1g-dev

This will provide:

  • ruby-full: “Ruby full installation (default version)”
  • build-essential: “This package contains an informational list of packages which are considered essential for building Debian packages.”
  • zlib1g-dev: “compression library - zlib is a library implementing the deflate compression method found in gzip and PKZIP.”

Now we need to install ruby-bundler to manage Ruby application dependencies.

2. Configure Ruby Gems

Now we have the RubyGems environment in our system, we can check its setup using gem environment:

The problem is that as it can be seen with the GEM PATHS environment variable, our gems will be installed at a system wide location /var/lib/gems/2.5.0 using root user privileges.

To avoid this, we set up a gem installation directory for our user account.

In our ~/.bashrc or ~/.profile, we add the following environment variables:

# ...

# RUBY #
# Avoid installing Ruby Gems as the root user
# Install Ruby Gems to ~/gems
export GEM_HOME="$HOME/gems"
export PATH="$HOME/gems/bin:$PATH"

And load the new configuration: source ~/.bashrc or source ~/.profile depending on which you used.

To check everything works right: gem environment should display the new configuration:

3. Install Jekyll

Finally we use the Jekyll package from the RubyGems repository, that we are sure it will contain the latest Jekyll version available, in contrast with the Ubuntu packages repository which would probably be many versions behind.

That shows us that, at the moment of writing this, gem version is: 3.8.5 while the apt version is: 3.1.6+dfsg-3.

We proceed to install the Jekyll gem and bundler to make it possible to work with different Jekyll instances at the same time gem install jekyll bundler


This is the full list of the commands used:

sudo apt-get install ruby-full build-essential zlib1g-dev
sudo apt install ruby-bundler

# check gem env 
gem environment

# added to ~/.bashrc` or `~/.profile
export GEM_HOME="$HOME/gems"
export PATH="$HOME/gems/bin:$PATH"

# use above vars
source ~/.bashrc #or source ~/.profile

# check new environment
gem environment

# obtain Jekyll gem info
gem search --details --exact jekyll

# install Jekyll
gem install jekyll bundler


This is a pretty straightforward procedure to install any gem in Ubuntu, having installed the latest Jekyll available, minimizing the risks of interfering with the native package manager and reducing risks without using root privileges.

Now you have the latest Jekyll version available:


  1. apt: “Advanced Package Tool, or APT, is a free-software user interface that works with core libraries to handle the installation and removal of software on Debian, Ubuntu, and related Linux distributions.” ↩︎

  2. snap: “A universal app store for Linux” ↩︎

Marcelo Canina
I'm Marcelo Canina, a developer from Uruguay. I build websites and web-based applications from the ground up and share what I learn here.
comments powered by Disqus

How to install the latest Jekyll version on Ubuntu minimizing risks.

Clutter-free software concepts.
Translations English Español