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 elinux.org 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
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 https://get.rvm.io | 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.
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?!