Best Steps to Install and Configure Jekyll on Debian 11

This guide intends to teach you to Install and Configure Jekyll on Debian 11.

Jekyll is software that helps you “generate” or create a static website (you may see Jekyll described as a “static site generator”). Jekyll takes page templates—those things like main menus and footers that you’d like shared across all the web pages on your site, where manually writing the HTML to include them on every webpage would be time-consuming. These templates are combined with other files with specific information (e.g. a file for each blog post on the site) to generate full HTML pages for website visitors to see.

Jekyll doesn’t need to do anything like querying a database and creating a new HTML page (or filling in a partial one) when you visit a webpage; it’s already got the HTML pages fully formed, and it just updates them when/if they ever change.

Steps To Install and Configure Jekyll on Debian 11

To complete this guide, you must log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with Debian 11.

Now follow the steps below to Install and Configure Jekyll on Debian 11.

Install Ruby on Debian 11

Jekyll is written in Ruby, so you need to have Ruby installed on your Debian server.

First, update your local package index with the command below:

sudo apt update

Then, use the following command to install Ruby and the required packages:

sudo apt install make build-essential ruby ruby-dev

Verify your Ruby installation by checking its version:

ruby -v
ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-linux-gnu]

Set up Jekyll on Debian 11

At this point, you need to configure the Ruby Gems path and then Install and Configure Jekyll on Debian 11.

Configure Ruby Gems Path

Here you need to open your bashrc file with your favorite text editor, we use the vi editor:

sudo vi ~/.bashrc

Then, add the following content to the file:

# Install Ruby Gems to ~/.gems
export GEM_HOME=$HOME/gems
export PATH=$HOME/gems/bin:$PATH

When you are done, save and close the file.

Source the profile by running the command below:

sudo source ~/.bashrc

Install Jekyll Site Generator on Debian 11

At this point, you can easily use the following gem command to Install and Configure Jekyll on Debian 11:

gem install jekyll bundler
Successfully installed bundler-2.4.8
Parsing documentation for bundler-2.4.8
Installing ri documentation for bundler-2.4.8
Done installing documentation for bundler after 0 seconds
29 gems installed

Configure Firewall for Jekyll

By default, Jekyll is listening on port 4000. So it would be best if you opened the port through your firewall. To do this, run the command below:

sudo ufw allow 4000

Reload the firewall to apply the new rules:

sudo ufw reload

Create a New Demo Site with Jekyll

At this point, we will show you how to create a new demo site by using Jekyll on Debian 11.

To do this, switch to your home directory and run the following command to create the demo site:

# cd ~ 
# jekyll new demo-site

You can check the files inside your demo site directory by using the command below:

# sudo apt install tree
# tree demo-site
├── 404.html
├── about.markdown
├── _config.yml
├── Gemfile
├── Gemfile.lock
├── index.markdown
└── _posts
    └── 2023-03-09-welcome-to-jekyll.markdown

1 directory, 7 files

Run Web Server with Jekyll

Now Jekyll can monitor the files in the created directory and quickly generate a static site from them on Debian 11. It also automatically regenerates the site when changes are made to these files.

To run the web server, use the following commands:

# cd ~/demo-site
# bundle add webrick
# jekyll serve --host=your-host-ip-address

Note: With no host specified, Jekyll will serve the site on localhost.

Auto-regeneration: enabled for '/root/demo-site'
    Server address: http://ip-address:4000/
  Server running... press ctrl-c to stop.

When the above command is executed, Jekyll with use configurations and content in the directory _site

tree ~/demo-site
├── 404.html
├── about.markdown
├── _config.yml
├── Gemfile
├── Gemfile.lock
├── index.markdown
├── _posts
│   └── 2023-03-09-welcome-to-jekyll.markdown
└── _site
    ├── 404.html
    ├── about
    │   └── index.html
    ├── assets
    │   ├── main.css
    │   ├──
    │   └── minima-social-icons.svg
    ├── feed.xml
    ├── index.html
    └── jekyll
        └── update
            └── 2023
                └── 03
                    └── 09
                        └── welcome-to-jekyll.html

9 directories, 15 files

You can also run the Jekyll server in the background:

jekyll serve --host=host-ip > /dev/null 2>&1 &

Access Jekyll Site on Debian 11

At this point, you can access the site by typing the following URL in your web browser:


You will see the Jekyll Welcome page.

Jekyll welcome page site
Jekyll Site

Now we want to show you how to add a post on your Jekyll site on Debian 11.

Create a Sample Post on Jekyll

Posts are added to the _posts directory with the following format:



  • YEAR is a four-digit number, and MONTH and DAY are both two-digit numbers example; 2023-01-07
  • MARKUP is the file extension representing the format used in the file.

For example, use the command below to create a hello world post:

vi ~/demo-site/_posts/

Add the below lines to the file.

layout: post
title:  "Hello World!"

# Welcome

**Hello world**, this is my first Jekyll blog post.

I hope you like it!@OrcaCoreTeam

When you are done, save and close the file.

Finally, refresh your Jelly Site page, and you will see:

Add a Jekyll Post
Jekyll Post

You can click on your post to see the content of the post you have added:

Jekyll Post content
Post Content

For more information, you can check the official docs page.


At this point, you have learned to Install and Configure Jekyll on Debian 11.

Hope you enjoy it. For more articles and guides, you can visit the Orcacore website.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!