I’ve journeyed into the world of Ruby and Rails and decided that it would be fun to develop on Ubuntu. I’m your typical Windows user during the day, and although Rails can be installed on Windows, I’ve read many blog posts that end in frustration for those that do. So, to avoid all the frustration (and to have fun with Ubuntu!), I have created an Ubuntu VM using VirtualBox to run on my Windows 7 laptop. Getting Ubuntu set up in VirtualBox was fairly painless, so I won’t cover those installation steps here, but rather those that I found quite handy when configuring Ubuntu to work with Rails. Here we go!
Install git-you will need this along the way, so it’s easiest to install right off the bat.
After git has completed installation:
Install Ruby Version Manager (RVM)-RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems. Using RVM will allow us to ensure that our apps work with the different versions of ruby and quickly expose areas in which they don’t.
Install the necessary tools. From the terminal:
sudo apt-get curl
Install RVM from the github repository:
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Add this line to the end of your .bashrc. It loads RVM into a shell session.:
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi
Close your terminal and open a new one. Run the following to test whether RVM installed correctly. It will also list the various dependencies for each ruby:
Install Ruby 1.9.2 using RVM (will take several minutes):
rvm install 1.9.2
Set Ruby 1.9.2 as the default version:
rvm –default ruby-1.9.2
Test the ruby install:
And finally, install Rails 3 (which also takes a while):
sudo gem install rails
Develop for the better!