Jekyll on a shared Dreamhost server

This blog started as a set of static pages, mostly updated in a plain text editor, as I have yet to find a blogging tool that does not get in a way of writing. There is ups and downs of running your own infrastructure for blogging. Fundamentally I’m a firm believer in the “own your data” philosophy so I gave Jekyll a try.

What is Jekyll?

Jekyll is a parsing engine used to build static websites from dynamic components such as templates, partials, liquid code, markdown etc. You can install it as a ruby gem on your local computer and use it to generate a static website, no databases, Wordpresses or other baggage. You can read more about Jekyll here.

What’s in it for me?

I got tired of manually updating the static HTML pages, for instance the “Next” and “Previous” post links. With Jekyll I just push a post markdown file via Git to the server and let Jekyll do the heavy lifting: update the homepage with new post, include the “Next” and “Previous” links, update previous post. With Jekyll making global updates, like changing the post template are a breeze. Just update the template in one place are Jekyll re-generates the appropriate pages to match the new template.

Jekyll on a local computer vs Jekyll on a server

Whether or not you want to install Jekyll on a server depends on your blogging workflow. You have two options:

  1. Local Jekyll - run Jekyll on a local machine and upload the generated, static website to the server
  2. Jekyll on the server + Git - run Jekyll on the server, use Git to push a post to the server and have Jekyll re-generate the website on the sever

I love geeking out so I tried option #2 - Jekyll on a server + Git. So whatever you see now is a result of geeking out :)

Dreamhost + Jekyll

  • LOCAL MACHINE - do this in a terminal on your local computer
  • SERVER - do thins in a terminal on the server

Step 1 SSH into your Dreamhost account


Step 2 Install RVM

Install RVM. It’s the Ruby Version Manager you need to update the Dreamhost default Ruby version, because Jekyll needs Ruby >= 1.9.3.

SERVER> curl -L | bash -s stable

You can get a “GPG signature verification failed” warning. To fix this import Michal Papis (RVM maintainer) GPG keys with:

SERVER>curl -sSL | gpg --import -

Now set a temp environment variable

SERVER>foo='[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"'' 

Add that variable to the .profile and re-load it with updated rvm paths

SERVER> echo $foo >> ~/.bash_profile
SERVER> echo $foo >> ~/.bashrc

To start using RVM run its post install script.Look at the RVM post install comments for the path if you’re not sure where you installed RVM

SERVER>source /your-home/path/.rvm/scripts/rvm

Step 3

Before installing a modern Ruby version disable autolibs, since you do not have access to the root user

SERVER>rvm autolibs disable

Install Ruby 2.0.0 + set it as default + install therubyracer (need ExecJS to process coffeescript)

SERVER> rvm install 2.0.0
SERVER> rvm --default use 2.0.0
SERVER> gem install therubyracer

Step 4 Install Jekyll with Pygments (for syntax highllighting)

SERVER> gem install jekyll
SERVER> mkdir ~/soft && mkdir ~/packages && mkdir ~/packages/lib && mkdir ~/packages/lib/python && cd ~/soft
SERVER> echo 'export PYTHONPATH=\"$HOME/packages/lib/python:/usr/lib/python2.6\"' >> ~/.bash_profile
SERVER> source ~/.bash_profile
SERVER> wget
SERVER> tar -xvzf Pygments-1.6.tar.gz
SERVER> cd Pygments-1.6
SERVER> python install --home=$HOME/packages 

Step 5 Generating SSH keys for auto SSH login

Setup public key SSH login on Dreamhost to push Git updates over SSH with automatic, key-based login

First check if local machine SSH keys exist

LOCAL MACHINE>ls -al ~/.ssh

If the .ssh directory is not found or you do not see any files starting with id_ generate the local machine SSH keys with the command below:

LOCAL MACHINE>ssh-keygen -t rsa -C ""

It generates the SSH keys which then upload to the SERVER. If the .ssh directory does not exist on the SERVER create it first.

LOCAL MACHINE>scp ~/.ssh/ "":~/

SERVER> cat >> .ssh/authorized_keys
SERVER> chmod go-w ~
SERVER> chmod 700 ~/.ssh
SERVER> chmod 600 ~/.ssh/authorized_keys

STEP 6 Setup Git repos for Jekyll

LOCAL MACHINE> mkdir jekyll-local-repo && cd jekyll-local-repo
LOCAL MACHINE> git init 

Git works best when there is files in the repo :) Add your Jekyll files to repo directory - create them with the ‘jekyll build’ command. More info here

LOCAL MACHINE> git add * 
LOCAL MACHINE> git commit -m "Initial commit" 

SERVER> mkdir jekyll-server-repo && cd jekyll-server-repo
SERVER> mkdir jekyll-blog.git && cd jekyll-blog.git
SERVER> git --bare init

LOCAL MACHINE> git remote add origin ssh://
LOCAL MACHINE> git push --all origin

STEP 7 Setup Git to run Jekyll when a post is pushed to the server

On the server navigate to /home/myUser/gitprojects/repo.git/hooks and edit the post-receive file. If there is no post-receive file create one.

SERVER>cd /home/myUser/gitprojects/repo.git/hooks
SERVER> touch post-receive

Here’s what you should put into the post-receive file, given you want to host your blog under


jekyll build --source $TMP_GIT_CLONE --destination $PUBLIC_WWW
cd ~ 

Make post-receive file executable

SERVER> chmod ug+x post-receive

STEP 8 Does it work?

Navigate to the Jekyll git repo on the local machine. Edit _config.yml and change to title unter site setting to “It WORKS!”. Next push the local updates to the server

LOCAL MACHINE> cd jekyll-local-repo
LOCAL MACHINE> git add *
LOCAL MACHINE> git commit -m "Will this work?"
LOCAL MACHINE> git push --all origin

You should see something like this

Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 315 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Cloning into '/home/'...
remote: done.
remote: Configuration file: /home/
remote:             Source: /home/
remote:        Destination: /home/userName/
remote:       Generating...
remote:                     done.
remote:  Auto-regeneration: disabled. Use --watch to enable.

In the browser navigate to You should see a plain Jekyll blog. Congratulations!


The guide about is based on an excellent Jekyll Dreamhost installation guide by Nicholas Sorrell.