There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

Jekyll is a free and open-source content management system (CMS) written in Ruby. It is a simple and static site generator used to create your websites in minutes. It runs without any databases so you don't need to understand database administration. Jekyll takes the content, renders Markdown, and generates a complete and static website that you can deploy on any web server. It comes with a set of features including, permalinks, categories, pages, posts, custom layouts and many more.

In this tutorial, we will show you how to install Jekyll CMS on Ubuntu 20.04.

Prerequisites

  • A server running Ubuntu 20.04.
  • A root password is configured on your server.

Getting Started

Before starting, it is recommended to update your system with the latest stable version. You can update it with the following command:

apt-get update -y
apt-get upgrade -y

Once your system is up-to-date, install other required dependencies by running the following command:

apt-get install make build-essential curl git tree -y

Once all the dependencies are installed, you can proceed to the next step.

Install Ruby

Jekyll is written in Ruby so you will need to install it in your system.

Run the following command to install Ruby:

apt-get install ruby ruby-dev -y

Once the installation is complete, you will need to tell Ruby’s gem package manager to place gems in our user’s home folder.

You can do it by editing ~/.bashrc file:

nano ~/.bashrc

Add the following lines at the end of the file:

export GEM_HOME=$HOME/gems
export PATH=$HOME/gems/bin:$PATH

Save and close the file then activate the environment variable with the following command:

source ~/.bashrc

Next, you can install Jekyll and bundler using the gem command as shown below:

gem install jekyll bundler

Once the installation is complete, you can proceed to the next step.

Create a New Website with Jekyll

At this point, Jekyll is installed in your system. Now, run the following command to create a new website named jekyll.example.com:

jekyll new jekyll.example.com

Once the website is created, you should get the following output:

New jekyll site installed in /root/jekyll.example.com. 

Next, you list all files and directories created by Jekyll with the following command:

tree jekyll.example.com

You should get the following output:

jekyll.example.com
??? 404.html
??? about.markdown
??? _config.yml
??? Gemfile
??? Gemfile.lock
??? index.markdown
??? _posts
    ??? 2020-06-14-welcome-to-jekyll.markdown

1 directory, 7 files

Start Jekyll Server

First, navigate to the website directory and start the Jekyll web server by running the following command:

cd jekyll.example.com
jekyll serve --host=0.0.0.0

Once the server started successfully, you should get the following output:

Configuration file: /root/jekyll.example.com/_config.yml
            Source: /root/jekyll.example.com
       Destination: /root/jekyll.example.com/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
                    done in 0.502 seconds.
 Auto-regeneration: enabled for '/root/jekyll.example.com'
    Server address: http://0.0.0.0:4000/
  Server running... press ctrl-c to stop.

Access the Jekyll Website

At this point, Jekyll is started and listening on port 4000. Now, open your web browser and type the URL http://your-server-ip:4000. You will be redirected to the Jekyll default page:

Conclusion

In the above guide, you learned how to install Jekyll on Ubuntu 20.04. You can now explore the Jekyll and create your own website using the automatically-generated content.

Share this page:

0 Comment(s)