1. Home

Anil Lakhman

< Blog />

Install ImageMagick on CentOS 6


I had a client requirement to install Imagick on a CentOS 6 box from source, this involved 2 steps, compiling ImageMagick from source and then installing and configuring the compiled binary in PHP.

# Remove all previous installations
yum remove ImageMagick
pecl uninstall ImageMagick

# Install dependencies
yum install libtool-ltdl-devel

# Create a temporary directory
mkdir tmp
cd tmp

# Fetch the latest version available, unzip it & clean, make and install
curl -OL ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
tar -xzf ImageMagick.tar.gz
cd ImageMagick-6.9.0-4/
./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --with-gs-font-dir=/usr/local/share/ghostscript/fonts --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-png32=yes --with-png64=yes
make clean
make install

# Check where `convert` is installed
which convert

# Check the version (for your sanity) we are installing 6.9.0-4
# Version: ImageMagick 6.9.0-4 Q8 x86_64 2015-01-30 http://www.imagemagick.org
# Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
# Features: DPC Modules OpenMP
# Delegates (built-in): bzlib djvu fontconfig freetype gslib jng jpeg lcms ltdl openexr pangocairo png ps tiff x xml zlib
convert -version

# Update the PECL channel
pecl channel-update pecl.php.net

# Update the PECL ImageMagick extension (select [auto detect])
sudo pecl install ImageMagick

# Add the following line to php.ini (I added it towards the bottom)
vi /etc/php.ini

# Restart apache
sudo apachectl graceful

# Go have a beer 🍻

I prefer using the OOP API provided by Imagick, I found it easier to use then GD.