Rails 3/Installing Ruby and Rails

Installing on Ubuntu Linux
In this section we will see how to install Ruby on Rails on Ubuntu GNU Linux distro. At the point of writing this piece of text we have Ubuntu 10.10. We will see how to install Rails 3.x.x in it.

The first step is to launch your terminal by going to Applications -> Accessories -> Terminal.

First, we will install tools that will compile Ruby source code; to do so in your terminal type the following:

Next, we will download the Ruby source code using wget; to do so type the following in terminal:

The above command will download Ruby 1.9.2 source code. The downloaded file is in tar.gz format, it must be unzipped; to do so type the following:

Next, we will compile and install Ruby using the following commands (type the commands one by one):

Next, we need to tell our operating system that Ruby is installed in /usr/bun/ruby ; to do so we need to add the path to /etc/environments file. To do so, type the following

The file opens and you might see something like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

To the path string add :/usr/local/ruby/bin, it must at last look something like this:

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"

Now, we run the source command for the file /etc/environment to apply changes.

Now check if everything is OK by typing the following:

If everything is done correctly, the output will look something like this:

ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]

Now we will create symbolic link to ruby and gem using the following commands:

Now we will install rails with gem using the following commands (type them one by one in terminal):

To check type rails -v, you must get output like something shown below:

When I installed Rails 3.0.3 was the stable version of Rails hence it got installed. Having installed our Rails web framework successfully lets create our first web application.