As you have seen in the previous post, installing Jekyll in Fedora was quite easy - just a couple of commands and you were done. Nevertheless, in CentOS 7 things are a little bit complicated. But not much more complicated.

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.4.1. To do this, there are two methods that I will show you.

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

cd /tmp
curl -sSL > ruby-install
chmod 755 ruby-install
gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

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

source /usr/local/rvm/scripts/rvm

Now that RVM is downloaded, you should restart your system using the command:

shutdown -r now

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

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, a reboot is needed, so you should try the command:

shutdown -r now

Those commands got you the latest stable version of Ruby installed. Latest version at the time of this article was 2.4.1.

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.