Amazon Linux 2023 に WordPress をインストールする
Amazon Linux 2023 に WordPress をインストールする手順をメモしておきます。 Web サーバには Apache を利用します。
検証環境¶
対象 | バージョン |
---|---|
Amazon Linux | 2023.6.20250303 |
Apache | 2.4.62 |
MariaDB Server | 10.5.25 |
PHP | 8.3.16 |
必要ソフトウェアのインストール¶
WordPress の前提となるソフトウェアをインストールします。
dnf -y install \
httpd \
mariadb105-server \
php8.3 \
php8.3-common \
php8.3-fpm \
php8.3-gd \
php8.3-mbstring \
php8.3-mysqlnd \
php8.3-pdo
サービスを開始&自動開始設定します。
systemctl start httpd mariadb php-fpm
systemctl enable httpd mariadb php-fpm
念の為、サービスの状態を確認しておきます。
systemctl status httpd mariadb php-fpm
MariaDB の初期設定¶
MariaDB に WordPress 用の設定を行います。 mysql コマンドで MariaDB へ接続し、下記コマンドを実行します。
create database wordpress;
grant all privileges on wordpress.* to wpuser@localhost identified by 'wppass';
flush privileges;
exit;
実際の実行例は以下です。
# sudo mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.25-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> grant all privileges on wordpress.* to wpuser@localhost identified by 'wppass';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.000 sec)
MariaDB [(none)]> exit;
Bye
WordPress のインストール¶
最新版の WordPress をインストールします。
cd ~/
curl -LO https://ja.wordpress.org/latest-ja.zip
unzip latest-ja.zip
mv wordpress/* /var/www/html/
mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
chown -R apache:apache /var/www/html/
事前に MariaDB で設定した内容に合わせて設定ファイルを修正しておきます。
sed -i -e "s/database_name_here/wordpress/g" /var/www/html/wp-config.php
sed -i -e "s/username_here/wpuser/g" /var/www/html/wp-config.php
sed -i -e "s/password_here/wppass/g" /var/www/html/wp-config.php
WordPress の初回セットアップ¶
Web ブラウザで http://ADDRESS
へアクセスします。 事前に直接、WordPress の設定ファイルへ「データベース名」「ユーザ名」「パスワード」は設定してある為、サイト関連の情報のみ設定します。
サイトの情報を入力するだけで設定完了です。 ログイン
をクリックして WordPress の利用を開始します。