<< there's no place like 127.0.0.1

ImageMagick is a common requirement for other pieces of software that have image manipulation functionality, so I’ll see requests to install it pretty often. Surprisingly, I still see people struggle with the installation. It can seem daunting, but it’s really quite easy. Today I’ll show you how to install both ImageMagick and it’s PHP module, Imagick, on a CentOS server.

Note: I wrote this with CentOS in mind, but it also works for Ubuntu. I’ve used it numerous times with my Ubuntu servers. (Updated on: March 26th, 2015)

What Is It?

First, a little intro: ImageMagick is an open source software suite for displaying, converting, and editing raster image files. It can read and write over 200 image file formats. ImageMagick is quite powerful. Ever wanted to make your own meme generator? ImageMagick can hook you up. Shameless plug - check out my own O'RLY generator; made possible with ImageMagick.

ImageMagick install from source

    cd /usr/local/src
    wget http://www.imagemagick.org/download/ImageMagick.tar.gz
    tar xvzf ImageMagick.tar.gz
    cd ImageMagick*
    ./configure --enable-shared --disable-openmp
    make && make install
    ldconf

Test the installation

    /usr/local/bin/convert -version

If that returns a response, the installation is good.

Clean Up Your Files

    cd ~; rm -rf /usr/local/src/ImageMagick*

Install PHP module

You can grab the PHP module from PECL, then install from source:

    cd /usr/local/src
    pecl download imagick
    tar -xvzf imagick*.tgz
    cd imagick*
    ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick
    export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    phpize
    ./configure && make && make install
    echo 'extension=imagick.so' >> /usr/local/lib/php.ini

Verify that the module is correctly added in:

    php -m | grep imagick

Then restart Apache and clean up your files:

    /etc/init.d/httpd restart
    cd ~; rm -rf /usr/local/src/imagick*

Notes

I must thank my good buddy Colin R. for getting most of the actual commands written out. He’s a long time contributor to all things web tech and I’m sure was more frustrated at the lack of guides for this :)

This article is one I had written and shared with the ServInt blog as part of the ‘Tech bench’ series. You can view it on the ServInt blog here. They are using my article with my permission.

Running Gitit Wiki with Upstart

I know I've been rather quiet lately. I've been busy travelling for a little bit and found myself at a new job. Well, now I'm getting bac...… Continue reading