Installing Ruby & Rails on Ubuntu 8.04 Hardy Heron

This is what I did to get Ruby and Rails working on my new Ubuntu 8.04 LTS. It appears that nothing really changed from previous version. The basic step is to install the Ruby using apt-get and installing the Gem from the source. I learned my lesson NOT to install Ruby from the source on Ubuntu. Just remember that if any gem installation fails, just get the required library using apt-get and get the ‘dev’ version as well. This is the rule of thumb I’ve been following and has worked out well for me.

Step 1: Install Ruby from apt-get.
~$ sudo apt-get install ruby irb ri rdoc ruby1.8-dev libzlib-ruby libyaml-ruby libreadline-ruby libncurses-ruby libcurses-ruby libruby libruby-extras libfcgi-ruby1.8 build-essential libopenssl-ruby libdbm-ruby libdbi-ruby libdbd-sqlite3-ruby sqlite3 libsqlite3-dev libsqlite3-ruby libxml-ruby libxml2-dev

Step 2: Download and install RubyGems
Just download and extract the latest Gem and run following command.
~$ sudo ruby setup.rb
After successful installation, run this to create the link in /usr/bin
~$ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

Step 3: Install Rails and Gems
~$ sudo gem install rails
~$ sudo gem install sqlite3-ruby mongrel capistrano

Since I don’t use MySQL anymore, it’s really optional. It’s basically same as before, just make sure you are using following command to get everything you need for MySQL.
~$ sudo apt-get install mysql-server mysql-client libdbd-mysql-ruby libmysqlclient15-dev

** UPDATE **
- “libmysqlclient-dev” is now “libmysqlclient15-dev” => I found this out while installing my new server, but it appears that maurizio de magnis already posted the solution in the comments. Thanks!
- “buildessential” is no longer required when installing Ubuntu Server.

Comments

19 Responses to “Installing Ruby & Rails on Ubuntu 8.04 Hardy Heron”

  1. Stian on April 29th, 2008 11:39 am

    Thx dude. Great info!

  2. My first RoR VM « Rails-o-matic on April 29th, 2008 4:09 pm

    [...] on Linux for the first time (yes, I’m a Windows user - and a C# developer for $$$): rubyhead Posted by f.pighi Filed in ruby on rails Tagged: ruby on rails, [...]

  3. RRob on May 14th, 2008 8:09 am

    Nice info. Thanks. Exactly what I needed.

  4. Sahil Saggar on May 16th, 2008 7:46 am

    Info is really helpful.

    I am a PHP developer and starting with ROR. I was wandering how to install ROR and your post is really helpful and easy to follow. I installed ROR without any problem.

    Thanks !!

  5. Jim Wyatt on May 30th, 2008 3:20 pm

    Just curious, why do you prefer SQLite over MySQL? Thank you very much for your concise and accurate documentation.

  6. louis on June 3rd, 2008 5:14 pm

    Hi … great work .. all works up to ..

    ~$ sudo apt-get install mysql-server mysql-client libdbd-mysql-ruby libmysqlclient-dev

    it come an error messages by libmysqlclient-dev

  7. Joon on June 6th, 2008 9:56 am

    @Jim Wyatt - I prefer SQLite for development ever since I actually started trusting db migration. Besides, I like the fact that it’s a file that I can wipe out… Just as a reminder, it’s just for development only!

    @louis - take a look at your apt source list. You’re probably getting the error message because you need to activate other sources.

  8. RB on June 11th, 2008 3:22 pm

    Been using ROR on Windows… switching to Ubuntu… great tutorial… unfortunately when I type ‘ruby scripts/generate ….’ I get an error. Is there a path variable I’m missing or something?

  9. Joon on June 11th, 2008 4:21 pm

    @RB - It should be ruby script/generate, not scripts/generate. If you’re using Ubuntu, you don’t need to type ruby.

  10. RB on June 12th, 2008 7:40 am

    Okay… I created a “rails” directory under my $HOME directory. Then typed the following: script/generate controller Site index about help

    then pre-pended with ruby. Both give an error. With “ruby” pre-pended I get: ruby: No such file or directory — script/generate (LoadError)

    without ruby I get: bash: script/generate: No such file or directory

  11. Joon on June 12th, 2008 9:29 am

    When you say you created a “rails” directory, I’m assuming it’s “rails application_name” and running the command under application_name directory. Right?

  12. RB on June 12th, 2008 12:04 pm

    Hold head in shame

    Thanx. Newbie error. assumed it was Ubuntu… Old dog, new tricks.

  13. maurizio de magnis on June 22nd, 2008 7:10 am

    Hi, this tutorial has been very useful but I encountered a problem with the last step:

    ~$ sudo apt-get install mysql-server mysql-client libdbd-mysql-ruby libmysqlclient-dev

    the problem is that the package “libmysqlclient-dev” is not recognized correctly on my ubuntu 8.04 here’s the log (in italian):

    “Lettura della lista dei pacchetti in corso… Fatto
    Generazione dell’albero delle dipendenze in corso
    Lettura delle informazioni di stato… Fatto
    Il pacchetto libmysqlclient-dev è un pacchetto virtuale fornito da:
    libmysqlclient15-dev 5.0.51a-3ubuntu5.1
    Bisogna esplicitamente sceglierne uno da installare.
    E: Il pacchetto libmysqlclient-dev non ha candidati da installare”

    I think the solution is, as proposed by apt-get, to rename the package “libmysqlclient-dev” in “libmysqlclient15-dev”.

    hf :)

  14. George Chacko on June 28th, 2008 10:01 am

    I had to do a “sudo gem install net-ssh” before “sudo gem install Capistrano” to get this to work on Hardy Heron 8.04

    gc

  15. محمد زاهر غيبة » الأرشيف » تنصيب روبي و ريلز على أوبنتوا 8.04 on July 15th, 2008 8:13 am

    [...] تنصيب روبي و ريلز على أوبنتوا 8.04  بصراحة هذه المقالة مترجمة و الرابط الرئيسي لها هو : تنصيب روبي و ريلز على اوبنتو 8.04 [...]

  16. Gargamel.NU » Blog Archive » RoR, Första titt… on July 19th, 2008 5:45 am

    [...] RubyHead Hur installationen av Ruby On Rails “bör” göras på Ubuntu 8.04 (Hardy Heron) [...]

  17. Make it Do Something « ALL2EZ on August 11th, 2008 3:16 pm

    [...] RubyHead.com [...]

  18. Development Software « ALL2EZ on August 11th, 2008 5:03 pm

    [...] RubyHead.com [...]

  19. Installing Ruby & Rails On Ubuntu | Ubuntu Rocks on August 16th, 2008 2:31 am

    [...] forward way I know to install a Ruby & Rails working environment. I have to give mention to RubyHead and Enrailed for pointing me in the right direction, and this guide is based on their [...]

Leave a Reply

You must be logged in to post a comment.