Creating a Jekyll Blog on CentOS 7

Using a Different System?

  • Creating a Jekyll Blog on Ubuntu 16.04

Are we missing a guide for your target system? Request one, or submit your own!

Jekyll is a good alternative to WordPress. It doesn’t require any databases and it works with a language many are familiar with (Ruby on Rails). Jekyll is static and requires little memory, which means it can run on the 768MB Vultr instance for low traffic.

Step 1: Installing Ruby on Rails

First, log on to your instance/server and update your packages. Please make sure you’re logged in as the root user.

yum update -y

Now, let’s grab Ruby’s package manager (RVM).

cd /tmpcurl -sSL > ruby_installchmod 755 ruby_installgpg --keyserver hkp:// --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 ./ruby_install stable --ruby 

This will take a while, as everything is compiled. Please allow for a few minutes and once you’ve been returned to the prompt, continue to the next step.

Let’s install Ruby now.

rvm install rubyrvm --default use ruby    

Awesome! Now, we need to get NodeJS as it is a dependency of Ruby on Rails.

yum install epel-release -yyum install npm nodejs -y

Step 2: Installing Jekyll

This part is quite easy. Simply execute the following to install Gem dependencies of Jekyll:

gem install jekyll bundler

Now, create a user for it:

useradd jekyll 

We need to create the blog now – feel free to change myblog to the title of your blog.

jekyll buildcd /home/jekyll/jekyll new myblogchown jekyll:jekyll -R myblog/

And finally, let’s start it:

bundle exec jekyll serve --detachexit

Step 3: Creating a Nginx proxy

Because Jekyll runs on port 4000, visitors will be required to add the port into the URL, which isn’t very good. We’ll install Nginx, which will forward requests from port 80 to 4000.

First, get the package:

yum install nginx -y

Now, open up your favorite text editor to /etc/nginx/conf.d/jekyll.conf and paste the following:

server {    listen 80;    server_name;    location / {        proxy_pass http://localhost:4000;    }}

Change to your website domain, and save.

Now, open up /etc/nginx/nginx.conf with your favorite text editor. Comment out anything from lines 38 to 57 by adding a # symbol behind the lines. Save the file, then execute the following to restart Nginx:

systemctl restart nginx

Step 4: Configure the firewall

Port 80 hasn’t been opened to the public yet – let’s fix that. Please run the following:

firewall-cmd --zone=public --add-port=80/tcp --permanent

And reload for the effects to take place:

firewall-cmd --reload

Writing posts

Every time you wish to write a post, log in to your server. Then, drop privileges:

su jekyllcd ~/myblogcd _posts

To create a post, create a file with the following format:


For example: 2017-1-1-helloworld.markdown

Populate the file with Markdown content. You have completed writing a post.


In this article, you setup a Jekyll blog. Now, all you have to do is focus on your content. Good luck!

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.