How to install Rails 3.0 and Ruby 1.9.2 on Ubuntu

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

Now that you’re all set up, install RVM itself. This is done via a shell script which you can download and run directly with a single command.

$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

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

Install Ruby 1.8.7

First you need to pull down a few development packages

sudo apt-get install libruby1.8 zlib1g-dev libssl-dev 
libreadline5-dev build-essential

Next you need to install ruby 1.8.7 through rvm

rvm install ruby-1.8.7

After this is complete you need to set ruby 1.8.7 as the default for rvm

rvm use ruby-1.8.7 --default

Install rubygems and other dev essentials

first you need to add the ubuntu-on-rails ppa repository, sometimes they have newer versions of some Ruby components.

sudo add-apt-repository ppa:ubuntu-on-rails

After you add this be sure to do another update

sudo apt-get update

Next install the essential ruby packages

sudo apt-get install ruby rubygems irb ri rdoc rake

And a few more packages, odds are you will need them anyway

sudo apt-get install build-essential ruby1.8-dev libopenssl-ruby

After all the packages above are installed, add the gem path to your global PATH, so that executables new gems can be easily called from the command line.

export PATH=/var/lib/gems/1.8/bin:$PATH

After you run the above command, close the terminal window and re-open it.

Install MySql

Install the myslq development packages

sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev

Install the mysql gem

gem install mysql

Install Ruby 1.9.2

Next you need to install ruby 1.9.2 through rvm

rvm install ruby-1.9.2

After this is complete you need to set ruby 1.9.2 as the default for rvm.

rvm use ruby-1.9.2 --default

Install Rails 3.0.3

Now install rails but be sure you DON’T use sudo

gem install rails --version 3.0.3

After you have both rails 3 and ruby 1.9.2 up and running, install the mysql gem again.

gem install mysql

Now you should have a fully functional rails 3 + ruby 1.9.2 development environment! You can verify this by doing a simple "ruby -v" and "rails -v" from the command line.

http://toranbillups.com/blog/archive/2010/09/01/How-to-install-Rails-3.0-and-Ruby-1.9.2-on-Ubuntu

http://wiki.rubyonrails.org/getting-started/installation/linux