how to install jekyll on centos 7


Jekyll is Ruby based, free and easy to use site generator, designed for creating static blogs, but it can be also used for creating all types of static websites as well, without using a database. Jekyll works by processing plain text files in Markdown and Textfile or Liquid templates and generating static website. This kind of websites have many advantages over the dynamic sites, such as security, speed and flexibility. Websites generated with Jekyll can be hosted on any type of web server or GitHub. In this tutorial we will cover the installation of Jekyll on a CentOS 7 VPS.

1. Prerequisites

Jekyll has several requirements which we have to install on the server, in order to run it:
– SSH access to the VPS with root privileges. All our VPS hosting plans come with full root access
– Ruby version 2.2.5 or newer, including all development headers
– RubyGems package manager
– GCC and Make compilers

2. Login via SSH and update the system

To begin, login to your CentOS 7 VPS via SSH as user root

ssh [email protected]_Address -p Port_number

As usual, make sure that all packages installed on your server are updated to the latest available version

yum -y update

This process is better explained in one of our previous blog posts.

3. Install Ruby

Jekyll is based on Ruby, so we have to have it installed on the server. It is available in the official CentOS 7 repositories, so we can simply install it running the following command

yum install ruby

Once it is installed, check Ruby’s version

ruby -v
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]

It will also install RubyGems which is also required by Jekyll

gem -v

As you may noticed, this is not the latest version of Ruby. If you need a more recent version of Ruby you can install it using Ruby Version Manager (RVM). It also allows you to install multiple version of Ruby on the server which is very useful if your application is built and depends on a specific Ruby version. To install RVM on your server, first import its key using the following command

gpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

and run the following command to install it

\curl -sSL | bash -s stable

To start using RVM you need to run the following

source /etc/profile.d/

Now, you can go ahead and install Ruby

rvm install ruby

And if you check you will see that a newer version of Ruby installed on your server

ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

4. Install Jekyll on CentOS 7

After we make sure that all requirements are installed, we can proceed with the Jekyll installation. It can be installed using the RubyGems package manager we mentioned earlier in this post. Run the following command

gem install jekyll

To verify the installation you can check Jekyll’s version

jekyll -v
jekyll 3.8.0

This means that Jekyll version 3.8.0 is successfully installed and ready to use on your CentOS 7 VPS.

We also need to install Bundler on the server. It is a package manager that manage gems and it will help us to install all Jekyll dependencies

gem install bundler

5. Create Jekyll blog

If you closely followed the tutorial, your server is ready for creating your first Jekyll project. We will create a simple static blog to test the installation. Run the following command

cd /opt/
jekyll new blog

New jekyll site installed in /opt/blog

This will create a new ‘blog’ directory. To list all available options you can use when creating the blog, you can use the following command

jekyll new --h

            --force        Force creation even if PATH already exists
            --blank        Creates scaffolding but with empty files
            --skip-bundle  Skip 'bundle install'
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs
        -s, --source [DIR]  Source directory (defaults to ./)
        -d, --destination [DIR]  Destination directory (defaults to ./_site)
            --safe         Safe mode (defaults to false)
        -p, --plugins PLUGINS_DIR1[,PLUGINS_DIR2[,...]]  Plugins directory (defaults to ./_plugins)
            --layouts DIR  Layouts directory (defaults to ./_layouts)
            --profile      Generate a Liquid rendering profile
        -h, --help         Show this message
        -v, --version      Print the name and version
        -t, --trace        Show the full backtrace when an error occurs

Now, change the current working directory

cd blog/

and run the following command to build the site on the preview server

bundle exec jekyll serve
Configuration file: /opt/blog/_config.yml
            Source: /opt/blog/
       Destination: /opt/blog/_site
 Incremental build: disabled. Enable with --incremental
                    done in 0.342 seconds.
 Auto-regeneration: enabled for '/opt/blog'
    Server address:
  Server running... press ctrl-c to stop.

The new Jekyll blog will be created and it accessible at . You will be able to access it only from the localhost. If you want to make it publicly available, use the following command

jekyll serve --host IP_Address &

replace IP_Address with your server’s IP address and you will be able to access your first Jekyll blog with your favorite web browser at http://IP_Address:40000 . You should get the default Jekyll home page.

Install jekyll on centos 7

If you need more information and want to learn how to use this amazing static site builder, visit Jekyll’s official documentation.

installing jekyll on centos 7Of course you don’t have to install Jekyll on CentOS 7,  if you use one of our CentOS Web hosting services, in which case you can simply ask our expert Linux admins to install Jekyll on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on how to install Jekyll on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.