以前、CentOS 8にImageMagickをインストールしましたが、今回はRed Hat® Enterprise Linux® 8にインストールしてみました。
RHEL8/CentOS8ではImageMagickパッケージは削除されましたので、今回もソースから導入してみます。
環境
・Red Hat Enterprise Linux release 8.2 (Ootpa)
・Kernel 4.18.0-193.14.3.el8_2.x86_64
・Red Hat Developer Subscription
- 開発環境のインストール
- ソースのダウンロード
- 解凍
- ./configure
- make
- make install
- 確認
- PHP拡張
- phpに組み込み
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
[root@rhel8 ~]# dnf grouplist Updating Subscription Management repositories. Available Environment Groups: Server with GUI Server Workstation Virtualization Host Custom Operating System Installed Environment Groups: Minimal Install Available Groups: RPM Development Tools Container Management .NET Core Development Graphical Administration Tools Network Servers Headless Management Scientific Support Smart Card Support System Tools Development Tools Security Tools Legacy UNIX Compatibility [root@rhel8 ~]# dnf groupinstall 'Development Tools' |
1 2 3 4 5 6 7 8 9 10 11 |
[root@rhel8 ~]# wget https://www.imagemagick.org/download/ImageMagick.tar.gz --2020-08-06 11:44:25-- https://www.imagemagick.org/download/ImageMagick.tar.gz Resolving www.imagemagick.org (www.imagemagick.org)... 198.72.81.86 Connecting to www.imagemagick.org (www.imagemagick.org)|198.72.81.86|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 14056516 (13M) [application/x-gzip] Saving to: 'ImageMagick.tar.gz' ImageMagick.tar.gz 100%[===================>] 13.41M 6.98MB/s in 1.9s 2020-08-06 11:44:27 (6.98 MB/s) - 'ImageMagick.tar.gz' saved [14056516/14056516] |
1 2 3 4 5 6 7 8 |
[root@rhel8 ~]# tar xvfz ImageMagick.tar.gz ImageMagick-7.0.10-25/ ImageMagick-7.0.10-25/Install-unix.txt ImageMagick-7.0.10-25/ChangeLog ImageMagick-7.0.10-25/winpath.sh ImageMagick-7.0.10-25/index.html ImageMagick-7.0.10-25/NOTICE (snip) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
[root@rhel8 ~]# cd ImageMagick-7.0.10-25/ [root@rhel8 ImageMagick-7.0.10-25]# ./configure checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk (snip) configure: ============================================================================== ImageMagick 7.0.10-25 is configured as follows. Please verify that this configuration matches your expectations. Host system type: x86_64-pc-linux-gnu Build system type: x86_64-pc-linux-gnu Option Value ------------------------------------------------------------------------------ Shared libraries --enable-shared=yes yes Static libraries --enable-static=yes yes Build utilities --with-utilities=yes yes Module support --with-modules=no no GNU ld --with-gnu-ld=yes yes Quantum depth --with-quantum-depth=16 16 High Dynamic Range Imagery --enable-hdri=yes yes Install documentation: yes Memory allocation library: JEMalloc --with-jemalloc=no no TCMalloc --with-tcmalloc=no no UMem --with-umem=no no Delegate library configuration: BZLIB --with-bzlib=yes no Autotrace --with-autotrace=no no DJVU --with-djvu=yes no DPS --with-dps=yes no FFTW --with-fftw=yes no FLIF --with-flif=yes no FlashPIX --with-fpx=yes no FontConfig --with-fontconfig=yes no FreeType --with-freetype=yes no Ghostscript lib --with-gslib=no no Graphviz --with-gvc=yes no HEIC --with-heic=yes no JBIG --with-jbig=yes no JPEG v1 --with-jpeg=yes no JPEG XL --with-jxl=yes no LCMS --with-lcms=yes no LQR --with-lqr=yes no LTDL --with-ltdl=yes no LZMA --with-lzma=yes no Magick++ --with-magick-plus-plus=yes yes OpenEXR --with-openexr=yes no OpenJP2 --with-openjp2=yes no PANGO --with-pango=yes no PERL --with-perl=no no PNG --with-png=yes no RAQM --with-raqm=yes no RAW --with-raw=yes no RSVG --with-rsvg=no no TIFF --with-tiff=yes no WEBP --with-webp=yes no WMF --with-wmf=yes no X11 --with-x= no XML --with-xml=yes no ZLIB --with-zlib=yes no ZSTD --with-zstd=yes no Delegate program configuration: GhostPCL None pcl6 (unknown) GhostXPS None gxps (unknown) Ghostscript None gs (unknown) Font configuration: Apple fonts --with-apple-font-dir=default Dejavu fonts --with-dejavu-font-dir=default none Ghostscript fonts --with-gs-font-dir=default none URW-base35 fonts --with-urw-base35-font-dir=default /usr/share/fonts/urw-base35/ Windows fonts --with-windows-font-dir=default none X11 configuration: X_CFLAGS = X_PRE_LIBS = X_LIBS = X_EXTRA_LIBS = Options used to compile and link: PREFIX = /usr/local EXEC-PREFIX = /usr/local VERSION = 7.0.10 CC = gcc CFLAGS = -fopenmp -Wall -g -O2 -mtune=ivybridge -fexceptions -pthread -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 CPPFLAGS = -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 PCFLAGS = DEFS = -DHAVE_CONFIG_H LDFLAGS = LIBS = -lm -lpthread CXX = g++ CXXFLAGS = -g -O2 -pthread FEATURES = DPC HDRI Cipher OpenMP DELEGATES = mpeg ============================================================================== |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[root@rhel8 ImageMagick-7.0.10-25]# make make all-am make[1]: Entering directory '/root/ImageMagick-7.0.10-25' CC utilities/magick.o CC MagickCore/libMagickCore_7_Q16HDRI_la-accelerate.lo CC MagickCore/libMagickCore_7_Q16HDRI_la-animate.lo (snip) CC MagickCore/libMagickCore_7_Q16HDRI_la-draw.lo MagickCore/draw.c:1324:26: warning: 'DrawBoundingRectangles' defined but not used [-Wunused-function] static MagickBooleanType DrawBoundingRectangles(Image *image, ^~~~~~~~~~~~~~~~~~~~~~ CC MagickCore/libMagickCore_7_Q16HDRI_la-effect.lo (snip) CXX Magick++/lib/libMagick___7_Q16HDRI_la-TypeMetric.lo CXXLD Magick++/lib/libMagick++-7.Q16HDRI.la cp -f MagickCore/ImageMagick.pc MagickCore/ImageMagick-7.Q16HDRI.pc cp -f MagickCore/MagickCore.pc MagickCore/MagickCore-7.Q16HDRI.pc cp -f MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc cp -f Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc make[1]: Leaving directory '/root/ImageMagick-7.0.10-25' |
“MagickCore/draw.c:1324:26: warning: ‘DrawBoundingRectangles’ defined but not used [-Wunused-function]”が表示されましたが定義されているけど使われていないってことだと思うので、無視でいいかな。
1 2 3 4 5 6 7 8 |
[root@rhel8 ImageMagick-7.0.10-25]# make install make install-am make[1]: Entering directory '/root/ImageMagick-7.0.10-25' make[2]: Entering directory '/root/ImageMagick-7.0.10-25' (snip) /usr/bin/install -c -m 644 MagickCore/ImageMagick.pc MagickCore/MagickCore.pc MagickCore/ImageMagick-7.Q16HDRI.pc MagickCore/MagickCore-7.Q16HDRI.pc MagickWand/MagickWand.pc MagickWand/MagickWand-7.Q16HDRI.pc Magick++/lib/Magick++.pc Magick++/lib/Magick++-7.Q16HDRI.pc '/usr/local/lib/pkgconfig' make[2]: Leaving directory '/root/ImageMagick-7.0.10-25' make[1]: Leaving directory '/root/ImageMagick-7.0.10-25' |
1 2 3 4 5 6 7 8 9 |
[root@rhel8 ImageMagick-7.0.10-25]# which magick /usr/local/bin/magick [root@rhel8 ImageMagick-7.0.10-25]# magick -version Version: ImageMagick 7.0.10-25 Q16 x86_64 2020-08-07 https://imagemagick.org Copyright: c 1999-2020 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP(4.5) Delegates (built-in): |
phpから利用するためのモジュールをインストールします。
phpはdnf moduleで導入した7.3です。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
[root@rhel8 ~]# dnf -y install php-pear Updating Subscription Management repositories. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: php-pear noarch 1:1.10.9-1.module+el8.1.0+3189+a1bff096 rhel-8-for-x86_64-appstream-rpms 359 k Installing dependencies: php-process x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 84 k Transaction Summary ================================================================================ Install 2 Packages Total download size: 443 k Installed size: 2.2 M Downloading Packages: (1/2): php-pear-1.10.9-1.module+el8.1.0+3189+a1 629 kB/s | 359 kB 00:00 (2/2): php-process-7.3.5-5.module+el8.1.0+4560+ 147 kB/s | 84 kB 00:00 -------------------------------------------------------------------------------- Total 771 kB/s | 443 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : php-process-7.3.5-5.module+el8.1.0+4560+e0eee7d6.x86 1/2 Installing : php-pear-1:1.10.9-1.module+el8.1.0+3189+a1bff096.noa 2/2 Running scriptlet: php-pear-1:1.10.9-1.module+el8.1.0+3189+a1bff096.noa 2/2 Verifying : php-pear-1:1.10.9-1.module+el8.1.0+3189+a1bff096.noa 1/2 Verifying : php-process-7.3.5-5.module+el8.1.0+4560+e0eee7d6.x86 2/2 Installed products updated. Installed: php-pear-1:1.10.9-1.module+el8.1.0+3189+a1bff096.noarch php-process-7.3.5-5.module+el8.1.0+4560+e0eee7d6.x86_64 Complete! [root@rhel8 ~]# dnf -y install php-devel Updating Subscription Management repositories. Last metadata expiration check: 1:36:30 ago on Fri Aug 7 10:25:24 2020. Dependencies resolved. ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: php-devel x86_64 7.3.5-5.module+el8.1.0+4560+e0eee7d6 rhel-8-for-x86_64-appstream-rpms 735 k Installing dependencies: pcre2-devel x86_64 10.32-1.el8 rhel-8-for-x86_64-baseos-rpms 605 k pcre2-utf16 x86_64 10.32-1.el8 rhel-8-for-x86_64-baseos-rpms 229 k pcre2-utf32 x86_64 10.32-1.el8 rhel-8-for-x86_64-baseos-rpms 220 k Transaction Summary ================================================================================ Install 4 Packages Total download size: 1.7 M Installed size: 8.3 M Downloading Packages: (1/4): pcre2-devel-10.32-1.el8.x86_64.rpm 2.4 MB/s | 605 kB 00:00 (2/4): php-devel-7.3.5-5.module+el8.1.0+4560+e0 2.8 MB/s | 735 kB 00:00 (3/4): pcre2-utf16-10.32-1.el8.x86_64.rpm 886 kB/s | 229 kB 00:00 (4/4): pcre2-utf32-10.32-1.el8.x86_64.rpm 1.3 MB/s | 220 kB 00:00 -------------------------------------------------------------------------------- Total 4.1 MB/s | 1.7 MB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : pcre2-utf32-10.32-1.el8.x86_64 1/4 Installing : pcre2-utf16-10.32-1.el8.x86_64 2/4 Installing : pcre2-devel-10.32-1.el8.x86_64 3/4 Installing : php-devel-7.3.5-5.module+el8.1.0+4560+e0eee7d6.x86_6 4/4 Running scriptlet: php-devel-7.3.5-5.module+el8.1.0+4560+e0eee7d6.x86_6 4/4 Verifying : php-devel-7.3.5-5.module+el8.1.0+4560+e0eee7d6.x86_6 1/4 Verifying : pcre2-devel-10.32-1.el8.x86_64 2/4 Verifying : pcre2-utf16-10.32-1.el8.x86_64 3/4 Verifying : pcre2-utf32-10.32-1.el8.x86_64 4/4 Installed products updated. Installed: pcre2-devel-10.32-1.el8.x86_64 pcre2-utf16-10.32-1.el8.x86_64 pcre2-utf32-10.32-1.el8.x86_64 php-devel-7.3.5-5.module+el8.1.0+4560+e0eee7d6.x86_64 Complete! [root@rhel8 ~]# pecl install imagick WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update downloading imagick-3.4.4.tgz ... Starting to download imagick-3.4.4.tgz (253,434 bytes) .....................................................done: 253,434 bytes 19 source files, building running: phpize Configuring for: PHP Api Version: 20180731 Zend Module Api No: 20180731 Zend Extension Api No: 320180731 Please provide the prefix of ImageMagick installation [autodetect] : building in /var/tmp/pear-build-root7Z7GRF/imagick-3.4.4 (snip) Build process completed successfully Installing '/usr/lib64/php/modules/imagick.so' Installing '/usr/include/php/ext/imagick/php_imagick_shared.h' install ok: channel://pecl.php.net/imagick-3.4.4 configuration option "php_ini" is not set to php.ini location You should add "extension=imagick.so" to php.ini |
1 2 3 4 5 6 7 8 9 10 |
[root@rhel8 ~]# echo extension=imagick.so > /etc/php.d/30-imagick.ini [root@rhel8 ~]# php -i | grep imagick /etc/php.d/30-imagick.ini, imagick imagick module => enabled imagick module version => 3.4.4 imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator, ImagickKernel imagick.locale_fix => 0 => 0 imagick.progress_monitor => 0 => 0 imagick.skip_version_check => 0 => 0 |