ヘルプ:CentOS 8.3 から AlmaLinuxへの移行

提供:あわ自由帳

メインページ > ヘルプ:目次 > ヘルプ:自宅サーバー構築(AlmaLinux)  > CentOS 8.3 から AlmaLinuxへの移行

  • 自宅サーバーで、動作確認しています。導入される方は自己責任で行ってください。
  • CentOS Linux release 8.3.2011 で、行っています。(2021/04/25)
  • Imagick 使えます。

環境

[root@host4 ~]# cat /etc/redhat-release
CentOS Linux release 8.3.2011

[root@host4 ~]# rpm -qa | grep -i centos
centos-linux-release-8.3-1.2011.el8.noarch
centos-logos-httpd-80.5-2.el8.noarch
centos-logos-80.5-2.el8.x86_64
centos-gpg-keys-8-2.el8.noarch
centos-linux-repos-8-2.el8.noarch

移行手順

移行スクリプトを入手

[root@host4 ~]# curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

実行権を与えて実行

[root@host4 ~]# chmod +x almalinux-deploy.sh

[root@host4 ~]# bash almalinux-deploy.sh
・
・
・

[root@host4 ~]# dnf distro-sync -y
・
・
・

再起動

[root@host4 ~]# reboot

切り替わったか確認

[root@host4 ~]# cat /etc/redhat-release
AlmaLinux release 8.3 (Purple Manul)

[root@host4 ~]# rpm -qa | grep -i almalinux
almalinux-release-8.3-4.el8.x86_64
almalinux-logos-httpd-81.2-1.el8.noarch
almalinux-logos-81.2-1.el8.x86_64

動作確認

Webサーバー

[root@host4 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           └─php-fpm.conf
   Active: active (running) since Sun 2021-04-25 20:26:27 JST; 6min ago
     Docs: man:httpd.service(8)
 Main PID: 1201 (httpd)
   Status: "Total requests: 1; Idle/Busy workers 100/0;Requests/sec: 0.00257; Bytes served/sec:   1 B/sec"
    Tasks: 213 (limit: 36136)
   Memory: 30.4M
   CGroup: /system.slice/httpd.service
           ├─1201 /usr/sbin/httpd -DFOREGROUND
           ├─1274 /usr/sbin/httpd -DFOREGROUND
           ├─1275 /usr/sbin/httpd -DFOREGROUND
           ├─1276 /usr/sbin/httpd -DFOREGROUND
           └─1277 /usr/sbin/httpd -DFOREGROUND

 4月 25 20:26:26 host4.sudachi.jp systemd[1]: Starting The Apache HTTP Server...
 4月 25 20:26:27 host4.sudachi.jp systemd[1]: Started The Apache HTTP Server.
 4月 25 20:26:27 host4.sudachi.jp httpd[1201]: Server configured, listening on: port 443, port 80

php-fpm

[root@host4 ~]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-04-25 20:26:27 JST; 8min ago
 Main PID: 1206 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 1, slow: 0, Traffic: 0req/sec"
    Tasks: 6 (limit: 36136)
   Memory: 46.9M
   CGroup: /system.slice/php-fpm.service
           ├─1206 php-fpm: master process (/etc/php-fpm.conf)
           ├─1501 php-fpm: pool www
           ├─1502 php-fpm: pool www
           ├─1503 php-fpm: pool www
           ├─1504 php-fpm: pool www
           └─1505 php-fpm: pool www

 4月 25 20:26:27 host4.sudachi.jp systemd[1]: Starting The PHP FastCGI Process Manager...
 4月 25 20:26:27 host4.sudachi.jp systemd[1]: Started The PHP FastCGI Process Manager.

phpアップデート

有効になっている PHP のバージョンを確認

[root@host4 ~]# dnf module list php
メタデータの期限切れの最終確認: 2:10:59 時間前の 2021年04月25日 18時26分19秒 に実施しました。
AlmaLinux 8 - AppStream
Name               Stream                     Profiles                                 Summary                            
php                7.2 [d]                    common [d], devel, minimal               PHP scripting language             
php                7.3                        common [d], devel, minimal               PHP scripting language             
php                7.4                        common [d], devel, minimal               PHP scripting language             

Remi's Modular repository for Enterprise Linux 8 - x86_64
Name               Stream                     Profiles                                 Summary                            
php                remi-7.2                   common [d], devel, minimal               PHP scripting language             
php                remi-7.3                   common [d], devel, minimal               PHP scripting language             
php                remi-7.4 [e]               common [d], devel, minimal               PHP scripting language             
php                remi-8.0                   common [d], devel, minimal               PHP scripting language             

ヒント: [d]efault, [e]nabled, [x]disabled, [i]nstalled

アップデート実行

[root@host4 ~]# dnf --enablerepo=epel,remi,remi-safe update php php-*
・
・

インストール済みパッケージ確認

[root@host4 ~]# rpm -qa | grep php
php-mysqlnd-7.4.16-1.el8.remi.x86_64
php-pear-1.10.12-5.el8.remi.noarch
php-fedora-autoloader-1.0.1-2.el8.remi.noarch
php-common-7.4.16-1.el8.remi.x86_64
php-sodium-7.4.16-1.el8.remi.x86_64
php-pecl-apcu-5.1.20-1.el8.remi.7.4.x86_64
php-xml-7.4.16-1.el8.remi.x86_64
php-process-7.4.16-1.el8.remi.x86_64
php-pecl-xdebug-2.9.8-1.el8.remi.7.4.x86_64
php-mbstring-7.4.16-1.el8.remi.x86_64
php-fpm-7.4.16-1.el8.remi.x86_64
php-gd-7.4.16-1.el8.remi.x86_64
php-json-7.4.16-1.el8.remi.x86_64
php-opcache-7.4.16-1.el8.remi.x86_64
php-7.4.16-1.el8.remi.x86_64
php-pecl-mcrypt-1.0.4-1.el8.remi.7.4.x86_64
php-gmp-7.4.16-1.el8.remi.x86_64
oniguruma5php-6.9.5+rev1-3.el8.remi.x86_64
php-cli-7.4.16-1.el8.remi.x86_64
php-devel-7.4.16-1.el8.remi.x86_64
php-pdo-7.4.16-1.el8.remi.x86_64

php-fpmの再起動

[root@host4 ~]# systemctl restart php-fpm

Webサーバー再起動

[root@host4 ~]# systemctl restart httpd

phpバージョン確認

[root@host4 ~]# php -v
PHP 7.3.21 (cli) (built: Aug  4 2020 08:06:20) ( NTS )
PHP 7.4.16 (cli) (built: Mar  2 2021 10:35:17) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
    with Xdebug v2.9.8, Copyright (c) 2002-2020, by Derick Rethans