Installing RMagick2 on CentOS5
I have just gone through hell attempting to install ImageMagick, RMagick2 on our CentOS5 server, and thought others might find this information useful.
It should have been as easy as
yum install ImageMagick gem install rmagick
But unfortunately it wasn’t. The reason is because yum will install ImageMagick 6.2.8.0, while RMagick2 requires ImageMagick 6.3.0 or higher. Fantastic. My sysadmin friend says, “It’s what is in the distribution, to keep the package base consistent.” I say, “But I need ImageMagick 6.3.0+ and this is a royal pain in the neck.”
These are the steps I took to successfully install ImageMagick 6.4.3 and RMagic2 on CentOS5. It took me an entire morning to figure this out (I am not a Linux expert), but with this guide it should take you 15 minutes or less.
0. Tell Yum to Get a Grip
I wasn’t able to install any of the following RPMs, because Yum had a gripper about them being “unsigned.” You need to tell Yum to shove it. Open up /etc/yum.conf
vi /etc/yum.conf
At the very end of the file, add the following line
gpgcheck=0That will tell Yum to install packages, regardless if they are “unsigned.”
WARNING: There’s probably a reason why gpgcheck exists. Do this at your own risk, and be sure to flip gpgcheck back to 1 when you are done.
1. Install a couple dependencies for ImageMagick
ImageMagick 6.4.3 requires two dependencies that were not in yum, libjasper.so.1 and libdjvulibre.so.15. Using http://rpm.pbone.net/, I found the RPMs that contained these files:
jasper-libs-1.900.1-7.el5.kb.i386.rpm and djvulibre-3.5.19-4.el5.kb.i386.rpm
wget ftp://ftp.pbone.net/mirror/centos.karan.org/el5/extras/testing/i386/RPMS/jasper-libs-1.900.1-7.el5.kb.i386.rpm wget http://centos.karan.org/el5/extras/testing/i386/RPMS/djvulibre-3.5.19-4.el5.kb.i386.rpm yum install jasper-libs-1.900.1-7.el5.kb.i386.rpm yum install djvulibre-3.5.19-4.el5.kb.i386.rpm
2. Install ImageMagick and Various Development Packages
Next, we need to install ImageMagick. To simply install ImageMagick, it’s a single package. However, to make RMagick happy, we also need to install several development packages.
wget ftp://ftp.imagemagick.org/pub/ImageMagick/linux/fedora/i386/ImageMagick-6.4.3-6.i386.rpm wget ftp://ftp.imagemagick.org/pub/ImageMagick/linux/fedora/i386/ImageMagick-devel-6.4.3-6.i386.rpm wget ftp://ftp.imagemagick.org/pub/ImageMagick/linux/fedora/i386/ImageMagick-c++-6.4.3-6.i386.rpm wget ftp://ftp.imagemagick.org/pub/ImageMagick/linux/fedora/i386/ImageMagick-c++-devel-6.4.3-6.i386.rpm yum install ImageMagick-6.4.3-6.i386.rpm yum install ImageMagick-devel-6.4.3-6.i386.rpm yum install ImageMagick-c++-6.4.3-6.i386.rpm yum install ImageMagick-c++-devel-6.4.3-6.i386.rpm
When you install the first ImageMagick package, yum should do its magic and install a bunch of dependencies, such as ghostscript, lcms, and others.
3. Install RMagick, finally
With all those RPM packages installed, you can install RMagick. If all the ImageMagick stuff is there, this should go smoothly.
gem install rmagick4. Undo the Change to yum.conf
It’s probably wise to remove or comment-out the modification you made to yum.conf
# gpgcheck=0