Problem installing Ruby on Ubuntu

Pat Lenz’s book arrived and I enthusiastically starting installing Ruby on my linux (Ubuntu 10.04) laptop. I am not a linux expert and I’m always tripped up by which folders to install software. I also made the mistake of trying to install using Synaptic Package Manager thus drifting from pat’s instructions.

However I did manage to install ruby and rails
i.e. when ruby -v I get
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]

i.e. when rails -v I get
Rails 3.0.3

In the Public directory where I installed ruby and rubygems I have two directors
ruby-1.8.7-p174
and
rubygems-1.3.7

I’m sure my PATH includes the necessary /usr/bin line

When I tried to install rails I get the following

fconte@fconte-laptop:~/Public$ sudo gem install rails
[sudo] password for fconte: 
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

Yet as I said rails is showing up as installed.

The big problem lies with trying to iactivate sqlite3
when i
sqlite3 --version
I get
3.6.22
so that’s pretty much installed
MOREOVER when I

sudo gem install sqlite3-ruby

gives me this

ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand
 

Make sure RubyGems is working correctly and installed:
gem -v

Install zlib libraries:
http://www.blog.fairanswers.com/?p=13