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.
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:
Now, in order to be able ro use RVM with the
rvm command, use the following command:
Now that RVM is downloaded, you should restart your system using the command:
After reboot, you can use RVM to install the latest version of Ruby. To do this, run the following commands:
To reload the RVM service.
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.
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:
After all this, a reboot is needed, so you should try the command:
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:
That’s it! Now lets start 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:
While inside the project’s directory, you must create a new project (which I will call
lark) with the command:
While inside the new
lark directory, run the command:
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:
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.