Rob Hunter

How to Install Octopress on Debian

This guide covers the basics of installing Octopress on your Debian system. Why is it necessary, you ask? Well, the default documentation at octopress.org is good, but it’s OS-agnostic. Some choices suggested by the documentation (rvm over rbenv, building various Ruby tools from source retrieved through github) don’t seem to me to be appropriate to Debian. In particular, the Debian repositories contain precompiled binaries for rbenv and ruby-build – so why not let your package manager take care of the installation and handle dependencies for you?

First, install the dependencies for working with git and Ruby. It’s likely that you’ll have some of these installed already.

$ sudo aptitude install build-essential git rbenv ruby-build

Next, initialize rbenv:

$ rbenv init
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc

Restart your shell:

$ source ~/.bashrc

The ruby-build package provides an install command for use with rbenv, which you can now use to install the appropriate version of Ruby:

$ rbenv install 1.9.2-p290

This will take a while. Seriously. Go out and grab a coffee, or learn some irregular verbs in another language. You’ll have time. Once rbenv reports that Ruby has been installed, issue the following command:

$ rbenv rehash

Now, you’re ready to install Octopress. Clone the Octopress Github repository into whatever folder you please, e.g.:

$ mkdir -p ~/Projects/Octopress
$ git clone git://github.com/imathis/octopress.git ~/Projects/Octopress

Now, verify that the appropriate version of Ruby is specified for your Octopress directory.

$ cd ~/Projects/Octopress
$ ruby -v

If the ruby -v command doesn’t report that you’re using Ruby 1.9.2*, then make sure you’ve entered all the previous commands correctly.

At this point you can follow the directions as they’re specified at octopress.org:

$ gem install bundler
$ rbenv rehash
$ bundle install
$ rake install

You can now deploy Octopress and start blogging! I prefer to deploy through Rsync, but note that this requires using SSH (as well as a webhost that permits the use of SSH). If you’re unfamiliar with the basics of SSH, there’s a good guide on generating key pairs here. For hosting I use NearlyFreeSpeech, which offers SSH access (although you have to submit a support request for SSH to be enabled for your account).

Once you have your deployment set up, you’re ready to edit and publish blog posts. Note that Octopress posts are written using the Markdown syntax.