Ruby, Gems and RMagick on Ubuntu Edgy

I’ve seen a lot of questions on the ubuntu forums and elsewhere about getting rails, gems and rmagick up and running on Ubuntu. I’ve just performed a fresh install of Ubuntu Edgy Eft and here’s how I got everything installed (I’ll assume you have already set up the additional apt repositories):

# Make sure everything is up to date
sudo apt-get update
sudo apt-get dist-upgrade

# Install ruby
sudo apt-get install ruby ri rdoc libmysql-ruby

# Install gems
wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar zxvf rubygems-0.9.0.tgz
cd rubygems-0.9.0
sudo ruby setup.rb

# Intstall rails
sudo gem install rails --include-dependencies

# Install imagemagick - say yes to all of the additional dependencies
sudo apt-get install libmagick9-dev

# Install rmagick
sudo gem install rmagick

After following these steps everything was running perfectly.

It’s important to note that if you do follow this example then you will need to stick entirely to using gem to manage your ruby/rails install rather than the Debian/Ubuntu packages. This is due to some philosophical issues between the debian package management system and the gem package management system and their differences in file locations.

Let me know how it turns out for you.