0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

MariaDB と PHP をアップデートしてみた

0
Posted at

はじめに

以前に書いたように、MariaDB 本家のリポジトリから入れた MariaDB 10.5 が dnf update できなくなってしまった。

また、remi から入れた PHP 7.4 を使っていたが、PHP 8.2 を使いたい事情が出てきた。

新しくサーバを OS からインストールし直すのではなく、既存のサーバをアップデートすることにした。

アップデートの手順

Before After
OS AlmaLinux OS 8 <-
MariaDB MariaDB repository 10.5 AppStream 10.11
PHP Remi 7.4 AppStream 8.2

MariaDB の入れ替え

まずは念のためバックアップする

mysqldump -u root -p --all-databases > all_databases.sql

停止する

sudo systemctl status mariadb
sudo systemctl disable mariadb
sudo systemctl stop mariadb

設定を控えておく

  • /etc/my.cnf
  • /etc/my.cnf.d/*

アンインストールする

sudo dnf remove MariaDB-devel MariaDB-server MariaDB-shared MariaDB-common MariaDB-client

使用する mariadb を変更する

dnf module list mariadb
sudo dnf module reset mariadb
dnf module list mariadb
sudo dnf module enable mariadb:10.11
dnf module list mariadb

インストールする

sudo dnf install mariadb mariadb-server mariadb-devel

起動する

sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo systemctl status mariadb

アップグレード処理をする

sudo mariadb-upgrade -u root -p

設定を見直す

  • /etc/my.cnf
  • /etc/my.cnf.d/*

再起動する

sudo systemctl restart mariadb

PHP の入れ替え

設定を控えておく

  • /etc/php.ini

アンインストールする

sudo dnf remove php\*

使用する PHP を切り替える

dnf module list php
sudo dnf module reset php
dnf module list php
sudo dnf module enable php:8.2
dnf module list php

インストールする

sudo dnf install php php-pgsql php-mysqlnd php-intl php-mbstring php-json php-opcache php-zip php-devel composer php-pear

sudo pecl install imagick
sudo bash -c 'echo "extension=imagick" > /etc/php.d/40-imagick.ini'

※composer は remi から入る模様

設定を見直す

  • /etc/php.ini

再起動する

sudo systemctl restart httpd

まとめ

module を使って切り替えれば、意外と簡単にできることがわかった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?