23rd Jan2014
Author: Gyro

Update/Install ImageMagick on CentOS 5 and CentOS 6

Today I had a classic example of what happens when you do not RTFM. I had to install ImageMagick on a webserver running CentOS 5 with cPanel. First I simply ran "yum install imagemagick", which did install ImageMagick just fine.

Now, the reason I had to install it was to do a batch resize of about 20,000 images and place the resized images in a new directory. So I did:
# mogrify -resize 250 -quality 70 -path /home/somesite/public_html/image/thumbs/ -format jpg /home/somesite/public_html/images/*

To my surprise I got the error message:

mogrify: unrecognized option `-path'.

After a quick google search, I realized that yum installed a super old version that was not supporting the -path option?!

So, after some more searching, I found this great guide on how to Install ImageMagick 6.6.5 and followed the instructions. But when I got to the final installation command, I got a dependencies error?!

After another google search, I came across a forum post saying "Make sure that RPMForge repository is installed first, and then everything works."… and when I looked back at the guide, I realized that it did in fact tell me to do that. The reason I did not see it was because it was a one liner with a link to another website, and I was expecting to be able to simply copy paste commands, so I skipped reading that line. I did not RTFM properly…

So, to make it easy for the future, I will combine these two pages, in order to have a step by step set of instructions without having to go to another website :)

Before starting, make you sure you know whether you are using a 32-bit or 64-bit system.
# uname -i
x86_64 would be 64-bit

OK, here we go!

1. Uninstall ImageMagick

# rpm -e --nodeps ImageMagick.i386 ImageMagick-devel.i386 ImageMagick.x86_64 ImageMagick-devel.x86_64
this actually didn't work for me, so I did:
# yum remove imagemagick

2. Add the EPEL repository to yum:

CentOS 6:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
CentOS 5:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

3. Download and Install RPMforge (Check here for newer version.)

CentOS 6:
Download RPMforge for 32-bit systems: rpmforge-release-0.5.3-1.el6.rf.i686.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
Download RPMforge for 64-bit systems: rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Install DAG's GPG key:
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

If you get an error message like the following the key has already been imported:
error: http://apt.sw.be/RPM-GPG-KEY.dag.txt: key 1 import failed.

Verify the package you have downloaded:
# rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm

Install RPMforge:
# rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm

CentOS 5:
Download RPMforge for 32-bit systems: rpmforge-release-0.5.3-1.el5.rf.i386.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.i386.rpm
Download RPMforge for 64-bit systems: rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm

Install DAG's GPG key:
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

If you get an error message like the following the key has already been imported:
error: http://apt.sw.be/RPM-GPG-KEY.dag.txt: key 1 import failed.

Verify the package you have downloaded
# rpm -K rpmforge-release-0.5.3-1.el5.rf.*.rpm

Install RPMforge
# rpm -i rpmforge-release-0.5.3-1.el5.rf.*.rpm

4. Install dependencies for ImageMagick 6.6

For 32-bit systems:
# yum install djvulibre OpenEXR jasper ghostscript librsvg2 libwmf libtool-ltdl
For 64-bit systems:
# yum install djvulibre OpenEXR jasper ghostscript librsvg2.x86_64 libwmf.x86_64 libtool-ltdl.x86_64

Systems running CentOS 6 will need the old version of libtool-ltdl installed:
For 32-bit systems:
# rpm -ivh --force ftp://ftp.muug.mb.ca/mirror/centos/5.9/os/i386/CentOS/libtool-ltdl-1.5.22-7.el5_4.i386.rpm
For 64-bit systems:
# rpm -ivh --force ftp://ftp.muug.mb.ca/mirror/centos/5.9/os/x86_64/CentOS/libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm

5. Download and Install ImageMagick 6.6.5

Download for 32-bit systems: ImageMagick-6.6.5-10.i386.rpm
# wget http://www.lassosoft.com/_downloads/public/Lasso_Server/CentOS-Extra/ImageMagick-6.6.5-10.i386.rpm
Download for 64-bit systems: ImageMagick-6.6.5-10.x86_64.rpm
# wget http://www.lassosoft.com/_downloads/public/Lasso_Server/CentOS-Extra/ImageMagick-6.6.5-10.x86_64.rpm

Install ImageMagick
# rpm -ivh ImageMagick-6.6.5*

DONE! :crazy:

8442

Keep Me Going



Your Name / Website :


Did you like my post? Buy me a Bitcoffee! 14JX52Li7zTKbyQv2omw4tvu6Bi1KzfHNW



7 Responses to “Update/Install ImageMagick on CentOS 5 and CentOS 6”

  • Thanks!!!!! With this solve this problem with mediawiki
    Error al crear miniatura: sh: wmf2eps: command not found
    convert: Delegate failed `”wmf2eps” -o “%o” “%i”‘ @ delegate.c/InvokeDelegate/1032.
    convert: unable to open image `/tmp/magick-XX8sbY6P’: No such file or directory @ blob.c/OpenBlob/2480.
    convert: unable to load module `/usr/lib64/ImageMagick-6.5.4/modules-Q16/coders/svg.la’: file not found @ module.c/OpenModule/1168.
    convert: unable to open file `/tmp/magick-XX8sbY6P’: No such file or directory @ constitute.c/ReadImage/542.

    • Gyro

      That’s great!

      Thanks for your comment and for adding the error messages you got. Hopefully others searching for this wikimedia error will find the solution here now. :)

  • Audrey

    This works! Thank you so much.

    For the libtool, the above link did not work for me, used instead:

    rpm -ivh –force http://vault.centos.org/5.4/updates/x86_64/RPMS/libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm

  • Rod

    Hi Guys,

    What these error means?

    [email protected] [~]# rpm -ivh ImageMagick-6.6.5*
    error: Failed dependencies:
    libHalf.so.4 is needed by ImageMagick-6.6.5-10.i386
    libIex.so.4 is needed by ImageMagick-6.6.5-10.i386
    libIlmImf.so.4 is needed by ImageMagick-6.6.5-10.i386
    libImath.so.4 is needed by ImageMagick-6.6.5-10.i386

    Thanks,

    • Gyro

      Do this: yum install bzip2-devel freetype-devel libjpeg-devel libpng-devel libtiff-devel giflib-devel zlib-devel ghostscript-devel djvulibre-devel libwmf-devel jasper-devel libtool-ltdl-devel libX11-devel libXext-devel libXt-devel lcms-devel libxml2-devel librsvg2-devel OpenEXR-devel

      Then try again.

  • I’m still getting this error. Any ideas.

    Can’t load ‘/usr/local/lib64/perl5/auto/Image/Magick/Q16/Q16.so’ for module Image::Magick::Q16: libMagickCore-6.Q16.so.2: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 200.
    at /usr/local/share/perl5/parent.pm line 16
    Compilation failed in require at /usr/local/share/perl5/parent.pm line 16.
    BEGIN failed–compilation aborted at /usr/local/lib64/perl5/Image/Magick.pm line 22.
    Compilation failed in require at projects.cgi line 17.
    BEGIN failed–compilation aborted at projects.cgi line 17.
    &Image::Magick::Q16::constant not defined. The required ImageMagick libraries are not installed or not installed properly.
    END failed–call queue aborted at projects.cgi line 17.

    Thanks

    • Gyro

      If you have followed my steps from top to bottom, then I have no idea why you are getting that error. From what I read, you experienced a ImageMagick bug that had been fixed a long time ago, so it seems you have tried to installing the incorrect version. I would suggest to start over, and if it doesn’t work again, please post your issue into a forum. This comment section is not ideal for troubleshooting an individual issue. If you find out what the issue was, please do leave a comment to let us know how you were able to overcome it!

      Good Luck! :)

Leave a Reply

Your email address will not be published. Required fields are marked *

What is 4 + 2 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)