LoginSignup
1
0

More than 1 year has passed since last update.

Amazon Linux 2 で Nginx, MariaDB, PHP7.2 から 7.4 にアップグレードする方法

Last updated at Posted at 2022-01-18

Concrete CMS をインストールしているサーバーで

  • PHP7.2.x or PHP7.3.x -> PHP7.4.x
  • MariaDB 5.5.x or 10.2.x -> 10.5.x
  • Nginx 1.12.x -> 1.16.x

にアップデートした時のコマンドメモです。

めっちゃくちゃざっくりです。

アップグレード元のバージョンが違ったり、レポジトリが違ったりあって、
いろんなケースの手順をまとめてます。

PHP+MySQL のサーバーに詳しい人しか参考にしないでください。

# PHP7.3 まであった Exntesion & 古い Concrete CMS でも使用していたが
# PHP7.4 では利用不可 & Concrete CMS 最新版では不要になるので削除
sudo yum remove php-pecl-mcrypt php-recode

# 旧バージョンの Amazon Linux Extra や MariaDB の公式レポジトリを Disable or 削除
sudo amazon-linux-extras disable nginx1.12
sudo amazon-linux-extras disable php7.2
sudo rm /etc/yum.repo.d/mariadb.repo

# MariaDB 公式から Amazon Linux Extra に変えるときは
# 大文字から子文字になるので一旦アンインストール。
# DB データは /var/lib に残ったのを確認
sudo yum remove MariaDB*

# 新バージョンのレポジトリを enable
sudo amazon-linux-extras enable nginx1
sudo amazon-linux-extras enable php7.4
sudo amazon-linux-extras enable mariadb10.5

# MariaDB を公式から移行するのであればインストールが必要
sudo yum install mariadb mariadb-devel mariadb-server

# 単純に yum update でアップデート。カーネルのアップデートとかもあるし
sudo yum update

# スタートアップ起動しているか確認
sudo systemctl is-enabled nginx
sudo systemctl is-enabled php-fpm
sudo systemctl is-enabled mariadb

#  (Nginx サーバーだったら) PHP キャッシュ・セッション系のオーナーが
# apache に変わるので Nginx に戻す
sudo chown -R nginx:nginx /var/lib/php

# Ngonx 1.12.x からのアップデートであれば、443 などの記述が
# ちょっと厳しくなっているので、Nginx Config を確認する。
sudo vi /etc/nginx/conf.d/XXXX

# 再起動
sudo reboot
1
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
1
0