Pages

Sponsorship

Aug 18, 2009

How to Install Ruby on Rails on Ubuntu 9.04 (Jaunty Jackalope)

Few of my friends have started to learn Ruby on Rails recently. According to my point of view, Windows is not a suitable and enjoyable environment for RoR development. So, I recommended them to start with Ubuntu. Most of them have installed Ubuntu 8.10 and 9.04. So, I wish to write a small guide to setup the Ruby on Rails environment on Ubuntu 8.10 and 9.04.

Ruby installation

First we need to update the repositories.

sudo apt-get update

It’s always a best practice to upgrade the system.

sudo apt-get dist-upgrade

This installation will take few minutes and also require approximately 100 MB disk space.

Now that we are up to date. Let’s start install the RoR recipices. We need following Rails prerequisites.

ruby - An interpreter of object-oriented scripting language Ruby

ri - Ruby Interactive reference

rdoc - Generate documentation from ruby source files

irb - Interactive Ruby

sudo apt-get install ruby ri rdoc irb libopenssl-ruby ruby-dev

Ruby Gem installation

Next we need to install the Ruby gem package manager. You can download the latest Ruby gems by following link.

Download and extract the files. (By the time I’m writing this tutorial the latest version is 1.3.5)

tar xvzf rubygems-1.3.5.tgzcd rubygems-1.3.5sudo ruby setup.rb

Once it’s done you can delete the .tgz file and rubygems directory.

cd ..rm -r rubygems-1.3.5 rubygems-1.3.5.tgz

Next we need to create a set of simlinks. Otherwise it will be a tedious task to type commands with the version (1.8). For an example if we need to call the gem command we’ve to type gem1.8. I don’t prefer that. Hope you too. So, let’s create the necessary simlinks.

Rails by default comes with the WEBrick server. But most Rails developers prefer the Mongrel server. If you satisfied with WEBrick you can skip this step, else type the following command to install Mongrel server.

sudo gem install mongrel

Database Installation

Rails 2.3 shipped with SQLite3 as it’s default database instead of MySQL. You can install SQLite3 libraries by following commands.