Friday, August 19, 2011

Install Rails in Ubuntu with RVM

Before installing rvm first of all you need to install a latest version of git in your system.
Run this command in the terminal
sudo aptitude build-dep git-core
Then run the command 
bash < <(curl -s
to install rvm in your machine.
Now run the command
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" 
# Load RVM function' >> ~/.bash_profile

To load RVM into your shell sessions as a function.

Now reload the bash with

source .bash_profile
If installation and configuration were successful, RVM should now load whenever you open a new shell. This can be tested by executing the following command which should output 'rvm is a function' as shown below.  
type rvm | head -1

 Now install ruby with rvm with this comand
rvm install 1.9.2-p290
where 1.9.2-p290 is ruby version that we want to install.

now make ruby 1.9.2 your default ruby for the system with this command
rvm use 1.9.2 --default
Now install rails with 
gem install rails --no-ri --no-rdoc
if you get the following error

ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

then you must install zlib package. Use the following commands if above error shows up

$ rvm pkg install zlib
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr

here --no-ri --no-rdoc  will not install ri and rdoc documentation.

No comments:

Post a Comment