Rails 3.0 requires at least Ruby 1.8.7. Support for all of the previous Ruby versions has been dropped officially. Rails 3.0 is also compatible with Ruby 1.9.2.

What is rvm?
RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems. More info about RVM

Install ruby 1.9.1 and Rails 3 using rvm in Ubuntu 9.10

To install rvm:

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

I guess git is required for this. You can check whether git is installed using “git –version”, if not:

sudo apt-get install git
sudo apt-get install git-core

After Installation :
put the following line into your profile(/home/.profile) at the very bottom.

if [[ -s "$HOME/.rvm/scripts/rvm" ]]  ; then source "$HOME/.rvm/scripts/rvm" ; fi

Then load the new code into your current shell and start using RVM

 source ~/.rvm/scripts/rvm

Be sure to install any dependencies for your operating system.

rvm notes

Now add the sourcing line at the end of your profiles (~/.bashrc or ~/.bash_profile):

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Then open a new shell and start using RVM!

 rvm install 1.9.1

(This will install ruby in .rvm folder. see /home/<usr_name>/.rvm/src and bin)

 ruby -v
 #ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]
which ruby
 #/home/<user_name>/.rvm/rubies/ruby-1.9.1-p378/bin/ruby

To switch back to your system’s ruby :

 rvm system
ruby -v
 #ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-linux]

which ruby
#/usr/bin/ruby

Commands::
To setup rvm, ruby1.9.1 and Rails3 with current version of ruby & rails:

ruby -v

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

OR
mkdir -p ~/.rvm/src/ && cd ~/.rvm/src && rm -rf ./rvm/ && git clone git://github.com/wayneeseguin/rvm.git && cd rvm && ./install

rvm install 1.9.1
rvm list
rvm 1.9.1
rvm 1.9.1 --default
rvm system
gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n
gem install rails --pre
rails new blog
cd demo
gem install sqlite3-ruby
rails server
visit :: http://localhost:3000
rails generate scaffold post name:string
rake db:migrate

visit :: http://localhost:3000/posts

See list of ruby versions installed using RVM:

rvm list

#rvm rubies

=> ruby-1.9.1-p378 [ i386 ]

Add to: Facebook | Digg | Del.icio.us | Stumbleupon | Reddit | Blinklist | Twitter | Technorati | Yahoo Buzz | Newsvine

- Abhishek Singh

Advertisement