How to install Rails 3.0 and Ruby 1.9.2 on Ubuntu

If you are running an older version of ubuntu the guide below might still apply, but since the release of Ubuntu 12.04 this install has become a much simpler process. So simple in fact that you can basically do a 'gem install rails --version=3.1'. But since I'm big into automation I've also written a script that will produce a working Ubuntu development machine from a fresh install of Ubuntu 12.04. If you run the script you will have a fully functional ruby / python / node development machine.

When ruby on rails 1.0 was released back in 2005 it was all the rage. And being someone who was often distracted by the next great web framework I decided to have a look. So in early 2006 I built a small application to see what all the hype was about. I immediately saw the value of a strongly opinionated framework, something the average asp.net developer like myself didn't know much about at the time.

Fast-forward to August 29th 2010 - Rails 3.0 was released. Just prior to this release I started looking at the web framework again and because I always strive for the optimal developer experience it meant I would need to quit my windows addiction. Not that you can't do ruby development on windows, but most of the time it's not worth the pain.

With that said, I paved my development machine and installed Ubuntu 10.04. But as I started looking around for a 'how-to' of sorts on installing rails 3 with ruby 1.9.2 I couldn't find a simple guide that got me up and running error free. Each time I started with a vanilla install of Ubuntu and ended up with what felt like a 'hacked together' development environment. But last night I decided to give it another try and document the steps needed for someone like me coming in with minimal linux experience.

Install RVM 1.0.1

First be sure to do a quick update before you get started.

sudo apt-get update

Next install curl and git so we can pull down ruby via rvm

sudo apt-get install curl git-core

Next you need to get the tar.gz for rvm 1.0.1

http://rvm.beginrescueend.com/releases/rvm-1.0.1.tar.gz

extract the contents and cd into the extracted directory when finished

tar xvzf rvm-1.0.1.tar.gz

Once inside the extracted directory run the installer from the command line

./install

After this is complete you need to edit your .bashrc file. First cd ~ and then Type 'gedit .bashrc'. Put the following at the bottom of the file.

[[ -s '$HOME/.rvm/scripts/rvm' ]] && source '$HOME/.rvm/scripts/rvm'

after you complete the above and save your changes, close gedit. Next close your terminal window and re-open it. Now if you type 'rvm -v' you should see a valid version 1.x