Creating a Jekyll Blog on Ubuntu 16.04

Using a Different System?

  • Creating a Jekyll Blog on CentOS 7

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


Jekyll is a great alternative to WordPress for blogging or sharing content. It doesn’t require any databases and it is very easy in which to write new posts. Jekyll is static and requires little memory, which means it can run on the 768MB or even 512MB Vultr instances with low traffic.

Step 1: Installing Ruby

First, log into your server, then execute these commands:

sudo apt-get updatesudo apt-get install ruby-full make gcc nodejs build-essential patch

Step 2: Setting up Jekyll

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

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 anything you’d like.

jekyll buildmkdir /home/jekyllcd /home/jekylljekyll new myblogchown jekyll:jekyll -R myblog/

And finally, let’s start it:

cd myblogbundle exec jekyll serve --detach

Step 3: Creating an 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:

sudo apt-get install nginx

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

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

Change myblog.com to your website domain, and save.

Execute the following to restart Nginx:

systemctl restart nginx

With your DNS provider, direct your domain to your server’s IP address. If you did all of this correctly, you will be able to see your Jekyll blog at your website domain!

Writing posts

Every time you wish to write a post, log into your server. Then, switch to the jekyll user:

su jekyllcd ~/myblogcd _posts

To create a post, create a file, named with the format “year-month-day-yourposttitle.markdown“. For example:

2017-1-1-helloworld.markdown

Populate the file with Markdown content, and you will have completed writing a post.

Conclusion

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.