If you run into trouble installing Rmagick on Ubuntu, it is most likely because you do not have the dev libraries installed that are needed by the rmagick Ruby Gem. Run the following commands in your terminal and everything should work fine.
sudo apt-get install graphicsmagick-libmagick-dev-compat
sudo apt-get install imagemagick
sudo apt-get install libmagickcore-dev
sudo apt-get install libmagickwand-dev
gem install rmagick