How to install Rails 2.1 on Ubuntu in 5 steps

I thought it would be a good idea to start with actually installation of rails 2.1, as many latest linux distributions don’t come with the latest version of rails which includes Ubuntu 8.04. So in this how to we will cover installation of rails 2.1 on Ubuntu 8.04.

NOTE: This howto is not for you if you want to be keep your system with ubuntu repository. This howto will use gem to install rails and hence will not use the rails version available in ubuntu repository.

This is not actually a Rails 2.1 development tutorial, but it is related to it and hence has been made part of Rails 2.1 tutorials. Once again I would like to clarify that I am not advocating Ubuntu here nor I am saying that you should use Ubuntu for your rails development but that is what I prefer to use for my development and personal use.

NOTE: If you are developing on windows or using any other distribution of Linux then you can still ask in comments if you face any problems and I will try to help you out.

Lets start installing Rails 2.1 on our Ubuntu system. We know that apt-get is our friend which takes care of all the dependencies, fetching them and installing them.

Step 1: First step is to install ruby and other required software packages.

sudo apt-get install ruby rdoc irb ruby1.8-dev rubygems libopenssl-ruby
Step 2: We have installed RubyGems in “Step 1”, now we need to update gem to the latest available version and for this we will use below command:

sudo gem update --system

You will see a lot of messages on the screen, if you have few minutes you can read them but the last 4-5 lines will be a message that you have successfully updated your gem installation.


RubyGems installed the following executables:

If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.

RubyGems system software updated

Step 3: Now we have two versions of RubyGem on our system one is installed via package manager in Step 1 and the other is via “gem update” in Step 2. Now we will remove the version that was intstalled in Step 1 and will keep the latest version from Step 2.

sudo apt-get remove rubygems
Step 4: Now the gem command is removed so we need to create symbolic link to the latest version of gem manager.

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
Step 5: Now to install rails 2.1 on our system simply use the gem manage to install the rails gem.

sudo gem install rails

You should see the similar output like following:

Successfully installed rake-0.8.1
Successfully installed activesupport-2.1.0
Successfully installed activerecord-2.1.0
Successfully installed actionpack-2.1.0
Successfully installed actionmailer-2.1.0
Successfully installed activeresource-2.1.0
Successfully installed rails-2.1.0
7 gems installed
Installing ri documentation for rake-0.8.1…
Installing ri documentation for activesupport-2.1.0…
Installing ri documentation for activerecord-2.1.0…
Installing ri documentation for actionpack-2.1.0…
Installing ri documentation for actionmailer-2.1.0…
Installing ri documentation for activeresource-2.1.0…
Installing RDoc documentation for rake-0.8.1…
Installing RDoc documentation for activesupport-2.1.0…
Installing RDoc documentation for activerecord-2.1.0…
Installing RDoc documentation for actionpack-2.1.0…
Installing RDoc documentation for actionmailer-2.1.0…
Installing RDoc documentation for activeresource-2.1.0…


If you have successfully followed till here then you have installed the latest available version of rails i.e rails 2.1 on your system. Yay!!! now get your self ready for actual fun.

add to :: Add to Blinkslist :: add to furl :: Digg it :: add to ma.gnolia :: Stumble It! :: add to simpy :: seed the vine :: reddit :: fark :: TailRank :: post to facebook

Published by

Hameedullah Khan

VR enthusiast, Cloud Architect, Passionate Programmer and Opensource advocate.

9 thoughts on “How to install Rails 2.1 on Ubuntu in 5 steps”

  1. Step 2 broke on Ubuntu 8.04.1…

    $ sudo gem update –system
    /usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)


  2. @Darren

    2 suggestions for you.

    1. Type the commands by hand as wordpress converts some characters to html entities and they might look like normal characters but they are actually not, so its better to type commands by hand.

    2. run “sudo gem cleanup” before step 2.

    I hope the above will solve your problem. Let me know.


  3. %w(irb ri rdoc ruby gem rake).each { |p| system “update-alternatives –install /usr/bin/#{p} #{p} /usr/bin/#{p}1.8 10” }

    You really should be taking advantage of the alternatives system so you get the latest versions when you run “ruby” rather than having to specify “ruby1.8”


  4. step 1 didnot work.
    executed install one at a time seemed OK.

    step 4 computer complained that it could not find gems
    went back and installed rubygems from step-1.


  5. Very nice tutorial on how to install Rails in Ubuntu. This is really helpful since there are really lot of people who are getting into Rails. I would like to recommend the Ruby On Rails Scheduling that can help you in managing, queuing and scheduling your jobs in Rails.


Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge