Tuesday, August 9, 2011

Simplest method to install latest Ruby on Rails(RoR) 3.x on Ubuntu(10.10)

Hi,

This is the post about installing latest RoR on Ubuntu10.10 using RVM(ruby version manager). Installing RoR using a RVM is the simplest method of all the methods because it has many advantages like you can control version while testing and it automatically resolves all the dependencies. Also plenty of help is available for using rvm.

At the end of article i have given all the commands you can copy paste into file and run it as a bash script it will do all the jobs for you.

 Follow the following steps,
install rvm using

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

A>This  installs all the dependencies and the libraries

  # Dependencies for compiling Ruby
  $ sudo apt-get install curl bison build-essential autoconf zlib1g-dev libssl-dev libxml2-dev libreadline6-dev git-core subversion

  # openssl package for RVM
  $ rvm pkg install openssl

  # readline package for RVM
  $ rvm pkg install readline


B>this installs ruby , U can give version as 1.9.2 although

$rvm install 1.9.2-head -C --with-openssl-dir=$rvm_path/usr,--with-readline-dir=$rvm_path/usr

C>Test it  and use 1.9.2 as default version
 
$ rvm list
  =>
  rvm Rubies
  ruby-1.9.2-head [ x86_64 ]
  System Ruby
  system [ ]

  $ ruby -v
  => ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]

  $ rvm use --default 1.9.2
  => Using ruby 1.9.2 head

  $ ruby -v
  => ruby 1.9.2dev (2010-04-17 trunk 27376) [x86_64-linux]


4> Install sqlite(database and rails)
$sudo aptitude install libsqlite3-0 libsqlite3-dev  

$ gem install sqlite3-ruby
  $ gem install rails --pre
For detailed info you can visit this blog: http://rohitarondekar.com/articles/installing-rails3-beta3-on-ubuntu-using-rvm

Rohit has given nice explanation, And above instructions are taken from his blog.
Just remember that in rvm package has been replaced by pkg.


#This is the script to install the ruby1.9.2, rubygems1.8.6, rubyOnRails3.x
#author : rhaulpatil

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

# Dependencies for compiling Ruby
sudo apt-get install curl bison build-essential autoconf zlib1g-dev libssl-dev libxml2-dev libreadline6-dev git-core subversion

# openssl package for RVM
rvm pkg install openssl

# readline package for RVM
rvm pkg install readline

#this installs ruby , U can give version as 1.9.2 although
rvm install 1.9.2 -C --with-openssl-dir=$rvm_path/usr,--with-readline-dir=$rvm_path/usr

#list installed ruby packages
rvm list

#ruby version using
ruby -v

#use this version as default
rvm use --default 1.9.2
 
ruby -v 
 
# this installs develoment lib for sqlite otherwise of which gem install sqlite3-ruby will fail
sudo aptitude install libsqlite3-0 libsqlite3-dev  
 
#install sqlite-3 as a basic database
gem install sqlite3-ruby

#install the rails 3.x latest
gem install rails --pre