My OpenBSD Octopress Blog

An example of blogging from OpenBSD

Octopress on OpenBSD

I agreed to give a talk at CapBUG on setting up and using Octopress to create a blog. Octopress uses Jekyll to let you create the pages and framework for a static website locally and then deploy the web site to a remote web server. You can find a copy of the presentation here

As Brandon Mathis’ tagline on the Octopress site says, this is “A blogging framework for hackers.” Fortunately I’d set up Octopress on Mac OS X Mountain Lion and understood how it worked. However I had never used OpenBSD or setup an OpenBSD system. So I decided to use my dilemma as a learning experience! Please don’t view this as a master class in setting up Octopress but more the public stumblings of a misguided soul! Here is what I learnt…

Creating An Open BSD Virtual Machine

I created an OpenBSD 5.2 virtual machine using the install52.iso in VMware Fusion v5. I set the Fusion VM configuration to be:

OS=Other; Version=FreeBSD 64-bit; Memory=256MB; Network Adapter=Shared With My Mac; Hard Disk=10GB in 2GB splits

I accepted most of the defaults for the BSD installation:

default keyboard layout; hostname=yourhostname; network interface=em0; IPv4=DHCP; IPv6=none; root password=password; sshd=yes; ntpd=yes; ntp server=default; X Window=yes; xdm=no; console to com0=no; user=octopressuser; full name=full name; octopressuser password=password; disable sshd root=yes; TZ=US/Eastern; root disk=sd0; DUIDs=yes; MBR has invalid signature therefore Use whole disk=yes; Layout=Auto; Sets location=cd; sets media=cd; pathname to sets=5.2/i386; Sets=All except; Set time

Setting Up An OpenBSD Workstation For Octopress

As mentioned above, I have not set up an OpenBSD (nor FreeBSD) system before and I wanted to use this exercise as a learning experience. My familiarity with other operating systems made me realize that for this exercise to be successful I had to understand how the package management system worked in OpenBSD. So it was off to Chapter 15 in the OpenBSD FAQ to read up on The OpenBSD Packages And Ports System.

As with most exercises of this nature Google is your friend. While there is no definitive guide to setting up Octopress on OpenBSD that I could find, there are a number of blogs that helped to provide clues as to what I should do and they are listed below in the bibliography.

Octopress uses Ruby to perform its magic, and uses Git and Rsync to help it function. As an OS X user and part time Ubuntu Linux distribution user I have a world view that involves using Bash and most probably doesn’t fit with that of a typical OpenBSD user, so my apologies in advance.

Throughout this text I’ll try to use the following conventions: root is the OpenBSD root user; octopressuser is the normal user you created when setting up the system.

Setting Up The Root And User Environment

To simplify the use of the package management system I assigned the PKG_PATH variable in .profile for both root and octopressuser. Insert the following into .profile:

export PKG_PATH

Ironically while writing this blog post I encounted errors when I used Octopress to generate this post. Chapter 10 of the OpenBSD FAQ on character sets revealed that the errors were caused because of the way OpenBSD handles UTF-8 character sets. To prevent the errors occuring I inserted the LC_CTYPE variable into .profile for both root and octopressuser:

export LC_CTYPE=“en_US.ISO8859-1”

Log in as root

Log in as root to perform the next steps. Remember to set up the PKG_PATH and the LC_CTYPE variables as described above.


I installed Bash as the default shell for both root and the user with the following commands:

# pkg_add -i -v bash  
# chsh -s /usr/local/bin/bash  
# chsh -s /usr/local/bin/bash octopressuser  

Git, etc.

Octopress is downloaded from the Github repository so Git needs to be installed. Installing Git also installs Rsync. One of the clues I found via Google implied that installing Wget, Autoconf and Automake would also be a good idea. So I ran:

# add_pkg -i -v git wget autoconf automake  

The -i and -v attributes to add_pkg make command interactive and verbose. In this instance when prompted I installed git-1.7.6p4, rsync-3.0.9 (rather than rsync-3.0.9-iconv), autoconf-2.69 and automake-1.9.6p10.

Another clue I found via Google implied that I should also install Patch, Gcc, Readline, Libxml2, Libxslt, Diffutils, Make, Libtool and Bison. (Unfortunately I’ve lost the original clue so here is a similar clue.) So I ran:

# pkg_add -i -v patch gcc readline libxml libxslt diffutils make libtool bison  

(However Patch, Diffutils and Make were not found and did not install. But the Octopress installation seemed to progress okay without them…)


Octopress requires Ruby v1.9.3 so using this clue and this clue I ran the following command:

# pkg_add -i -v ruby-  

And set the appropriate links with:

# sudo ln -sf /usr/local/bin/ruby19 /usr/local/bin/ruby  
# sudo ln -sf /usr/local/bin/erb19 /usr/local/bin/erb  
# sudo ln -sf /usr/local/bin/irb19 /usr/local/bin/irb  
# sudo ln -sf /usr/local/bin/rdoc19 /usr/local/bin/rdoc  
# sudo ln -sf /usr/local/bin/ri19 /usr/local/bin/ri  
# sudo ln -sf /usr/local/bin/rake19 /usr/local/bin/rake  
# sudo ln -sf /usr/local/bin/testrb19 /usr/local/bin/testrb  
# sudo ln -sf /usr/local/bin/gem19 /usr/local/bin/gem  


To simply installation when logged in as octopressuser later in the process, I added octopressuser to the sudoers file using:

# visudo  

And inserted:

octopressuser ALL=(ALL) SETENV: ALL

Installing, Configuring and Using Octopress In The Octopress User’s Account

Octopress uses a directory structure within a user’s account to hold the website source files and the generated website content that will be deployed to the web server. So for the final stages of setting up Octopress you log out of the root account and log into the octopressuser account. The process below is based on the steps described on the Octopress web site for installing under OS X.

Log In As octopressuser

Log in as octopressuser to perform the next steps. Remember to set up the PKG_PATH and the LC_CTYPE variables as described above.

Get Octopress From The Github Repositories

Download Octopress from Github into the directory of your choice. In this example I have used a directory called blog:

$ cd ~  
$ git clone git:// blog  

Set Up The Octopress Directory Structure

Enter the blog directory and install the Gem bundles. Due to my lack of experience with OpenBSD and setting permissions, I forced the command to work by using Sudo:

$ cd ~/blog  
$ sudo gem install bundler  

Then to get the Bundle command to run I had to include its full path:

$ sudo /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.2.4/bin/bundle install  
$ rake install  

Setting Up The User Environment

For this example I have choosen to deploy the Octopress generated content to the web server using Rsync. For Octopress to be able to deploy the content, SSH key-based passwordless login must be set up. As this site is hosted by Dreamhost I followed their instructions for creating and deploying the SSH public key. Create the SSH keys as follows:

$ cd ~  
$ ssh-keygen -t rsa  

Copy the public key to your web server. In this example the web site is called and the user user administers the web site:

$ scp ~/.ssh/  
$ ssh  

Then on the web server as user, assuming it’s a Linux distribution:

$ mkdir .ssh
$ cat >> .ssh/authorized_keys
$ rm
$ chmod go-w ~
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/authorized_keys $ logout

Configure Octopress Deployment

Now back on the OpenBSD system, Octopress is configured to deploy to the web server using Rsync. Edit the Rakefile file in the blog directory:

$ cd ~/blog  
$ vi Rakefile  

For example, set the following parameters:

ssh_user = “”
ssh_port = “22”
document_root = “~/“
rsync_delete = true
rsync_args = “” # Any extra arguments to pass to rsync
deploy_default = “rsync”

Configure The Octopress Blog

Now the blog needs to be configured by setting the parameters in the _config.yml file:

$ cd ~/blog  
$ vi _config.yml  

For example, set the following parameters:

title: My Octopress Blog
subtitle: A blogging framework for hackers.
author: Your Name
description: A blog to demonstrate the installation and use of Octopress.

Creating A Blog Post

To create a blog post and edit that post, do the following:

$ cd ~/blog  
$ rake new_post[“An Post From OpenBSD”]  

The post file will be in the ~/blog/source/_posts/ directory preappended with the date you created the file. For example, to edit the file:

$ vi ~/blog/source/_posts/2013-02-14-a-post-from-openbsd.markdown  

Deploying A Blog Post

If you are happy with your Markdown skills you can now deploy the post you have created:

$ cd ~/blog  
$ rake generate  
$ rake deploy  

Previewing A Blog Post

Octopress does allow you to preview blog posts before you deploy them. So to do that on the OpenBSD system I installed Firefox and launched X Windows:

$ sudo pkg_add -i -v firefox  
$ startx  

Once X Windows was running I ran the following commands in the X Terminal:

$ firefox &  
$ cd ~/blog  
$ rake generate  
$ rake preview  

I then used Firefox to view the URL http://localhost:4000


Getting the OpenBSD 5.2 ISO
The OpenBSD Packages And Ports System
OpenBSD Character Sets
Installing Bash Under Open BSD
Installing Ruby 1.9.3
How To Install RVM Ruby FreeBSD
Installing Chef Client On OpenBSD
Building Ruby On OpenBSD From Source
Dreamhost SSH
Deploying Octopress With Rsync
Configuring Octopress
Blogging Basics With Octopress