RVM – Easy installation of ‘ruby on rails’ on ubuntu

Ruby Version Manager (RVM) resolves versions conflicts when multiple versions of ruby is installed on the same system. It also enables quick and easy installation of ruby on rails on ubuntu. This article provides solution to the problems faced during the installation of ruby on rails on ubuntu using RVM.

Installation of RVM:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
source ~/.rvm/scripts/rvm
rvm reload

Install Ruby 1.9.2 with rvm:

rvm package install zlib
rvm install 1.9.2 -C --with-zlib-dir=$rvm_path/usr
rvm install 1.8.7-p174 -C –with-zlib-dir=$rvm_path/usr

To resolve version conflict, create separate gemsets for each of the two different versions:

rvm --create 1.8.7-p174@rails2tutorial
rvm --create use 1.9.2@rails3tutorial

To use Ruby 1.9.2 by default and Rails 3.0 give the below command:

rvm --default use 1.9.2@rails3tutorial

Install Rails:

gem install --no-ri --no-rdoc --version=3.0.1 rails

Confirm installation with the below command. This command will display the version of rails installed on the system.

rails -v

Install RubyGems:
Installation of rvm automatically installs RubyGems
Give the below command to confirm this. This command would display the path in which the gem has been installed.

which gem

Update the system to the latest version with the below command:

gem update –system