Problem installing RMagick rubygem on Centos 5-Collection of common programming errors

Centos 5.5 the ImageMagick is legacy, so install from source to can use the rmagick.

Get the source RPM

wget ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/linux/SRPMS/ImageMagick.src.rpm
rpm -ivh --nomd5 ImageMagick.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -ba ImageMagick.spec

Probably you get dependence error for:

  • perl-devel
  • jasper-devel
  • djvulibre-devel

Add to your /etc/yum.repos.d/dag.repo

[dag]
name=Dag RPM Repository for CentOS5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=0
gpgcheck=1

Then import the GPG key and install the djvulibre-devel

rpm --import http://ftp.riken.jp/Linux/dag/RPM-GPG-KEY.dag.txt
yum --enablerepo=dag install djvulibre-devel

Then check if you can make the RPM:

rpmbuild -ba ImageMagick.spec

If you get the perl-devel dependency error.

yum install perl

Then edit the ImageMagick.spec and replace “perl-devel” for “perl“, save and rpmbuild again.

rpmbuild -ba ImageMagick.spec

So install the the other dependences:

yum install freetype
yum install gd-devel
wget http://www.osresources.com/files/centos-windows-fonts/msfonts.tbz
mkdir /usr/share/fonts/default/TrueType
tar xvjpf msfonts.tbz -C /usr/share/fonts/default/TrueType/

Let’s install it:

cd /usr/src/redhat/RPMS/i386
rpm -Uvh ImageMagick-*

After all you can test if your RMagick is installed:

ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;"

Based on:

hi.baidu.com/rainchen/blog/item/089ef7364497de320a55a9a3.html

mobile-dev.izanagi-izanami.net/blog/?p=48