You can do all this with the package managers, but be aware the ruby packages on Ubuntu are spread all over the place. Also, you'll may need the build-essentials package for a couple of the gems.
Do the following:
Some or all of which might have been installed at some point previously in the chain, but this should get it all and give you a working rubygems install.
Then you want to run (as root):
Gem may fail initially - if so this is due to a bug in the gem command and requires you to edit the gem script (found with the command
which gem on the command line) by adding to the
And install some useful gems, if you're wanting to play with rails: