Install Ruby on rails on Ubuntu

Run the update


sudo apt-get update
 
Install the development packages 

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

Install Ruby Version Manager (RVM) 

curl -L get.rvm.io | bash -s stable --rails
 
 
root@mayank-VirtualBox:~# curl -L get.rvm.io | bash -s stable --rails
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   185  100   185    0     0    115      0  0:00:01  0:00:01 --:--:--   237
100  8545  100  8545    0     0   1980      0  0:00:04  0:00:04 --:--:--  5376
Please read and follow further instructions.
Press ENTER to continue.
Downloading RVM from wayneeseguin branch stable
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   125  100   125    0     0     45      0  0:00:02  0:00:02 --:--:--    78
100  992k  100  992k    0     0  91208      0  0:00:11  0:00:11 --:--:--  224k

Installing RVM to /usr/local/rvm/
    Creating RVM system user group 'rvm'

# RVM:  Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm/
# Screencast: http://screencasts.org/episodes/how-to-use-rvm

# In case of any issues read output of 'rvm requirements' and/or 'rvm notes'

Installation of RVM in /usr/local/rvm/ is almost complete:

  * First you need to add all users that will be using rvm to 'rvm' group,
    and logout - login again, anyone using rvm will be operating with `umask g+w`.

  * To start using RVM you need to run `source /etc/profile.d/rvm.sh`
    in all your open shell windows, in rare cases you need to reopen all shell windows.

# mayank,
#
#   Thank you for using RVM!
#   I sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne


rvm 1.12.3 (stable) by Wayne E. Seguin , Michal Papis  [https://rvm.io/]

Fetching yaml-0.1.4.tar.gz to /usr/local/rvm/archives
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  460k  100  460k    0     0  74408      0  0:00:06  0:00:06 --:--:--  108k
Extracting yaml-0.1.4.tar.gz to /usr/local/rvm/src
Configuring yaml in /usr/local/rvm/src/yaml-0.1.4.
Compiling yaml in /usr/local/rvm/src/yaml-0.1.4.
Installing yaml to /usr/local/rvm/usr
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...

ruby-1.9.3-p125 - #fetching 
ruby-1.9.3-p125 - #downloading ruby-1.9.3-p125, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speedruby-1.9.3-p125 - #extracting ruby-1.9.3-p125 to /usr/local/rvm/src/ruby-1.9.3-p125
ruby-1.9.3-p125 - #extracted to /usr/local/rvm/src/ruby-1.9.3-p125
ruby-1.9.3-p125 - #configuring 
ruby-1.9.3-p125 - #compiling 
 
 
Reload your shell environment: 
 
$ source ~/.bash_profile 
 
Find the requirements (follow the instructions): 
 
$ rvm requirements 
 
Install ruby: 
 
$ rvm install 1.9.3
         
apt-get install ruby-rvm

gem install rails