Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install ImageMagick from source on Amazon Linux

I needed a newer version of ImageMagick than is available on the yum packages on Amazon Linux. I tried using the remi repo but it failed with dependency errors. Here is what I did to install ImageMagick with support for PNG, JPG, and TIFF.

download the most recent package

wget http://www.imagemagick.org/download/ImageMagick.tar.gz

uncomress the package

tar -vxf ImageMagick.tar.gz

install the devel packages for png, jpg, tiff. these are dependencies of ImageMagick

sudo yum -y install libpng-devel libjpeg-devel libtiff-devel

configure ImageMagick without X11. this is a server without a display (headless) so we don't need X11

cd ImageMagick
./configure --without-x
make && make install

mission complete.

@samsamm777

This comment has been minimized.

Copy link

commented Jul 1, 2014

This worked perfectly! Thanks!

@ARolek

This comment has been minimized.

Copy link
Owner Author

commented Jul 10, 2014

@samsamm777 glad it could help. I just referenced it today again. I need to write more stuff down ;-)

@danielroy

This comment has been minimized.

Copy link

commented Sep 5, 2014

Thanks, this saved me so much pain!

@Ravean

This comment has been minimized.

Copy link

commented Mar 6, 2015

This almost worked as described but I had to do:

make
sudo make install

However I ran into problems when trying to use imagemagick with php. I was getting the following errors in the /var/log/httpd/error_log after restarting apache:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - libMagickWand.so.5: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - libMagickCore.so.5: cannot open shared object file: No such file or directory in Unknown on line 0

ldd on imagick.so showed:

ldd imagick.so
        libMagickWand.so.5 => not found
        libMagickCore.so.5 => not found

I had to create a symlink to like this to the libMagick files:

sudo ln -s /usr/local/lib/libMagickCore-6.Q16.so.2.0.0 libMagickCore.so.5
sudo ln -s /usr/local/lib/libMagickWand-6.Q16.so.2.0.0 libMagickWand.so.5

Everything seems to be working now. Hope this helps someone else with the same problem.
Thanks!

@kendantinio

This comment has been minimized.

Copy link

commented Jul 25, 2015

Got this problem on live amazon ec2 linux

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.6/modules/imagick.so' - /usr/lib64/php/5.6/modules/imagick.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Fatal error: Class 'Imagick' not found in /var/www/html/test/imagick/index.php on line 2

@kendantinio

This comment has been minimized.

Copy link

commented Jul 25, 2015

Got this problem on live amazon ec2 linux

PHP Fatal error: Class 'Imagick' not found in /var/www/html/test/imagick/index.php on line 2

Using this code
$imagick = new Imagick();
var_dump($imagick);
$imagick->readImage('test.pdf');
$imagick->writeImages('testone.jpg', false);
echo 'Aw';

@mariosanchez23

This comment has been minimized.

Copy link

commented May 20, 2016

I tried in a clean aws machine and it didn't work.
I needed to use curl instead of wget
and the run
yum groupinstall "Development tools"

because I was getting errors calling the ./configure --without-x
The error was>
configure: error: in `/home/ec2-user/ImageMagick-7.0.1-5':
configure: error: no acceptable C compiler found in $PATH

at last I needed to do sudo for make && make install

@gweiss27

This comment has been minimized.

Copy link

commented Jun 8, 2016

This was a godsend! Thank You!!!! (I also had to sudo pretty much everything). I chose to installed the latest 6.9.4-8 version and then uninstalled and reinstalled imagick (and restarted apache). Now it seems like I'm all upgraded!

Love smart people who help others out! :)

@AljoSt

This comment has been minimized.

Copy link

commented Jun 30, 2016

Thanks!

@pdbreen

This comment has been minimized.

Copy link

commented Sep 14, 2016

Thanks. This got me most of the way there for an upgrade on ec2 running php70! Since I was after webp support, I also installed the libwebp-devel (and giflib-devel for good measure). And, when done, I had to reinstall imagick via pecl instead of yum. Complete steps for me ended up being this:

sudo yum install libpng-devel libjpeg-devel libtiff-devel libwebp-devel giflib-devel

cd
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar -vxf ImageMagick.tar.gz
cd ImageMagick-7.0.3-0/
./configure --without-x
make
sudo make install

sudo service nginx stop
sudo service php-fpm stop

sudo yum install php70-devel
sudo pecl install imagick

php -v

sudo service php-fpm start
sudo service nginx start
@Said210

This comment has been minimized.

Copy link

commented Sep 12, 2017

Nice, thank you (y)

@p-j-vlad

This comment has been minimized.

Copy link

commented Nov 25, 2017

I'm running Amazon EC2 with AWS Linux on it. I tired the instructions from pdbreen and I'm getting an error right after executing ./configure:
./configure --without-x

Right after that I get this error:
configure: error: in `/var/www/html/ImageMagick-7.0.7-11':
configure: error: no acceptable C compiler found in $PATH

Adding the compiler fixed the issue:
yum install gcc gcc-c++ autoconf automake

Thanks.
PV.

@Rybots

This comment has been minimized.

Copy link

commented Jul 15, 2018

It helps me a lot.! You're out of this world! Thanks!!!!!!!

@wassgha

This comment has been minimized.

Copy link

commented Aug 2, 2018

If it complains about "delegates library support not built-in" (freefont or others), install ImageMagick-devel before executing sudo make :

sudo yum install ImageMagick-devel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.