Introduction

This article is an update of the previous one on installing Jekyll in CentOS. It presents more accurate information, thus you could disregard the previuos one.

The main issue is that the version of Ruby needed by Jekyll is much newer then the one available in the CentOS main repositories. But fear not, there is a solution for that. All you have to do is to install Ruby using the RVM (Ruby Version Manager). Thus you will make sure that the latest version of Ruby is available on your system.

After the last version of Ruby is installed, you will be able to install Jekyll on CentOS. Below is the installation process.

Installation process

In order to install Jekyll in CentOS, you will need to install the latest verstion of Ruby, which at the time of writing is version 2.5.0. To do this, there are two methods that I will show you.

Before installin Ruby, I installed gcc and make just for peace of mind:

sudo yum install gcc make

To download the installation script from RVM run the following commands:

cd /tmp
curl -sSL https://get.rvm.io > ruby-install
chmod 755 ruby-install
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Now you should run the ruby-install script that we just created, using the command:

./ruby-install

Now, in order to be able ro use RVM with the rvm command, use the following command:

source /home/user/.rvm/scripts/rvm

where /home/user is actually your home directory, so feel free to use you user name instead of user. In my case it was alexandru, so the command was source /home/alexandru/.rvm/scripts/rvm.

After reboot, you can use RVM to install the latest version of Ruby. To do this, run the following commands:

rvm reload

To reload the RVM service.

rvm requirements run

To check if all the requirements for Ruby are installed. If there are some of them missing, you will be prompted to install them. If you run the command without sudo you will be asked for your password for the operation to be successful.

rvm list known
rvm install 2.4.1

Version 2.4.1 is the latest available when you run the list known command. Nevertheless, after the installation, you will receive a message like this:

Install of ruby-2.4.1 - #complete 
Please be aware that you just installed a ruby that requires 1 patches just to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to ruby-2.5.0 which will have all of the latest security patches.

These commands will show you the latest stable releases of ruby and you will have to choose for the one that you want. You can also try the following command:

rvm get stable

After all this, I also installed the 2.5.0 with the command:

rvm install 2.5.0

If you would like to check the available version of Ruby on your system, run the command:

ruby --version
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

Now you can install Jekyll using the gem command of Ruby:

gem install jekyll bundler

That’s it! Now lets start using Jekyll.

Using Jekyll

I use Dropbox for my Jekyll project, just to be able to have all the files on all my machines. Thus, I create a new directory for the Jekyll project called jekyll inside my Dropbox:

cd /home/user/Dropbox
mkdir jekyll
cd jekyll

While inside the project’s directory, you must create a new project (which I will call lark) with the command:

jekyll new lark
cd lark/

While inside the new lark directory, run the command:

bundle install

After you create some content (help can be found on the official Jekyll docs site) you can run the local server and test your output with the command:

bundle exec jekyll serve

and then open a browser and point it to the address: http://localhost:4000

There you go! You are now ready to use Jekyll as your Static Site Generator on your CentOS 7 machine. Please notice that all of the above commands were executed without root or sudo, unless noted as such.

Enjoy!