HowTo: Install Ruby, RubyonRails, and RubyGems on Ubuntu 5.10 (Breezy)
UnderpaidLoveMonki @ 10:07 pm January 13th, 2006Here’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”
begin
# 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}”
ensure
# disconnect from server
dbh.disconnect if dbh
end
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






January 14th, 2006 at 2:53 pm
[…] read more | digg story […]
January 14th, 2006 at 3:13 pm
I had problems wirth mysql I had to compile it manually
January 14th, 2006 at 3:52 pm
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?
January 14th, 2006 at 8:50 pm
[…] read more | digg story […]
January 15th, 2006 at 2:28 am
[…] read more | digg story […]
January 15th, 2006 at 4:07 pm
[…] 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. […]
January 15th, 2006 at 7:43 pm
“[…] Scott Rippee of Fat Penguin”
Scott Rippee? I didn’t write this. That damn UnderpaidLoveMonki did.
January 16th, 2006 at 6:35 am
[…] read more | digg story […]
January 22nd, 2006 at 8:12 pm
[…] 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. […]
January 23rd, 2006 at 10:13 am
What verions of Ruby did you get doing it this way?
I’d like to run 1.8.4
January 27th, 2006 at 6:22 pm
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.
Suggestions?
January 28th, 2006 at 5:19 am
on debian:
thinkpad:~# sudo apt-get install ruby rails
Reading Package Lists… Done
Building Dependency Tree… Done
E: Couldn’t find package rails
January 28th, 2006 at 7:57 am
Nice tutorial! Simple and effective!
January 28th, 2006 at 11:39 am
Anyone got a recommendation for a “source code” plugin for Wordpress 2.0 so I can display my codes properly? =)
January 28th, 2006 at 1:13 pm
UnderpaidLoveMonki: I think you can use <code></code>
January 28th, 2006 at 7:37 pm
I just tested the code tag and it works great!
January 28th, 2006 at 9:06 pm
coo coo! Thanks dooodz
February 7th, 2006 at 11:53 am
Good Article
Check this site for more detail instruction to setup mysql, phpmyadmin and other more including ruby on rails
http://davidwinter.me.uk/articles/2006/02/05/ubuntu-5-10-web-server-howto
February 11th, 2006 at 8:24 am
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.
February 16th, 2006 at 6:37 am
For some reason rails is not working properly with 1.8.3. You´d better try with 1.8.2 or 1.8.4
February 18th, 2006 at 5:35 pm
great site you have made
February 18th, 2006 at 7:23 pm
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
February 24th, 2006 at 10:53 am
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)
Anyway…
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:
./configure
make
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:
i386-linux
i686-linux
…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.
8)
February 24th, 2006 at 5:19 pm
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.
concept10
February 26th, 2006 at 4:29 pm
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"
March 22nd, 2006 at 9:57 am
I found this tutorial to work much better for me on Ubuntu.
http://fo64.com/articles/2005/10/20/rails-on-breezy
Takes approx 15 minutes to install but walks you through installing mysql apache2, ruby rails, etc.
Worked perfect for me.