Whether you are using ubuntu 10.04 or 9.10, the ruby on rails installation should be the same. So in order to install ruby on rails in ubuntu, you need to have ruby ready first.

There are two choices for you to install ruby, either install ruby from repository or from source. To install ruby from repository, open terminal and type the following command:

$ sudo apt-get install ruby-full build-essential

In order to build ruby from source, you need to have the following pre-requisite packages:

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

Now you need to download ruby source with the following command:(note you may choose to install different ruby version with different download urls. Refer to the Source Code section of the ruby download page)

$ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz

Unzip the files:

tar xzf stable-snapshot.tar.gz

Compile and install ruby:

$ cd ruby/
$ ./configure
$ make
$ sudo make install

Now run ‘irb’, if you didn’t see any errors, congratulations, you have successfully installed ruby.

Before you install rails, you should have gem ready. Gem is a packaged Ruby application or library. You can use gem to install a lot of free and helpful packages including ‘rails’ framework. You may want to refer to the gem doc if you are interested.

Install gem with the following command:

$ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.2.tgz
$ tar xzvf rubygems-1.3.2.tgz
$ cd rubygems-1.3.2
$ sudo ruby setup.rb
$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Now with gem you can start installing rails:

$ sudo gem install rails

Do note that this will install the latest version of rails (2.3.5). If you intend to install the previous versions, use the following command:

$ sudo gem install --version = 2.2.2 rails

By default, ruby on rails support sqlite3 under development environment. However, in order to use that, you need to install sqlite and sqlite-ruby gem first.

$ sudo apt-get install sqlite3

Now, type sqlite3 command in terminal. If you didn’t see any error and is in the sqlite3 mode, you have successfully installed sqlite3. Type ‘.quit’ to exit.

Now it is time to install sqlite3-ruby gem. Try typing the following command in the terminal:

$ sudo gem install sqlite3-ruby

You should be able to see the following errors in your screen:

Building native extensions. This could take a while…
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install sqlite3-ruby
checking for fdatasync() in -lrt… yes
checking for sqlite3.h… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

This is quite annoying. However, no worries, nothing cannot be solved in this world. In order to install sqlite3 for ruby on rails. You need to have libsqlite3-dev package installed. Try the following command:

$ sudo apt-get install libsqlite3-dev
$ sudo gem install sqlite3-ruby

Now you may see a bunch of messages like the following. That’s normal. Don’t bother about that.

No definition for _wrap_sqlite3_result_text16

No definition for _wrap_sqlite3_result_text16le

No definition for _wrap_sqlite3_result_text16be

No definition for _wrap_sqlite3_result_value

No definition for _wrap_sqlite3_aggregate_context

Now you are ready to use your ruby on rails in ubuntu. Have fun with ruby on rails.

After I upgrade ubuntu from 9.04 to 10.04, my bottom panels was gone! Ok, previously I used the AWN dock (Avant Window Navigator) in ubuntu 9.04. While doing the upgrade, I think it treat this as a unuseful package and cleared it away. So now I don’t have any panel at the bottom. The only way for you to switch to previously opened window is to use ALT + TAB. The following are ways to restore your ubuntu taskbar panels to the default settings:
1. Open the terminal window.
If you are lucky and the top panel is still there, then you can click on Application->Accessories->Terminal to open the terminal window. If you are unlucky, don’t worry. You can press ALT + F2 to open the ‘Run Application’ Window. Scroll down to click on ‘Terminal’ or type in ‘gnome-terminal’.

By the way, the background of the picture is the new ubuntu 10.04. Pretty cool and clean.

2. In ther terminal window type the following command in sequence:
gconftool – -recursive-unset /apps/panel
rm -rf ~/.gconf/apps/panel
pkill gnome-panel

Ok, now you should be able to see your panel back. Alternatively, you could install AWN dock package.You might want to refer to the gconf configuration system page to understand the command.