The Wonderful World of Linux A mostly dead cpanel/linux blog

How to Install The Newest ImageMagick in Centos

For whatever reason I always had trouble installing the ImageMagick RPM’s from their website. So when I got a good guide written down I figured Id share it with everyone. Here’s how to install the latest and greatest ImagickMagic rpm’s to Centos 5 and Centos 6 and should be compatible with most cpanel systems!


Lets download all of the development tools and prerequisites

yum -y install gcc gcc-c++ make
yum -y install rpmdevtool libtool-ltdl-devel freetype-devel ghostscript-devel libwmf-devel lcms-devel bzip2-devel librsvg2 librsvg2-devel libtool-ltdl-devel autotrace-devel fftw3-devel libtiff-devel giflib-devel libXt-devel xz-devel 

The we’ll download all the rpms:

wget -rnd$(uname -i)/

#lifttw3 for  CentOS 5 Only
if [ "$(cat /etc/redhat-release | cut -d' ' -f3 | cut -d'.' -f1)" == 5 ]
	wget -rnd$(uname -i).rpm
	wget -rnd$(uname -i).rpm

#And Djvulibre
wget$(uname -i).rpm
wget$(uname -i).rpm

We need to copy libltdl to You’ll get an error on Centos 5 most likely. You can ignore it if you do.

if [ "$(uname -i)" == "x86_64" ]
	cp /usr/lib64/ /usr/lib64/
	cp /usr/lib/ /usr/lib/

Finally, install the RPMs…

rpm -Uvh *.rpm --nodeps --force

And verify!

[[email protected] imagemagick]# convert --version
Version: ImageMagick 6.8.6-9 2013-08-25 Q16
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLCFeatures: DPC OpenMP
Delegates: bzlib cairo djvu fftw fontconfig freetype gslib jng jp2 jpeg lcms ltdl lzma openexr png ps png rsvg tiff webp wmf x xml zlib

You can also give it a test by creating a sample image from text:

convert -background 'rgb(3,27,5)' -fill white -font Helvetica-Bold -size 250x100  -pointsize 42 -gravity center label:'Linux Rulez!!' linux.gif

ImageMagick PHP Extension

You may also need to install the ImageMagick PHP Extension and its just as annoying. Lets get started, we need to create some folders and link some files:

mkdir -p $(MagickWand-config --prefix)/include/ImageMagick/
ln -s /usr/include/ImageMagick-6/wand $(MagickWand-config --prefix)/include/ImageMagick/wand

Download the file:

cd /root
tar xzf imagick-3.1.0RC2.tgz
cd imagick-3.1.0RC2

And install:

./configure PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
make install

Add it to the php.ini:

echo ";" >> /usr/local/lib/php.ini

And verify!!

[[email protected] ~]# php -i | grep imagick
imagick module => enabled
imagick module version => 3.1.0RC2
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0