[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Osaka/Yokohama/Tokushima] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[Compatible with over 200 countries] Global eSIM “Beyond SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[If you are traveling, business trip, or stationed in China] Chinese SIM service “Choco SIM”

[Global exclusive service] Beyond's MSP in North America and China

[Global exclusive service] Beyond's MSP in North America and China

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

[Image processing software] Something like a memo about ImageMagick and Imagick installation

Hello.
Once a day OOM killer This is Kawa from the System Solutions Department.

The other day I had to install ImageMagick on my Linux machine, but
since it was my first time using it, I had a hard time installing it. First of all, there isn't much information available.
Even if it does, the OS is different, the version is older, or the method is completely different.
Every time you get an error with package dependencies, don't worry.

This is a memo of what went well in the AlmaLinux 8 environment. I hope it will be useful to someone in future generations.

Difference between ImageMagick and Imagick

The first thing you need to understand is that they are different. (Skip this if you already know)
ImageMagick is free open source software for editing and converting image files.
Imagick is a PHP extension module that allows you to create and edit image files from PHP using the ImageMagick API.

So, if you just install ImageMagick, you won't be able to run it from the PHP side, so be careful! (complicated)

About the environment

AlmaLinux 8.8
Apache 2.4.37
PHP 8.1.23
PHP-FPM 8.1.23

Insert the remi repository as a preliminary preparation

dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

Installing ImageMagick

If you try to install it without thinking, the required package will not exist and you will get an error like this,

dnf install --enablerepo=remi ImageMagick7 ImageMagick7-devel Last metadata expiration check: 0:54:50 ago on Fri Sep 15 15:54:10 2023. Error: Problem: cannot install the best candidate for the job - nothing provides jasper- devel(x86-64) needed by ImageMagick7-devel-1:7.1.1.15-1.el8.remi.x86_64 - nothing provides OpenEXR-devel(x86-64) needed by ImageMagick7-devel-1:7.1.1.15-1. el8.remi.x86_64 - nothing provides ghostscript-devel(x86-64) needed by ImageMagick7-devel-1:7.1.1.15-1.el8.remi.x86_64 - nothing provides jbigkit-devel(x86-64) needed by ImageMagick7- devel-1:7.1.1.15-1.el8.remi.x86_64 - nothing provides lcms2-devel(x86-64) needed by ImageMagick7-devel-1:7.1.1.15-1.el8.remi.x86_64 - nothing provides openjpeg2- devel(x86-64) needed by ImageMagick7-devel-1:7.1.1.15-1.el8.remi.x86_64 (try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Add and enable a repository called "PowerTools",

dnf config-manager --set-enabled powertools

When I tried again, I was able to successfully install everything including dependencies!

dnf install --enablerepo=remi ImageMagick7 ImageMagick7-devel AlmaLinux 8 - PowerTools 938 kB/s | 3.2 MB 00:03 Last metadata expiration check: 0:00:02 ago on Sat Sep 16 16:35:59 2023. Dependencies resolved. ================================================== ================================================== =============== Package Arch Version Repository Size ============================== ================================================== =================================== Installing: ImageMagick7 x86_64 1:7.1.1.15-1.el8.remi remi 110 k ImageMagick7-devel x86_64 1:7.1.1.15-1.el8.remi remi 143 k Installing dependencies: ImageMagick7-libs x86_64 1:7.1.1.15-1.el8.remi remi 2.5 M LibRaw x86_64 0.19.5-3. el8 appstream 315 k OpenEXR-devel x86_64 2.2.0-12.el8 powertools 85 k OpenEXR-libs x86_64 2.2.0-12.el8 appstream 671 k adobe-mappings-cmap noarch 20171205-3.el8 appstream 2.1 M adobe-mappings- cmap-deprecated noarch 20171205-3.el8 appstream 118 k adobe-mappings-pdf noarch 20180407-1.el8 appstream 706 k atk x86_64 2.28.1-1.el8 appstream 271 k avahi-libs x86_64 0.7-20.el8 baseos 61 k ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ Installing weak dependencies: ImageMagick7-djvu x86_64 1:7.1.1.15-1.el8.remi remi 66 k open-sans-fonts noarch 1.10-6.el8 appstream 482 k Enabling module streams: nginx 1.14 php 7.2 Transaction Summary ======================================== ================================================== ========================= Install 142 Packages Total download size: 51 M Installed size: 155 M

If the version is displayed, the installation is complete.

magick --version Version: ImageMagick 7.1.1-15 Q16-HDRI x86_64 21298 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(4.5) Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zip zlib Compiler: gcc ( 8.5)

Installing Imagick


If this is done as is, a dependency error will occur, so install the necessary packages in advance.

dnf install --enablerepo=remi php-pear php-devel

Verify that the pecl command is recognized

which pecl /usr/bin/pecl

Install with pecl.
Press Enter at the " Please provide the prefix of ImageMagick installation

pecl install imagick downloading imagick-3.7.0.tgz ... Starting to download imagick-3.7.0.tgz (360,138 bytes) ...................... ................................................... .done: 360,138 bytes 33 source files, building running: phpize Configuring for: PHP Api Version: 20170718 Zend Module Api No: 20170718 Zend Extension Api No: 320170718 Please provide the prefix of ImageMagick installation [autodetect] :

When the installation is complete, the message says " You should add "extension=imagick.so" to php.ini ", so add the following to the bottom of php.ini.

# Add ↓ to php.ini [PECL] extension=imagick.so

Restart Apache and PHP-FPM

systemctl restart httpd systemctl restart php-fpm.service

After restarting, install additional PHP packages, and if they appear in the PHP module, it's ok.

dnf install php81-php-pecl-imagick-im7 php -m | grep imagick imagick

Additionally, you can check the current policy using the following command.

magick -list policy Path: /etc/ImageMagick-7/policy.xml Policy: Undefined rights: None Policy: Delegate rights: None pattern: * Policy: Filter rights: None pattern: * Policy: Coder rights: None pattern: * Policy : Coder rights: Read Write pattern: {PNG,JPEG,JPG,GIF,WEBP} Path: [built-in] Policy: Undefined rights: None

complete

If you found this article helpful , please give it a like!
13
Loading...
13 votes, average: 1.00 / 113
5,603
X facebook Hatena Bookmark pocket
[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

The person who wrote this article

About the author

Kawa Ken


A curious Poke○n who belongs to the System Solution Department.