Today we’ll install the latest stable version of Ruby on an Ubuntu Linux machine, let’s begin…

Fire up Terminal and type the following to install RVM:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Once installed you’ll have to add the following to the end of your .bashrc file to make rvm accessible from the prompt:

vim ~/.bashrc

Scroll down to the bottom, hit I to switch to insert mode and paste the following into the file, then hit ESC to switch to select mode, then type :wq to write the changes and quit the file.

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Run this to refresh your terminal and pick up the changes:

source ~/.bashrc

Next install the pre-requisites for Ruby via:

sudo aptitude install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make build-essential libssl-dev libreadline6-dev zlib1g-dev

And install Ruby

rvm install 1.9.2 -C --with-readline-dir=/opt/local
rvm 1.9.2

Check it’s installed via:

ruby -v

And finally set it to default as:

rvm 1.9.2 --default

Job done.