about img
blogger img

UnderPaidLoveMonkis posts img

buchos posts img

Corys posts image

scotts posts image

HowTo: Install Ruby, RubyonRails, and RubyGems on Ubuntu 5.10 (Breezy)

UnderpaidLoveMonki @ 10:07 pm January 13th, 2006

Here’s a quick guide if you’re running Ubuntu (should also work with Debian).

1. Install ruby and rubyonrails

sudo apt-get install ruby rails

2. Install RubyGems (you can install ruby apps that are not found in the Ubuntu respository)

a) Download rubygems-0.8.11.tgz (at the time of this writing) from http://docs.rubygems.org

b) Unpack it, navigate into the directory, and type the following command:

i) $ cd rubygems-0.8.11

ii) $ sudo ruby setup.rb

iii) $ sudo gem install rubygems-update

4. Install Ruport (a report generator) via RubyGems

a) $ sudo gem install ruport

b) $ ruport -v

5. Test ruby-dbi database connector (should be installed with rails)

Save the following Ruby script as test.rb:

# simple.rb - simple MySQL script using Ruby DBI module
require “dbi”
# connect to the MySQL server
dbh = DBI.connect(”dbi:Mysql:mydatabasename:localhost”, “root”, “laughwithme”)
# get server version string and display it
row = dbh.select_one(”SELECT VERSION()”)
puts “Server version: ” + row[0]
rescue DBI::DatabaseError => e
puts “An error occurred”
puts “Error code: #{e.err}”
puts “Error message: #{e.errstr}”
# disconnect from server
dbh.disconnect if dbh

6. Execute script: $ ruby test.rb

If the dbi connector is present, the script output should output the MySQL version.

7. Execute Ruport

a) $ ruport generate test (it’ll create a directory called test and generate templates)

b) $ cd test

c) $ edit database config file by:
nano config/ruport.yaml
:driver: ‘DBI:mysql’
:database: ‘testdb:localhost’
:db_user: ‘testuser’
:db_password: ‘testuser’

8. generate report by executing the following command:

ruport templates/test.rb

26 Responses to “HowTo: Install Ruby, RubyonRails, and RubyGems on Ubuntu 5.10 (Breezy)”

  1. DevilsRejection » Installing Ruby, RubyonRails, and RubyGems on Ubuntu or Debian Says:

    […] read more | digg story […]

  2. zoran Says:

    I had problems wirth mysql I had to compile it manually

  3. Frank Hale Says:

    Did you notice that the version of ruby for Ubuntu labeled 1.8.2 in the package is really a 1.8.3 version? I’ve heard that it’s not really recommended to run Rails 1.0 with Ruby 1.8.3.

    The problem is why are the Ubuntu Ruby 1.8.2 packages installing a 1.8.3 version?

  4. A Look Inside The Mind Of Cat Chapman » Blog Archive » Installing Ruby, RubyonRails, and RubyGems on Ubuntu or Debian Says:

    […] read more | digg story […]

  5. Secret Black Book of IceFuzion » Installing Ruby, RubyonRails, and RubyGems on Ubuntu or Debian Says:

    […] read more | digg story […]

  6. Rails Tips | How to install Ruby on Rails on Ubuntu Linux Says:

    […] Scott Rippee of Fat Penguin has posted a quick and dirty tutorial on how to install Ruby, RubyGems, and Ruby on Rails on an Ubuntu Linux box. […]

  7. Scott Rippee Says:

    “[…] Scott Rippee of Fat Penguin”

    Scott Rippee? I didn’t write this. That damn UnderpaidLoveMonki did.

  8. admarshall arts » Installing Ruby, RubyonRails, and RubyGems on Ubuntu or Debian Says:

    […] read more | digg story   […]

  9. The Huge Game of Virtual Web Stock :: Fat Penguin Says:

    […] When I was checking out hypexr.org’s stock I noticed a trade happened when UnderPaidLoveMonki’s article HowTo: Install Ruby, RubyonRails, and RubyGems on Ubuntu 5.10 (Breezy) got dugg, you can see a user bought all of hypexr.org’s stock (144) for $7 probably when he noticed the site beginning to get digg and sold it the next day (after the post hit digg’s front page) for $45. This made a quick $5,472 and the digg/slashdot method is good for new players to get rolling with some real money. […]

  10. rob Says:

    What verions of Ruby did you get doing it this way?

    I’d like to run 1.8.4

  11. Steve Says:

    running ubuntu 5.10, apt-get install ruby gives me v. 1.8.3. yuck.

    I suspect that this is why when running ruport -v I get ton of errors.


  12. Hoo Hoo Nick Says:

    on debian:

    thinkpad:~# sudo apt-get install ruby rails
    Reading Package Lists… Done
    Building Dependency Tree… Done
    E: Couldn’t find package rails

  13. Ivan Minic Says:

    Nice tutorial! Simple and effective!

  14. UnderpaidLoveMonki Says:

    Anyone got a recommendation for a “source code” plugin for Wordpress 2.0 so I can display my codes properly? =)

  15. Steve Says:

    UnderpaidLoveMonki: I think you can use <code></code>

  16. Scott Rippee Says:

    I just tested the code tag and it works great!

  17. UnderpaidLoveMonki Says:

    coo coo! Thanks dooodz

  18. Raru Says:

    Good Article
    Check this site for more detail instruction to setup mysql, phpmyadmin and other more including ruby on rails


  19. Steve Says:

    1.8.3 - Has everyone been using this version of ruby and making out ok? It looks like I have to go to debian to get the properly working packages.

  20. miguelsan Says:

    For some reason rails is not working properly with 1.8.3. You´d better try with 1.8.2 or 1.8.4

  21. Ağva Says:

    great site you have made

  22. Bert Says:

    Instructions failed for me at step 2.ii

    sudo ruby setup.rb

    Seeing as how I am just getting started I don’t know how to troubleshoot this error. Any help greatly appreciated.

    /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require__’: no such file to load — zlib (LoadError)
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/package.rb:9
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/builder.rb:1
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:61:in `manage_gems’
    from /home/admin/rubygems-0.8.11/./post-install.rb:64:in `install_sources’
    from /home/admin/rubygems-0.8.11/./post-install.rb:75:in `try_run_hook’
    from setup.rb:577:in `run_hook’
    from setup.rb:1315:in `exec_task_traverse’
    from setup.rb:1168:in `exec_install’
    from setup.rb:887:in `exec_install’
    from setup.rb:705:in `invoke’
    from setup.rb:674:in `invoke’
    from setup.rb:1352

  23. Colin Says:

    Bert, I had the exact same problem on Debian Sarge. I’m still a bit of a nubie when it come to Linux, but I’m lovin’ it. Bye bye Bill 8)

    I didn’t use the apt-get in step 1 of this guide as I wanted 1.8.4 (not 1.8.2), which may have caused most of the problem.

    I seems I had two installations of ruby on my machine after I did:
    sudo make install
    …of the ruby 1.8.4.

    After much investigation i found that ./configure defaultly sets up to install under /usr/local (for ruby to /usr/local/lib/ruby). I found this out after spotting that I already had a copy installed to /usr/lib/ruby. I also noticed that the gems area in the new /usr/local/… had the appropriate dirs in it, but no files in them.

    I tried simply renaming the /usr/local/lib/ruby dir and makeing a soft link to the /usr/lib/ruby dir. This didn’t fix the problem so I tried rerunning ./config on the ruby 1.8.4 with the “–prefix=/usr” argument. I then tried step 2.

    I don’t remember whether that worked straight off or not. But I did have a problem with the zlib.so file.

    I checked out /usr/lib/ruby/1.8. It now had both of these dirs:
    …to be honest i don’t know what the contents of these directories are for, but I did know that the zlib.so file needed to be in them, I had already run:
    sudo apt-get install libzlib-ruby
    so it was in the i368-linux dir, i copied it to the I686-linux directory, and everything was good. :)

    I hope I haven’t missed out soemthing really important, i didn’t make notes on everything i did as i hadn’t realised it was going to be such a mission to sort out. I hadn’t planned on posting a solution either, but as I couldn’t find anything in the way an answer it thought i ought to.

    So there you go, I hope this helps someone. Dunno why it had to be sooo hard.

  24. Tracey Says:

    This install does not make sense.  I personally would’nt install Ruby and Ruby on Rails using this method.   The Ubuntu Ruby and Rails packages  are not the recomended packages for install. 
    Why install Ruby Gems and not use it to install Ruby on Rails using:  sudo gem install rails –include-dependencies?
     I know every one loves the APT packaging system but RubyGems are the preffered distrubution method for Ruby applications and libraries.

  25. Exohuman Says:

    I tried what Tracy said and it worked. Much easier. Just make sure you have ruby installed (and irb and rdoc for completion sake) and then you can run "sudo gem install rails" However, even after that I still had to run "sudo apt-get install libdbi-ruby1.8"

  26. John Says:

    I found this tutorial to work much better for me on Ubuntu. 
    Takes approx 15 minutes to install but walks you through installing mysql apache2, ruby rails, etc.
     Worked perfect for me.