Installing Ruby on Rails to the Raspberry Pi

After turning my Raspberry Pi into a web server, I quickly learned, that the RPi is not powerful enough for any serious web serving. In fact my version 1 board was struggling with serving a minimal Drupal8 installation, I had a bit better results with some hand crafted PHP scripts, but still the 256 MB seemed like a bottleneck. I also noticed, that performance is held back by my storage. I used a Class 4 SD card as the main storage, then moved to a Class 10 (rated at 30MB/s) and was shocked by how much faster everything worked.

So I decided to abandon PHP, and try runinng Ruby on Rails on the board, because I had really good results running Ruby on my Ubuntu box.

Create your SD card

Follow the instructions on on how to prepare your SD card to boot Rasbian Wheezy. This is important, because the RPi won’t do a thing without a properly configured SD card. The Pi is not like your average PC, that will partially boot to CMOS, even without a hard drive, so don’t you skip this step.


Prepare for install

First of all,log in to your Pi either phisically or through SSH. Now let’s make sure, no previous version of ruby is installed on our Raspberry Pi, by running the following command:
sudo apt-get remove ruby-rvm --purge

Do a quick update:
sudo apt-get update

Install curl
sudo apt-get install curl

Install Ruby with RVM

RVM stands for Ruby Version Manager, and it does what it think it does. I’m a big fan of RVM, because it lets me keep several versions of Ruby on the same box to test gems. Here’s the command you need to issue to download RVM:
curl -L | bash -s stable --ruby

This portion will take some time, especially if you’re using a Class 4 SD card, becazse the low writing speed slows down the download and install process.

Install Rails

Create a gemset and let RVM know that you want to use it.

rvm current
rvm use 1.9.3
rvm gemset create firstgemset
rvm gemset use firstgemset

And last but not least install Rails:
gem install rails

And that’s it, you should have a working Ruby on Rails server, powered by a 5v micro usb charger. How cool is that?!


  1. Pingback: Ruby on Rails | Tomas Freeman

  2. Kapurnicus

    Process takes about 3 hours on a Raspberry Pi (has to compile ruby), but the instructions work still for Ruby 2.1.0 (obviously amend the “rvm use 1.9.3″ command to whatever version you would like to use (or ignore it since you installed the latest stable version). If you don’t restart your pi (“sudo shutdown -r now”) between installing rvm/ruby and the install rails section of the guide you will need to type “source /home/username/.rvm/scripts/rvm” before any command beginning with “rvm” will be recognized.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>