Dec 1 2007

How to install ruby on rails on Ubuntu Gutsy Gibbon (7.10)

If you're new here, you may want to start with my most popular posts. Then, subscribe to my RSS feed to stay updated. Thanks for visiting!

Google Query: Install Ruby on rails in Ubuntu

I recently did a fresh install of Ubuntu Gutsy Gibbon on my home pc. I also dabble in Ruby on Rails programming. In the past I had a setup involving Xampp for Linux and some convoluted add-on packages. Not very friendly or scalable. This time I decided to set things up the real way.

I finally found my answer in the Ubuntu Community Documentation. Thankfully, the process to get Ruby on Rails up and running on Ubuntu Gutsy Gibbon (7.10) is fairly simple. The summary is listed below.

-Install Ruby with the following command
sudo apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby ri

-Install Ruby Gems via source so apt-get won’t complain about files being changed by gem update –system
tar xzvf rubygems-1.0.1.tgz
cd rubygems-01.0.1
sudo ruby setup.rb
sudo gem update --system

-Install Rails along with its dependencies
sudo gem install rails -y
If you run into the following error while trying to install Rails: “(Gem::Exception) SSL is not installed on this system”
Install libopenssl-ruby by typing the following at the Terminal:
sudo apt-get install libopenssl-ruby

-Install mysql because Ruby on Rails is not much use without a database behind it
sudo apt-get install mysql-server

-Install the mysql gem to go along with mysql
sudo apt-get install libmysqlclient15-dev
sudo gem install mysql
If you get the following error when trying to install the mysql gem, you may need to install the “ruby1.8-dev” package:
“extconf.rb:1:in `require’: no such file to load — mkmf (LoadError)”
Install the “ruby1.8-dev” package by typing the following at the Terminal:
sudo apt-get install ruby1.8-dev
Then try the following again:
sudo gem install mysql

That’s it! You should be able to create a new Rails app and setup your database.yml file so Rails can work with your mysql database.

Technorati Tags: , ,

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.


27 Comments on this post


  1. leondu said:

    1. the Ruby Gems is now 0.9.5
    2. you should install ssl support for ruby to update gem
    sudo apt-get install libopenssl-ruby

    December 11th, 2007 at 9:10 am
  2. hstagner said:

    Hello leondu,

    Thanks for reading! Also, thank you for the update.


    Harley Stagner

    December 11th, 2007 at 9:39 am
  3. leondu said:

    also if you dont wanna the newest 2.0.1 of rails(for the gem compatibility) ,install a former version(say 1.2.6) by specific the version parameter:
    sudo gem install rails -v 1.2.6 –include-dependencies

    December 11th, 2007 at 6:55 pm
  4. ceaseoleo said:

    currently to get 2.0.2 running :

    sudo gem install rails –source

    also to get the mysql gem working :

    sudo apt-get install make autoconf gcc ruby1.8-dev build-essential

    December 17th, 2007 at 6:36 pm
  5. damien hunter said:

    RubyGems is currently at 1.0.1.

    Need to update “wget

    December 21st, 2007 at 4:36 am
  6. damien hunter said:

    The update command is changed too. It’s “sudo gem1.8 update –system”

    December 21st, 2007 at 4:41 am
  7. hstagner said:

    Hello Damien,

    Thanks for reading and thanks for the update! I have updated the article accordingly.

    Keep the suggestions coming. I hope to see you around again soon.

    December 21st, 2007 at 7:22 pm
  8. Jurgen Herrmann said:

    Thanks for very useful guide. I had to make a couple of modifications I wanted to share.

    - installing gem source
    – Version number needs to follow through all
    – gem command not in my path so I had to cd bin
    and substitute ./gem for gem.
    - install gem
    – substitute ./gem for gem.
    - once more in sudo gem install mysql
    – substitute ./gem for gem

    Again thanks for the great guide. I was up and running in minutes.

    Thanks and Best Regards,

    December 22nd, 2007 at 12:19 am
  9. hstagner said:

    Hello Jurgen,

    Good catch on the versions. I recently updated the post and must have forgotten to update the unzip command. Thanks for reading and thanks for the update!

    I hope to hear more from you soon at


    Harley Stagner

    December 22nd, 2007 at 12:43 am
  10. tike said:

    OMG. Damien, thanks for that tip re: using gem1.8 instead of gem. Wish I had known this a week ago…

    December 29th, 2007 at 4:00 pm
  11. Jenaro Centeno said:

    First, thanks for the info.

    There are lately some installs where the gem soft link is not created, so, when you try to run:

    sudo gem update –system

    The system replies saying that there’s no such program, you have to do:

    sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

    That’s the fix.

    December 30th, 2007 at 6:45 pm
  12. John said:


    works fine for my Gutsy 7.10 box, thanks for that.


    January 5th, 2008 at 4:38 am
  13. Peter Retief said:

    Got this error when running gem install mysql

    checking for mysql_query() in -lmysqlclient… no
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, etc

    I installed the following
    libc6-dev (2.6.1-1ubuntu10)
    libcrypt-mysql-perl (0.04-2)
    libdigest-sha1-perl (2.11-2)
    libmysqlclient15-dev (5.0.45-1ubuntu3.1)
    linux-libc-dev (2.6.22-14.52)
    ser (0.9.6-2)
    ser-mysql-module (0.9.6-2)
    zlib1g-dev (1:

    and it worked

    February 15th, 2008 at 2:26 pm
  14. hstagner said:

    Hello Peter,

    Thanks for reading and thanks for the tip! I am sure this will help others with this particular problem.

    Thank you.


    Harley Stagner

    February 15th, 2008 at 2:37 pm
  15. yachris said:

    Awesome! I was completely stuck, just needed the ‘ri’ command installed… it totally bollux’d the ruby gem command.

    ANYWAY, you might add that you can get mongrel going (MUCH faster than the default WEBrick for testing) by doing a simple:

    sudo gem install mongrel

    Thanks again for the great guide — you saved my sanity :-)

    February 23rd, 2008 at 7:10 pm
  16. jorgemaestre said:

    I obtained the following error when running gem ’sudo gem install rails -y’:

    /usr/bin/gem:23: uninitialized
    constant Gem::GemRunner (NameError)

    You can fix this by editing the file /usr/bin/gem and add the line
    require ‘rubygems/gem_runner’


    require ‘rubygems’

    March 20th, 2008 at 7:38 am
  17. randy_adanza said:

    i get this error when I executed sudo ruby setup.rb
    any ideas?

    cp gem /tmp/gem
    install -c -m 0755 /tmp/gem /usr/bin/gem1.8
    rm /tmp/gem
    cp update_rubygems /tmp/update_rubygems
    install -c -m 0755 /tmp/update_rubygems /usr/bin/update_rubygems1.8
    rm /tmp/update_rubygems
    Removing old RubyGems RDoc and ri…
    rm -rf /usr/lib/ruby/gems/1.8/doc/rubygems-1.0.1
    Installing rubygems-1.0.1 ri into /usr/lib/ruby/gems/1.8/doc/rubygems-1.0.1/ri…
    Installing rubygems-1.0.1 rdoc into /usr/lib/ruby/gems/1.8/doc/rubygems-1.0.1/rdoc…
    As of RubyGems 0.8.0, library stubs are no longer needed.
    Searching $LOAD_PATH for stubs to optionally delete (may take a while)…
    No library stubs found.

    March 31st, 2008 at 8:36 am
  18. stephen murdoch said:

    Hi thanks a lot for this walk-through

    I got it all up and running without too much fuss and your instructions really helped,

    many thanks

    April 2nd, 2008 at 5:12 pm
  19. Zach said:

    Thanks a lot! This helped very much!

    May 4th, 2008 at 1:19 pm
  20. Gabe said:

    Dude! I want to thank you so much. You did a great job on this post! I think that some of the details have gone stale but the main idea is there and it’s great that you took the time to post it. I have linked to this post on my blog so that it can help my friends trying to use Rails. Thanks again!

    May 24th, 2008 at 11:35 pm
  21. hstagner said:


    You’re quite welcome! I am glad it helped you out. Thank you for reading.



    May 25th, 2008 at 8:44 am
  22. Joe said:

    Delete my last comment, please. Your walkthrough would have worked unchanged except that I’m very bad and I temporarily added the Hardy repos in order to install the gnome-color-chooser. Adding it back in to install libmysqlclient15-dev worked.

    June 16th, 2008 at 8:13 pm
  23. Lex said:


    Great post.

    You saved me alot of time.

    Thank you!

    btw – How did you figure out that mkmf is in the “ruby1.8-dev” package?

    June 25th, 2008 at 11:27 pm
  24. hstagner said:

    Hello Lex,

    Thanks for reading! I am glad you found it helpful. Honestly, I just googled mkmf until I found the answer :)


    Harley Stagner

    June 27th, 2008 at 12:59 am
  25. Jason Green said:

    This looks very similar to the tutorial at ?

    July 20th, 2008 at 5:30 pm
  26. hstagner said:

    It could be. I actually got most of my information from the Ubuntu Community Documentation site, like I stated in the beginning of the post. This tutorial was a composite of that site and my own experiences installing it in Ubuntu 7.10.

    Thanks for reading!



    July 20th, 2008 at 9:55 pm
  27. Umuro said:

    Rails 2.3 provides new possibilities. Templates mean faster project initiation. And latest developments mean lesser installation.

    This tutorial is fully tested on Ubuntu Jaunty:
    Rais101 Tutorial Ruby on Rails with Relations

    Get the taste of having a production quality online database in minutes….

    Ubuntu 9.04
    Rails 2.3.2

    May 13th, 2009 at 3:45 pm


Subscribe Form

Subscribe to Blog


Recent Readers

                  Computers Blogs - Blog Top Sites