Install Jekyll on Ubuntu 20.04 - A step by step guide ?

Jekyll is a static site generator that takes simple files and folders and converts them into a static website. It is developed in the Ruby Language. Jekyll is quite simple when compared to other static site generators. 

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related website development queries.

In this context, we shall look into how to install and launch your first static website.


Steps to Install Jekyll on Ubuntu

To install Jekyll, you need to follow the below outlined steps.


1. Setup Ruby development environment first

Run the below command to set up Ruby:

$ sudo apt install ruby-full build-essential zlib1g-dev

Here:

  • build-essential: this will install required dependency needed to execute ruby environments.
  • zlib1g-dev: this package includes development files. Mostly they are header files in C and C++ languages.


2. Configure Ruby gems path and install Jekyll.

Here, We will set up my directory to install Ruby gems in a specific folder. We will also add environment paths and then source the ~/.bashrc. This is how We populated environmental variables in Debian Linux.


3. Install Jekyll and Bundler

Now We will install Jekyll and its companion gem "bundler" which is very helpful to keep gems updated:

$ echo '# Install uby Gems to ~/.gems' >> ~/.bashrc
$ echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
# echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
$ gem install install jekyll bundler


4. Create a new folder for our static site

You will need the following commands to do so:

$ mkdir ./myWebsite
$ cd myWebsite


5. Create a new Jekyll website in the folder

Now, run the below command to create the site in our newly created folder "~/myWebsite":

$ jekyll new


6. Run the build and see your website live on http://localhost:4000/

The command is:

$ bundle exec jekyll serve

You will see that Jekyll is now running with its full power.


How to Uninstall Jekyll from Ubuntu Linux system ?

Why would you remove Jekyll? Maybe you don’t need it. Anyway, It is simple to remove Jekyll. You would need to run the following commands to remove it:

$ gem remove jekyll


[Need assistance in Setting up Jekyll on Debian Linux system ? We can help you. ]

This article covers how to install and publish a static website using Jekyll. In fact, Jekyll is an open-source static-site generator written in Ruby which allows for quick execution of commands that help manage your site from initial to production deployment, all from your command line.

Related Posts