1. Download ruby 1.9.1-p376 from Ruby site.
This is a patch level release of Ruby 1.9.1. Ruby 1.9.1-p243 has a security vulnerability that allows heap overflow.
Other fixes :

In addition, 1.9.1-p376 includes > 100 bug fixes.
  • Irb extension commands had been broken. It was fixed.
  • Ripper had not been able to parse some Ruby codes. It was fixed.
  • Fixed build failures on AIX.
  • Some bug fixes of Matrix.
  • Can load gems which is installed in an user’s home directory.
  • Some method became returning a string with a correct encoding.

Refer this for more updates.

Download ruby-1.9.1-p376.tar using this Direct download link.
2. Now make sure you have all the necessary dependencies installed.To check this type:

dpkg -l

3. This will show a list of installed packages. look for zlib1g and zlib1g-dev. If these packages are installed then OK, otherwise install these packages :
 sudo aptitude install zlib1g
 sudo aptotude install zlib1g-dev
4. Now create a src directory under /opt, ofcourse i could install in /usr/local. But installing in /opt will be benificial if in future i want to install another version (suppose ruby 1.8) side by side, in this case only changes in some symbolic links will be enough. So i created a src directory and changed group and premissions.
 sudo mkdir -p /opt/src
 sudo chgrp -R 'username' /opt/src
 sudo chmod 775 /opt/src
5. Move to /opt/src :
 cd /opt/src
6. Now copy the downloaded ruby 1.9.1-p376.tar.gz here and untar this:
tar xzvf ruby 1.9.1-p376.tar.gz
7. Go inside ruby 1.9.1-p376
cd ruby 1.9.1-p376
8. Now configure with options to make sure that things go in the correct directory, and with the correct suffix after the program name so that i can allow for different versions of Ruby if i want, in future.
 ./configure --prefix=/opt/ruby1.9 --program-suffix=1.9
9.  make and install:
 sudo make
 sudo make install
10. Finally create some symbolic links so that all terminals can look the installed ruby:
 sudo ln -sf /opt/ruby1.9/bin/ruby1.9 /usr/local/bin/ruby
 sudo ln -sf /opt/ruby1.9/bin/erb1.9 /usr/local/bin/erb
 sudo ln -sf /opt/ruby1.9/bin/irb1.9 /usr/local/bin/irb
 sudo ln -sf /opt/ruby1.9/bin/rdoc1.9 /usr/local/bin/rdoc
 sudo ln -sf /opt/ruby1.9/bin/ri1.9 /usr/local/bin/ri
 sudo ln -sf /opt/ruby1.9/bin/testrb1.9 /usr/local/bin/testrb
 sudo ln -sf /opt/ruby1.9/bin/gem1.9 /usr/local/bin/gem
11. Now check
ruby location
 which ruby
output should be:  /usr/local/bin/ruby.
Ruby Version:
 ruby -v
output should be:  ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]

12. Now to update gems:
 sudo gem update --system
Now if i do :
 gem list
output is:
*** LOCAL GEMS ***

13. Next step is to install rails:
 sudo gem install rails --include-dependencies
14. Again i will create the symbolic links for rails, rackup and rake, so that Ruby and it’s supporting apps point to the correct location:
 sudo ln -sf /opt/ruby1.9/bin/rackup /usr/local/bin/rackup
 sudo ln -sf /opt/ruby1.9/bin/rails /usr/local/bin/rails
 sudo ln -sf /opt/ruby1.9/bin/rake /usr/local/bin/rake
All’s done now.
New Rails application can be created by using:
 rails TestApp


Share This Post:

Add to FacebookAdd to DiggAdd to Del.icio.usAdd to StumbleuponAdd to RedditAdd to BlinklistAdd to TwitterAdd to TechnoratiAdd to Yahoo BuzzAdd to Newsvine

- Abhishek Singh


I'm supporting RubyConf India 2010