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.
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
make just for peace of mind:
sudo yum install gcc make
To download the installation script from RVM run the following commands:
Now you should run the
ruby-install script that we just created, using the command:
Now, in order to be able ro use RVM with the
rvm command, use the following command:
/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
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.
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:
After all this, I also installed the 2.5.0 with the command:
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:
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. Please notice that all of the above commands were executed without root or sudo, unless noted as such.