I accept i didn't work in any versions as an expert.But had lot of interest to work in Ruby and Rails.So i decided to work with rail3.Already i am working some other projects with lower versions.So i decided to go with RVM.When i tried RVM some 9 months back faced some problems with rvm like rails will be working fine in one linux shell.Now RVM has improved a lot and installing and working are to simple.Thanks to RVM
Installing Rails3 is to ease with RVM.There are many ways of installing RVM in ubuntu as a user level or as a root level.But i recommend go with user level.
Steps to install RVM
∴ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
Once the script is done, you will notice .rvm folder will be getting created in your $HOME.Finally the script will display some welcome message along with a piece of line code.For making rvm to be workable in all your user linux shell, place the below mentioned code in your .bashrc. to load RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
For more info visit http://rvm.beginrescueend.com/rvm/install/
Restart your system
After installing RVM, you can install Ruby as follows:
$ rvm update --head
$ rvm reload
For installing ruby 1.9.2 as it is compatible for rails3 as per http://rubyonrails.org/download
$ rvm install 1.9.2 or rvm install ruby-1.9.2-p136
Now RVM will download, compile and install ruby 1.9.2 and then set it to current version.
RVM creates a new completely separate gem directory for each version of ruby. In addition you can separate this further and have a set of gems per project/application/gerbil color... see the gemsets for more details on using sets of gems.
While installing gems please don't use sudo,since you are running commands as root, another user in another shell and hence all of the setup that RVM has done for you is ignored while the command runs under sudo (such things as GEM_HOME, etc...). So to reiterate, as soon as you 'sudo' you are running as the root system user which will clear out your environment as well as any files it creates are not able to be modified by your user and will result in strange things happening.
In particular, Rails is distributed as a gem, and there are conflicts between Rails 2 and Rails 3, so if you want to run multiple versions of Rails on the same system you need to create a separate gemset for each
rvm --create use 1.9.2@rails3tutorial
In this tutorial, we want our system to use Ruby 1.9.2 and Rails 3.0 by default, which we can arrange as follows
rvm --default use 1.9.2@rails3tutorial
Installing rubygems can be done by downloading RubyGems, extract it, and then go to the rubygems directory and run the setup program.If we have installed RVM, we already have RubyGems, since RVM includes it automatically.
Finally we want to install rails3
gem install rails --version 3.0.1
Alternate Steps to install rails 3 versions (updated one)
Once assigned the default gemset, then install the bundler gem
gem install bundler
Specify your dependencies in a Gemfile in your project's root .
I faced a problem in installing, simply my terminal displays
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/user/.gem/specs
After surfing lot then i tried with simple unix command
chown -R username:username ./gem
Then gem install rails works fine and installed rails 3.