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.