“Ruby On Rails environment on Ubuntu 10.04”

rails, Uncategorized

I think this is my first technical post in the blog, so today I faced some problems while building the Ruby on Rails environment on my machine. I just like sharing this knowledge with you.

First, in this post we will make the following:

1. Ruby 1.9.1

2. Rails 2.3.5

3. Thin server.

4. MySQL server.

1. Ruby 1.9.1

The following commands mainly download the Ruby source code and compile it and so on

Just you have to install the following libraries:

sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev

move to /usr/local/src to download source code and compile it in this folder
cd /usr/local/src

Download the source code, and unpack it

sudo wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz
sudo tar xzf ruby-1.9.1-p0.tar.gz
cd ruby-1.9.1-p0

Now, you have to check the version of gcc if it is 4.4 some errors will occur

dpkg -l | grep gcc

if gcc 4.4 found then you have to edit the cont.c file to go on. Open it up, and change the lines 90, 270 and 317 from #elif to #else.

sudo gedit cont.c

then write the following commands in terminal

sudo ./configure –prefix=/usr/local/ruby-1.9.1
sudo make
sudo make install

After these steps you have finally installed Ruby 1.9.1, to check its version

cd /usr/local/ruby-1.9.1/bin
ruby -v
output like that: ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]

Now, the ruby commands such as ruby, rake, irb, … etc are accessed only from /usr/local/ruby-1.9.1/bin, and all the commands are found in /usr/local/bin so just make link for the commands in ruby-1.9.1/bin and put them in /usr/local/bin

sudo ln -s /usr/local/ruby-1.9.1/bin/ruby /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/rake /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/gem /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/irb /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/ri /usr/local/bin
sudo ln -s /usr/local/ruby-1.9.1/bin/rdoc /usr/local/bin

2. Rails 2.3.5

Now, Ruby 1.9.1 is installed successfully on your machine, just add this command to terminal to install the Rails 2.3.5 gem

sudo gem install rails -v=2.3.5

3. Thin server

Also to install Thin application server gem

sudo gem install thin

4. MySQL server

Finally to install MySQL server for DB

sudo apt-get install mysql-server
and while installing it is required to set the root password

References: http://www.bunchedin.com/8Bolx6

Hope that it is some how useful for you


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s