Here are the simple steps to install rmagic on ubuntu:
There are some dependencies of RMagic, first install those.
sudo apt-get install imagemagick graphicsmagick
sudo apt-get install libmagickcore-dev libmagickwand-dev
Download the gem from Rubygems website and install.
gem install rmagick