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
If you like to watch the screencast of this title, rather than reading whole post, you can find my screencast here.
http://mohamedaslam.com/screencast-how-to-install-ruby-on-rails-on-ubuntu/
Ruby installation
First we need to update the repositories.
It’s always a best practice to upgrade the system.
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
Ruby Gem installation
Next we need to install the Ruby gem package manager. You can download the latest Ruby gems by following link.
http://rubyforge.org/projects/rubygems/
Download and extract the files. (By the time I’m writing this tutorial the latest version is 1.3.1)
cd rubygems-1.3.1
sudo ruby setup.rb
Once it’s done you can delete the .tgz file and rubygems directory.
rm -r rubygems-1.3.1 rubygems-1.3.1.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.
sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby
sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb
Rails Installation
Now we can install Rails using gem.
Server Installation
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.
If you got any error while installing the Mongrel server, install the ruby-dev / ruby1.8-dev and try again.
Database Installation
Rails 2.3 shipped with SQLite3 as it’s default database instead of MySQL. You can install SQLite3 libraries by following commands.
sudo gem install sqlite3-ruby
If you prefer MySQL,
sudo gem install mysql
Create Ruby on Rails App
Now that we have completed everything successfully. You can create your new Ruby on Rail applicaion by following command.
If you need MySQL supported applicaion you need to specify as follows
Run the app
script/server
navigate you browser to http://localhost:3000
Wola.. you have done it…!
Happy Rails…!
Related Articles
Tags: Framework, Ruby on Rails, Ubuntu 8.10, Ubuntu 9.04, Web Development
This entry was posted on Tuesday, April 28th, 2009 at 6:52 am and is filed under How to, Ruby on Rails, Ubuntu, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.



8th May, 2009
Worked like a charm. Thanks.
24th May, 2009
Thanks. It’s a very well aport!!!
27th May, 2009
Fantastic instructions…presentation, flow!!!! An absolute pleasure to follow!!! Thanks a lot for this
)))
30th May, 2009
thank u it realy helped
10th June, 2009
Thanks very much
12th June, 2009
Excellent observations and you have a great way of expressing things. Thanks for this.
16th June, 2009
You know so many interesting infomation. You might be very wise. I like such people. Don’t top writing.
18th June, 2009
Thank you GaryPatton.! Stay tuned!
19th June, 2009
Thank you! It really so easy and worked…;)
23rd June, 2009
You are doing the things the proper way.
Some people tend to install RubyGems (and also Rails, etc.) from the native package repositories. It’s natural since it is usually the first way someone new to Ruby would try. It’s a good thing you chose to get RubyGems from the source, and Rails using gem package manager because the Ubuntu packages for these things are not updated with the speed of their release.
One suggestion, try adding a separate guide for using Passenger (Apache/Nginx module). It involves a little more setup, but makes thing a lot easier when you deploy.
On a personal note I prefer Thin over Mongrel.
Nice, clear and concise guide. Keep it up.
23rd June, 2009
Thank you Gaveen!
I hope to do a screencast on using Passenger by next week.
Stay tuned!
24th June, 2009
Assalamualaikum
Syukran bro for the input.
24th June, 2009
Walakum salam. I really don’t know the meaning of “Syukran”. But It’s sounds like “Thank you”. If so, you are mostly welcome!
25th June, 2009
Flawless….
30th June, 2009
Thanks for your help
. Now, I can start learning ruby on rails.
2nd July, 2009
Perfect. I previously compiled from source, but decided to try using the packages for convenience, and your guide was flawless. Cheers!
4th July, 2009
Is there a way to install RoR without Internet connection? I have ‘un-connected’ PC at home which I usually using to develop but I only have Internet connection at my office only. Thx.
11th July, 2009
You can install Ruby and Gem from compiling source codes.
01. Download Ruby source code
http://www.ruby-lang.org/en/downloads/
Extract the files and compile the source codes using following commands
02. Download GEMs from here
http://rubyforge.org/projects/rubygems/
But you need an Internet connection in order to install latest Rails and other gems.
If you are working in Windows, you can try Instant rails – single click installer
http://instantrails.rubyforge.org/wiki/wiki.pl
If you find any place to download Gems, please let us know.
13th July, 2009
Thanks a lot!! a very useful topic!!
20th August, 2009
Thanks very much! I’m new to both ubuntu and RoR, and this was very helpful. Much respect !!!
13th September, 2009
Great article, one small thing I found in the article
rails test-app -d mysql
should be: rails test_app -d mysql
15th September, 2009
Thank you James Moxley. Corrected!
6th October, 2009
Thanks for your wonderful tips. As a Rails newbie, i found them very helpful!
6th October, 2009
Hey dude, following your tutorial I have successfully managed to get rails installed and test my first app.thx so so much for taking your time and show the noobies how it;s done.
Many many thx
10th November, 2009
Thanks heaps for the clear instructions!
28th November, 2009
Thanks Mohamed, this is a fantastic walkthrough! After spending more than a few hours trying to set up Rails in my own ad-hoc way, I found your post, created a new VM and was up and running in 30 minutes.
3rd December, 2009
Thanks for the great instructions!
6th January, 2010
Dam easy !!! Thanks !
9th January, 2010
thanks a lot. Never installed in a flawless manner something on linux. Mohamed, you helped me to do it.
Have a nice day.
transit
14th January, 2010
perfecto!
20th January, 2010
great help!thank you veri much sir