How to install ImageMagick on Rocky Linux 9.2
- 00:33 cat /etc/os-release
- 00:52 dnf install -y httpd php-fpm
- 01:28 systemctl enable --now httpd php-fpm
- 01:52 firewall-cmd --permanent --add-service=http
- 02:25 firewall-cmd --reload
- 02:48 dnf install -y epel-release
- 03:11 /usr/bin/crb enable
- 03:34 dnf makecache
- 04:10 dnf install -y ImageMagick ImageMagick-devel
- 04:54 Magick-config --version
- 05:11 dnf install -y php-devel php-pear make
- 06:21 pecl install imagick
- 07:18 echo "extension=imagick.so" > /etc/php.d/20-imagick.ini
- 07:58 systemctl restart httpd php-fpm
- 08:22 php -m | grep imagick
- 08:39 echo "" > /var/www/html/index.php
To install Imagick on Rocky Linux 9.2
Introduction:
ImageMagick, invoked from the command line as magick, is a free and open-source cross-platform software suite for displaying, creating, converting, modifying, and editing raster images. It also can read and write over 200 image file formats and is widely used in open-source applications.
Installation Steps:
Step 1: Check the OS version by using the below command
[root@Linuxhelp ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.2 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.2"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.2 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
SUPPORT_END="2032-05-31"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.2"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.2"
Step 2: Install Apache and PHP by using the below command
[root@Linuxhelp ~]# dnf install -y httpd php-fpm
Last metadata expiration check: 5:11:44 ago on Sunday 13 August 2023 11:04:49 PM.
Dependencies resolved.
=======================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================
Installing:
httpd x86_64 2.4.53-11.el9_2.5 appstream 47 k
php-fpm x86_64 8.0.27-1.el9_1 appstream 1.6 M
Installing dependencies:
apr x86_64 1.7.0-11.el9 appstream 123 k
apr-util x86_64 1.6.1-20.el9_2.1 appstream 94 k
apr-util-bdb x86_64 1.6.1-20.el9_2.1 appstream 12 k
apr-util-openssl x86_64 1.6.1-20.el9_2.1 appstream 14 k
mod_http2 x86_64 1.15.19-4.el9_2.4 appstream 149 k
mod_lua x86_64 2.4.53-11.el9_2.5 appstream 61 k
Transaction Summary
=======================================================================================================================
Install 14 Packages
Total download size: 4.2 M
Installed size: 22 M
Downloading Packages:
(1/14): httpd-tools-2.4.53-11.el9_2.5.x86_64.rpm 250 kB/s | 81 kB 00:00
(2/14): httpd-2.4.53-11.el9_2.5.x86_64.rpm 739 kB/s | 47 kB 00:00
(3/14): httpd-filesystem-2.4.53-11.el9_2.5.noarch.rpm 301 kB/s | 14 kB 00:00
(4/14): rocky-logos-httpd-90.14-1.el9.noarch.rpm 49 kB/s | 24 kB 00:00
(13/14): php-common-8.0.27-1.el9_1.x86_64.rpm 2.0 MB/s | 667 kB 00:00
(14/14): httpd-core-2.4.53-11.el9_2.5.x86_64.rpm 3.8 MB/s | 1.4 MB 00:00
-----------------------------------------------------------------------------------------------------------------------
Total 2.4 MB/s | 4.2 MB 00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : apr-1.7.0-11.el9.x86_64 1/14
Installing : apr-util-bdb-1.6.1-20.el9_2.1.x86_64 2/14
Installing : apr-util-1.6.1-20.el9_2.1.x86_64 3/14
Verifying : rocky-logos-httpd-90.14-1.el9.noarch 1/14
Verifying : mod_lua-2.4.53-11.el9_2.5.x86_64 2/14
Verifying : httpd-core-2.4.53-11.el9_2.5.x86_64 14/14
Installed:
httpd-2.4.53-11.el9_2.5.x86_64 httpd-core-2.4.53-11.el9_2.5.x86_64
httpd-filesystem-2.4.53-11.el9_2.5.noarch httpd-tools-2.4.53-11.el9_2.5.x86_64
mod_http2-1.15.19-4.el9_2.4.x86_64 mod_lua-2.4.53-11.el9_2.5.x86_64
nginx-filesystem-1:1.20.1-14.el9.noarch php-common-8.0.27-1.el9_1.x86_64
php-fpm-8.0.27-1.el9_1.x86_64 rocky-logos-httpd-90.14-1.el9.noarch
Complete!
Step 3: Enable and Start Apache and PHP services by using the below command
[root@Linuxhelp ~]# systemctl enable --now httpd php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@Linuxhelp ~]# systemctl start –now httpd php-fpm
Step 4: Allow HTTP service in Firewall and reload the firewall by using the below command
[root@Linuxhelp ~]# firewall-cmd --permanent --add-service=http
success
[root@Linuxhelp ~]# firewall-cmd --reload
success
Step 5: Install EPEL repository by using dnf command.
[root@Linuxhelp ~]# dnf install -y epel-release
Last metadata expiration check: 5:14:38 ago on Sunday 13 August 2023 11:04:49 PM.
Dependencies resolved.
=======================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================
Installing:
epel-release noarch 9-4.el9 extras 19 k
Transaction Summary
=======================================================================================================================
Install 1 Package
Total download size: 19 k
Installed size: 25 k
Downloading Packages:
epel-release-9-4.el9.noarch.rpm 58 kB/s | 19 kB 00:00
-----------------------------------------------------------------------------------------------------------------------
Total 19 kB/s | 19 kB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : epel-release-9-4.el9.noarch 1/1
Running scriptlet: epel-release-9-4.el9.noarch 1/1
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.
Verifying : epel-release-9-4.el9.noarch 1/1
Installed:
epel-release-9-4.el9.noarch
Complete!
Step 6: Additionally, we need to Enable the CRB repository by executing the below command.
[root@Linuxhelp ~]# /usr/bin/crb enable
Enabling CRB repo
CRB repo is enabled and named: crb
Step 7: Build the yum cache for newly installed yum repositories by using the below command.
[root@Linuxhelp ~]# dnf makecache
Extra Packages for Enterprise Linux 9 - x86_64 6.4 MB/s | 18 MB 00:02
Rocky Linux 9 - BaseOS 4.2 kB/s | 4.1 kB 00:00
Rocky Linux 9 - AppStream 5.9 kB/s | 4.5 kB 00:00
Rocky Linux 9 - CRB 1.5 MB/s | 2.2 MB 00:01
Rocky Linux 9 - Extras 2.9 kB/s | 2.9 kB 00:01
Metadata cache created.
Step 8: Install ImageMagick by using the below command.
[root@Linuxhelp ~]# dnf install -y ImageMagick ImageMagick-devel
Last metadata expiration check: 0:02:02 ago on Monday 14 August 2023 04:20:26 AM.
Dependencies resolved.
=======================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================
Installing:
ImageMagick x86_64 6.9.12.86-1.el9 epel 78 k
ImageMagick-devel x86_64 6.9.12.86-1.el9 epel 96 k
Installing dependencies:
ImageMagick-libs x86_64 6.9.12.86-1.el9 epel 2.3 M
LibRaw x86_64 0.20.2-5.el9 appstream 376 k
graphviz x86_64 2.44.0-25.el9 appstream 3.3 M
gtk2 x86_64 2.24.33-8.el9 appstream 3.5 M
Installing weak dependencies:
adwaita-gtk2-theme x86_64 3.28-14.el9 appstream 136 k
libcanberra-gtk2 x86_64 0.30-26.el9 appstream 25 k
Transaction Summary
=======================================================================================================================
Install 18 Packages
Total download size: 12 M
Installed size: 44 M
Downloading Packages:
(1/18): ImageMagick-6.9.12.86-1.el9.x86_64.rpm 151 kB/s | 78 kB 00:00
(2/18): ImageMagick-devel-6.9.12.86-1.el9.x86_64.rpm 167 kB/s | 96 kB 00:00
(3/18): liblqr-1-0.4.2-19.el9.x86_64.rpm 499 kB/s | 48 kB 00:00
(17/18): graphviz-2.44.0-25.el9.x86_64.rpm 4.2 MB/s | 3.3 MB 00:00
(18/18): gtk2-2.24.33-8.el9.x86_64.rpm 3.0 MB/s | 3.5 MB 00:01
-----------------------------------------------------------------------------------------------------------------------
Total 3.3 MB/s | 12 MB 00:03
Extra Packages for Enterprise Linux 9 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x3228467C:
Userid : "Fedora (epel9) <epel@fedoraproject.org>"
Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : imath-3.1.2-1.el9.x86_64 1/18
Installing : openexr-libs-3.1.1-2.el9.x86_64 2/18
Installing : libcanberra-gtk2-0.30-26.el9.x86_64 3/18
Installing : libwmf-lite-0.2.12-10.el9.x86_64 7/18
Verifying : libraqm-0.8.0-1.el9.x86_64 5/18
Verifying : libwmf-lite-0.2.12-10.el9.x86_64 18/18
Installed:
ImageMagick-6.9.12.86-1.el9.x86_64 ImageMagick-devel-6.9.12.86-1.el9.x86_64
ImageMagick-libs-6.9.12.86-1.el9.x86_64 LibRaw-0.20.2-5.el9.x86_64
libwmf-lite-0.2.12-10.el9.x86_64 mkfontscale-1.2.1-3.el9.x86_64
openexr-libs-3.1.1-2.el9.x86_64 xorg-x11-fonts-ISO8859-1-100dpi-7.5-33.el9.noarch
Complete!
Step 9: Check the installed version of ImageMagick by using the below command.
[root@Linuxhelp ~]# Magick-config --version
6.9.12-86 Q16
Step 10: Install PHP Imagick by using the below command
[root@Linuxhelp ~]# dnf install -y php-devel php-pear make
Last metadata expiration check: 0:03:19 ago on Monday 14 August 2023 04:20:26 AM.
Dependencies resolved.
=======================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================
Installing:
make x86_64 1:4.3-7.el9 baseos 530 k
php-devel x86_64 8.0.27-1.el9_1 appstream 657 k
php-pear noarch 1:1.10.13-1.el9 appstream 309 k
Installing dependencies:
autoconf noarch 2.69-38.el9 appstream 666 k
automake noarch 1.16.2-6.el9 appstream 662 k
cmake-filesystem x86_64 3.20.2-8.el9 appstream 11 k
gcc x86_64 11.3.1-4.3.el9 appstream 32 M
php-xml x86_64 8.0.27-1.el9_1 appstream 131 k
xz-devel x86_64 5.2.5-8.el9_0 appstream 52 k
zlib-devel x86_64 1.2.11-39.el9 appstream 44 k
Installing weak dependencies:
php-nikic-php-parser4 noarch 4.16.0-1.el9 epel 160 k
Transaction Summary
=======================================================================================================================
Install 38 Packages
Total download size: 65 M
Installed size: 189 M
Downloading Packages:
(1/38): php-fedora-autoloader-1.0.1-7.el9.noarch.rpm 37 kB/s | 12 kB 00:00
(2/38): php-nikic-php-parser4-4.16.0-1.el9.noarch.rpm 300 kB/s | 160 kB 00:00
(37/38): gcc-c++-11.3.1-4.3.el9.x86_64.rpm 4.7 MB/s | 13 MB 00:02
(38/38): gcc-11.3.1-4.3.el9.x86_64.rpm 6.8 MB/s | 32 MB 00:04
-----------------------------------------------------------------------------------------------------------------------
Total 6.6 MB/s | 65 MB 00:09
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : php-cli-8.0.27-1.el9_1.x86_64 1/38
Installing : zlib-devel-1.2.11-39.el9.x86_64 2/38
Installing : perl-File-Compare-1.100.600-480.el9.noarch 3/38
Installing : perl-File-Copy-2.34-480.el9.noarch 4/38
Installing : autoconf-2.69-38.el9.noarch 20/38
Running scriptlet: php-pear-1:1.10.13-1.el9.noarch 38/38
Verifying : php-fedora-autoloader-1.0.1-7.el9.noarch 1/38
Verifying : libselinux-devel-3.5-1.el9.x86_64 22/38
Verifying : gcc-11.3.1-4.3.el9.x86_64 36/38
Verifying : glibc-headers-2.34-60.el9.x86_64 37/38
Verifying : glibc-devel-2.34-60.el9.x86_64 38/38
Installed:
autoconf-2.69-38.el9.noarch automake-1.16.2-6.el9.noarch
cmake-filesystem-3.20.2-8.el9.x86_64 gcc-11.3.1-4.3.el9.x86_64
gcc-c++-11.3.1-4.3.el9.x86_64 glibc-devel-2.34-60.el9.x86_64
glibc-headers-2.34-60.el9.x86_64 kernel-headers-5.14.0-284.25.1.el9_2.x86_64
php-process-8.0.27-1.el9_1.x86_64 php-xml-8.0.27-1.el9_1.x86_64
xz-devel-5.2.5-8.el9_0.x86_64 zlib-devel-1.2.11-39.el9.x86_64
Complete!
Step 11: Install PHP Imagick by executing pecl command.
[root@Linuxhelp ~]# pecl install imagick
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
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: 20200930
Zend Module Api No: 20200930
checking for egrep... /usr/bin/grep -E
checking for icc... no
checking for suncc... no
checking for pkg-config... /usr/bin/pkg-config
checking PHP version is at least 5.3.2... yes. found 8.0.27
libs
-lMagickWand-6.Q16 -lMagickCore-6.Q16
checking for MagickGetVersion... yes
func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/sh /var/tmp/pear-build-rootA42524/imagick-3.7.0/libtool --mode=compile cc -I. -I/var/tmp/imagick -I/var/tmp/pear-build-rootA42524/imagick-3.7.0/include -I/var/tmp/pear-build-rootA42524/imagick-3.7.0/main -I/var/tmp/imagick -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/ImageMagick-6 -DHAVE_CONFIG_H -g -O2 -I/usr/include/ImageMagick-6 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -c /var/tmp/imagick/imagick_file.c -o imagick_file.lo
libtool: compile: cc -I. -I/var/tmp/imagick -I/var/tmp/pear-build-rootA42524/imagick-3.7.0/include -I/var/tmp/pear-build-rootA42524/imagick-3.7.0/main -I/var/tmp/imagick -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/ImageMagick-6 -DHAVE_CONFIG_H -g -O2 -I/usr/include/ImageMagick-6 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -c /var/tmp/imagick/imagick_class.c -fPIC -DPIC -o .libs/imagick_class.o
/var/tmp/imagick/imagick_class.c: In function ‘zim_Imagick_getImageMatte’:
/var/tmp/imagick/imagick_class.c:300:9: warning: ‘MagickGetImageMatte’ is deprecated [-Wdeprecated-declarations]
85 | MagickGetImageMatte(MagickWand *) magick_attribute((deprecated)),
| ^~~~~~~~~~~~~~~~~~~
/var/tmp/imagick/imagick_class.c: In function ‘zim_Imagick_paintFloodfillImage’:
/var/tmp/imagick/imagick_class.c:1330:17: warning: ‘MagickPaintFloodfillImage’ is deprecated [-Wdeprecated-declarations]
1330 | status = MagickPaintFloodfillImage(intern->magick_wand, channel, fill_wand, fuzz, NULL, x, y);
| ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:83,
from /var/tmp/imagick/php_imagick_defs.h:29,
from /var/tmp/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:102:3: note: declared here
102 | MagickPaintFloodfillImage(MagickWand *,const ChannelType,const PixelWand *,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/imagick/imagick_class.c:1338:17: warning: ‘MagickPaintFloodfillImage’ is deprecated [-Wdeprecated-declarations]
11421 | status = MagickRadialBlurImageChannel(intern->magick_wand, channel, angle);
| ^~~~~~
In file included from /usr/include/ImageMagick-6/wand/MagickWand.h:83,
from /var/tmp/imagick/php_imagick_defs.h:29,
from /var/tmp/imagick/imagick_class.c:22:
/usr/include/ImageMagick-6/wand/deprecate.h:114:3: note: declared here
114 | MagickRadialBlurImageChannel(MagickWand *,const ChannelType,const double)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/ImageMagick-6 -DHAVE_CONFIG_H -g -O2 -I/usr/include/ImageMagick-6 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 -c /var/tmp/imagick/imagickdraw_class.c -o imagickdraw_class.lo
libtool: link: ( cd ".libs" && rm -f "imagick.la" && ln -s "../imagick.la" "imagick.la" )
/bin/sh /var/tmp/pear-build-rootA42524/imagick-3.7.0/libtool --mode=install cp ./imagick.la /var/tmp/pear-build-rootA42524/imagick-3.7.0/modules
libtool: install: cp ./.libs/imagick.so /var/tmp/pear-build-rootA42524/imagick-3.7.0/modules/imagick.so
libtool: install: cp ./.libs/imagick.lai /var/tmp/pear-build-rootA42524/imagick-3.7.0/modules/imagick.la
libtool: finish: PATH="/root/.local/bin:/root/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/sbin" ldconfig -n /var/tmp/pear-build-rootA42524/imagick-3.7.0/modules
----------------------------------------------------------------------
Libraries have been installed in:
/var/tmp/pear-build-rootA42524/imagick-3.7.0/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the 'LD_RUN_PATH' environment variable
during linking
- use the '-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to '/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
running: make INSTALL_ROOT="/var/tmp/pear-build-rootA42524/install-imagick-3.7.0" install
Installing shared extensions: /var/tmp/pear-build-rootA42524/install-imagick-3.7.0/usr/lib64/php/modules/
Installing header files: /var/tmp/pear-build-rootA42524/install-imagick-3.7.0/usr/include/php/
running: find "/var/tmp/pear-build-rootA42524/install-imagick-3.7.0" | xargs ls -dils
52285052 0 drwxr-xr-x. 3 root root 17 Aug 14 04:26 /var/tmp/pear-build-rootA42524/install-imagick-3.7.0/usr/lib64
822194 0 drwxr-xr-x. 3 root root 21 Aug 14 04:26 /var/tmp/pear-build-rootA42524/install-imagick-3.7.0/usr/lib64/php
Build process completed successfully
Installing '/usr/lib64/php/modules/imagick.so'
configuration option "php_ini" is not set to php.ini location
You should add "extension=imagick.so" to php.ini
Step 11: Add the Imagick extension to php.ini file by using the below Command
[root@Linuxhelp ~]# echo "extension=imagick.so" > /etc/php.d/20-imagick.ini
Step 12: Restart Apache and PHP services to load Imagick module by using the below command
[root@Linuxhelp ~]# systemctl restart httpd php-fpm
Step 13: Execute the following command to verify that Imagick module is loaded successfully.
[root@Linuxhelp ~]# php -m | grep imagick
imagick
Step 14: Verify this by creating a phpinfo webpage
[root@Linuxhelp ~]# echo "<?php phpinfo ();?>" > /var/www/html/index.php
Step 15: Open web browser and search our server IP address as shown in the below image.
http://192.168.6.130
Step 16: Scroll down and will find the Imagick section as shown in the below image.
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to Install Imagick on Rocky Linux 9.2. Your feedback is much welcome.
Comments ( 0 )
No comments available