はじめに
本記事では、AlmaLinux 10.2を使用して、WordPressサーバを構築する方法について記載いたします。公開済みページを試行錯誤しながら変更することはなかなか難しいと思います。実際に表示されるページを確認しながらデザインなどを試行錯誤できるWordPressサーバ環境を構築する方法について記載いたします。
環境
・OS
AlmaLinux 10.2
・Apache
Apache 2.4.63(php-fpmを使用)
・PHP
PHP 8.5.12(PHP脆弱性対応済みバージョン)
・MariaDB
MariaDB 13.0(Community版)
・WordPress
WordPress 7.1.4(2026年11月12日時点での最新バージョン)
ドキュメントルート「/var/www/html/」配下にWordPressのファイルを配置
事前準備
はじめに、WordPressを動作させるための実行環境(LAMP環境)を構築します。
LAMP環境とは、Linux OSに、Apache、MariaDBやMySQL、PHPがインストールされている環境のことです。
頭文字を取って、LAMPと言います。
OSのアップデート
Almalinux の標準リポジトリを使用して、OSをアップグレードします。
[maint@almalinux10-2 ~]$ sudo dnf upgrade
SELinuxの無効化
ここでは、SELinuxを無効化します。
[maint@almalinux10-2 ~]$ sudo vi /etc/selinux/config
【編集内容】
#SELINUX=enforcing <= コメントアウト
SELINUX=disabled <= 追記
[maint@almalinux10-2 ~]$
再起動
アップグレードした各種モジュールやSELinuxの無効化を反映するため再起動します。
[maint@almalinux10-2 ~]$ sudo reboot
Apache2 Web Serverのインストール
AlmaLinux標準リポジトリを使用して、Apache2 Web Serverをインストールします。
[maint@almalinux10-2 ~]$ dnf list | grep httpd
~(省略)~
httpd.x86_64 2.4.63-13.el10_2.8 appstream
~(省略)~
[maint@almalinux10-2 ~]$ sudo dnf install httpd.x86_64
インストールしたApache2 Web Serverのバージョンを確認します。
[maint@almalinux10-2 ~]$ httpd -v
Server version: Apache/2.4.63 (AlmaLinux)
Server built: Oct 14 2026 00:00:00
[maint@almalinux10-2 ~]$
Apache2 Web Serverの設定
ServerNameディレクティブの設定
Apache2 Web Serverをインストールした直後のデフォルト設定では、「ServerName」ディレクティブが設定されていません。「/etc/httpd/conf/httpd.conf」ファイルを編集し、「ServerName」ディレクティブにサーバ名を記載します。
ここでは、サーバ名を「www.ingenious.jp」とします。記載するサーバ名は、ご使用の環境に応じて、適宜置き換えてください。
[maint@almalinux10-2 ~]$ sudo vi /etc/httpd/conf/httpd.conf
【記載内容】
#ServerName www.example.com:80
ServerName www.ingenious.jp:80 <-- 追記:サーバ名を記載
[maint@almalinux10-2 ~]$
DirectoryIndexディレクティブの設定変更
デフォルト設定では、Webブラウザからのリクエストが、ディレクトリだった場合やファイルが指定されなかった場合(最後が「/」で終る)に「index.html」ファイルが返される設定になっています。このため、WordPressのトップページである「index.php」ファイルが返されるように、設定変更を行います。以下のとおり、「/etc/httpd/conf/httpd.conf」ファイルを編集し、WordPressのトップページである「index.php」ファイルが最初に返されるように設定変更を行います。
[maint@almalinux10-2 ~]$ sudo vi /etc/httpd/conf/httpd.conf
【変更内容】
<IfModule dir_module>
# DirectoryIndex index.html <-- コメントアウト
DirectoryIndex index.php index.html <-- index.phpを先頭に追加
</IfModule>
[maint@almalinux10-2 ~]$
【参考】
DirectoryIndexディレクティブに記載した順にファイルが返されます。
AllowOverrideの設定変更
デフォルト設定状態では、WordPressのファイルを配置するドキュメントルート「/var/www/html」配下の「.htaccess」ファイルに記載されているディレクティブは、すべて使用できないように無効化されています。このため、「.htaccess」ファイルに記述したディレクティブを使用できるように、以下のように「/etc/httpd/conf/httpd.conf」ファイルを編集する必要があります。
併せて、「index.php」が見つからなった場合に「/var/www/html」配下のディレクトリやファイルが一覧表示されないように変更します。
[maint@almalinux10-2 ~]$ sudo vi /etc/httpd/conf/httpd.conf
【編集内容】
# Further relax access to the default document root:
<Directory "/var/www/html">
#Options Indexes FollowSymLinks <-- コメントアウト
Options FollowSymLinks <-- 「Indexes」を削除
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None <-- コメントアウト
AllowOverride All <-- 「All」に変更
Require all granted
</Directory>
[maint@almalinux10-2 ~]$
【参考】
「.htaccess」ファイルは、WordPressのファイルを配置したトップディレクトリに存在します。
本記事では、ドキュメントルート「/var/www/html/」ディレクトリに存在します。
【参考】
Optionsは、任意のディレクトリに対して使用できる機能を設定するためのディレクティブです。
| Indexes | ディレクトリに対するリクエストに対して、DirectoryIndexで指定したファイル (index.php等)が存在しない場合に、ディレクトリ内ファイルの一覧を表示します。 |
| FollowSymLinks | シンボリックリンクのリンク先を参照できるようにします。 |
【参考】
AllowOverrideは、「.htaccess」ファイルで使用できるディレクティブを指定するためのディレクティブです。
| None | 「.htaccess」ファイルでは、すべてのディレクティブが使用できません。 |
| All | 「.htaccess」ファイルで記述可能なディレクティブをすべて使用できます。 |
Rewriteモジュールの有効化
WordPressでは、「.htaccess」ファイルに記載されているRewriteRuleに基づき、パーマリンクを実現しています。このため、Rewriteモジュールを有効化する必要があります。
【参考】
「.htaccess」ファイルは、ディレクトリ単位で制御を行う設定ファイルです。「.htaccess」ファイルを特定のディレクトリに配置すると、「.htaccess」ファイル内に記述されている設定内容が、配置されたディレクトリ内とその配下のディレクトリ内に対して適用されます。
Rewriteモジュールの状態は、以下のコマンドにより確認することができます。
[maint@almalinux10-2 ~]$ httpd -M | grep rewrite
rewrite_module (shared)
[maint@almalinux10-2 ~]$
※有効化されている場合、上記のように「rewrite_module (shared)」と表示されます。
【注意】
Rewriteモジュールが無効化されている状態で、投稿記事を作成し「下書き保存」や「公開」しようとすると、「更新に失敗しました。返答が正しいJSONレスポンスではありません。」と表示され、投稿記事を保存することができません。
また、既存の記事を閲覧しようとすると、「404 Not Found」と表示され閲覧ができません。
これらは、パーマリンクが適切に書き換えられないためです。
httpdサービスの有効化
httpdサービスを有効化し起動します。
[maint@almalinux10-2 ~]$ sudo systemctl enable httpd.service
Created symlink '/etc/systemd/system/multi-user.target.wants/httpd.service' → '/usr/lib/systemd/system/httpd.service'.
[maint@almalinux10-2 ~]$
[maint@almalinux10-2 ~]$ sudo systemctl start httpd.service
[maint@almalinux10-2 ~]$ sudo systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
Active: active (running) since Wed 2026-11-11 21:14:12 JST; 2s ago
Invocation: 673a8367dcc74a408241e6958149f5ff
Docs: man:httpd.service(8)
Main PID: 5672 (httpd)
Status: "Started, listening on: port 80"
Tasks: 177 (limit: 22790)
Memory: 13.4M (peak: 13.7M)
CPU: 43ms
CGroup: /system.slice/httpd.service
├─5672 /usr/sbin/httpd -DFOREGROUND
├─5673 /usr/sbin/httpd -DFOREGROUND
├─5674 /usr/sbin/httpd -DFOREGROUND
├─5675 /usr/sbin/httpd -DFOREGROUND
└─5676 /usr/sbin/httpd -DFOREGROUND
11月 11 21:14:12 almalinux10-2.ingenious.jp systemd[1]: Starting httpd.service - The Apache HTTP Server...
11月 11 21:14:12 almalinux10-2.ingenious.jp (httpd)[5672]: httpd.service: Referenced but unset environment variable evaluates to an empty string: OPTIONS
11月 11 21:14:12 almalinux10-2.ingenious.jp httpd[5672]: Server configured, listening on: port 80
11月 11 21:14:12 almalinux10-2.ingenious.jp systemd[1]: Started httpd.service - The Apache HTTP Server.
[maint@almalinux10-2 ~]$
PHPのインストール
PHP 8.5は、AlmaLinux標準リポジトリでは提供されていないため、ここでは、RemiリポジトリからPHP 8.5をインストールします。
【参考】
EPELは、Extra Packages for Enterprise Linuxの略で、エンタープライズLinux用の高品質な追加パッケージセットが含まれているリポジトリです。Red Hat Enterprise Linux (RHEL)、CentOS、Scientific Linux (SL)、Oracle Linux (OL)、AlmaLinux (AL)、および Rocky Linux (RL)などで使用することができますが、これらに限定されるものではありません。
注意が必要なことは、標準のリポジトリで提供されていないモジュールを使用することができますが、Red Hat社などからのサポートはなく、「自己責任のもとで使用」する必要があります。
詳細は、以下の公式ホームページに記載されていますのでご確認ください。
【参考】
Remiリポジトリは、Remi Collect氏が提供しているリポジトリで、様々なPHPバージョンのパッケージが提供されています。FedoraやEnterprise Linux(RHEL、CentOS、Oracle、Scientific Linux など) で使用できる最新バージョンのPHPスタックやその他のソフトウェアが提供されています。EPELリポジトリと同様に、「自己責任のもとで使用」する必要があります。
詳細は、以下の公式ホームページに記載されていますのでご確認ください。
Remi Repository
【注意】
Remiリポジトリを使用するためには、事前にEPELリポジトリを追加する必要があります。
EPELリポジトリ、Remiリポジトリの追加
EPELリポジトリを追加します。
[maint@almalinux10-2 ~]$ sudo dnf install epel-release-10-6.el10.noarch
Remiリポジトリを追加します。
[maint@almalinux10-2 ~]$ sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-10.rpm
EPELリポジトリおよびRemiリポジトリが追加されていることを確認します。
[maint@almalinux10-2 ~]$ dnf repolist
repo id repo の名前
appstream AlmaLinux 10 - AppStream
baseos AlmaLinux 10 - BaseOS
crb AlmaLinux 10 - CRB
epel Extra Packages for Enterprise Linux 10 - x86_64
extras AlmaLinux 10 - Extras
remi-modular Remi's Modular repository for Enterprise Linux 10 - x86_64
remi-safe Safe Remi's RPM repository for Enterprise Linux 10 - x86_64
[maint@almalinux10-2 ~]$
提供されているPHPバージョンの確認
Remiリポジトリで提供されているPHPモジュールストリームを確認します。
[maint@almalinux10-2 ~]$ dnf module list php
WARNING: modularity is deprecated, and functionality will be removed in a future release of DNF5.
Remi's Modular repository for Enterprise Linux 10 - x86_64
Name Stream Profiles Summary
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language
php remi-8.2 common [d], devel, minimal PHP scripting language
php remi-8.3 common [d], devel, minimal PHP scripting language
php remi-8.4 common [d], devel, minimal PHP scripting language
php remi-8.5 common [d], devel, minimal PHP scripting language
php remi-8.6 common [d], devel, minimal PHP scripting language
ヒント: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[maint@almalinux10-2 ~]$
PHPモジュールストリームの切り替え
PHPのインストールで使用するPHPモジュールのストリーム(バージョン)を切り替えます。
切り替えた後は、PHPモジュールのストリーム(バージョン)を指定することなく、指定したPHPモジュールのストリーム(バージョン)から各種モジュールをインストールすることができます。
ここでは、PHPモジュールの「remi-8.5」ストリームを使用します。
[maint@almalinux10-2 ~]$ sudo dnf module reset php <-- 現在の設定をリセット
WARNING: modularity is deprecated, and functionality will be removed in a future release of DNF5.
Remi's Modular repository for Enterprise Linux 10 - x86_64 117 kB/s | 339 kB 00:02
Safe Remi's RPM repository for Enterprise Linux 10 - x86_64 170 kB/s | 570 kB 00:03
依存関係が解決しました。
行うべきことはありません。
完了しました!
[maint@almalinux10-2 ~]$
[maint@almalinux10-2 ~]$ sudo dnf module enable php:remi-8.5 <-- 「remi-8.5」を指定
WARNING: modularity is deprecated, and functionality will be removed in a future release of DNF5.
メタデータの期限切れの最終確認: 0:01:21 前の 2026年11月11日 21時26分43秒 に実施しました。
依存関係が解決しました。
===============================================================================================
パッケージ アーキテクチャー バージョン リポジトリー サイズ
===============================================================================================
モジュールストリームの有効化中:
php remi-8.5
トランザクションの概要
===============================================================================================
これでよろしいですか? [y/N]: y
完了しました!
[maint@almalinux10-2 ~]$
確認
「remi-8.5」が有効化されていることを確認します。
[maint@almalinux10-2 ~]$ dnf module list php
WARNING: modularity is deprecated, and functionality will be removed in a future release of DNF5.
メタデータの期限切れの最終確認: 0:09:41 前の 2026年11月11日 21時22分35秒 に実施しました。
Remi's Modular repository for Enterprise Linux 10 - x86_64
Name Stream Profiles Summary
php remi-7.4 common [d], devel, minimal PHP scripting language
php remi-8.0 common [d], devel, minimal PHP scripting language
php remi-8.1 common [d], devel, minimal PHP scripting language
php remi-8.2 common [d], devel, minimal PHP scripting language
php remi-8.3 common [d], devel, minimal PHP scripting language
php remi-8.4 common [d], devel, minimal PHP scripting language
php remi-8.5 [e] common [d], devel, minimal PHP scripting language
php remi-8.6 common [d], devel, minimal PHP scripting language
ヒント: [d]efault, [e]nabled, [x]disabled, [i]nstalled
[maint@almalinux10-2 ~]$
PHPのインストール
PHP 8.5をインストールします。以下のように「php」と記載するだけで、前項で指定したPHPモジュールストリームからPHP 8.5がインストールされます。
[maint@almalinux10-2 ~]$ sudo dnf install php
PHP 8.5がインストールされたことを確認します。
[maint@almalinux10-2 ~]$ php -v
PHP 8.5.12 (cli) (built: Oct 19 2026 17:02:46) (NTS gcc x86_64)
Copyright (c) The PHP Group
Built by Remi's RPM repository <https://rpms.remirepo.net/> #StandWithUkraine #NoAI
Zend Engine v4.5.12, Copyright (c) Zend Technologies
with Zend OPcache v8.5.12, Copyright (c), by Zend Technologies
[maint@almalinux10-2 ~]$
必要なライブラリやPHPモジュールのインストール
WordPressを稼働させるために必要なライブラリモジュールやPHPモジュールをインストールします。
ここでは、以下のシェルを作成し、インストールを行います。
#!/usr/bin/bash
MODULE_LIST=(libdhash libcurl libxml2 libexif php-pecl-igbinary php-pecl-imagick libicu php-intl php-mbstring openssl php-xml libzip php-pecl-zip php-pecl-apcu libmemcached-awesome memcached php-pecl-memcached php-opcache php-phpiredis bc libsodium php-sodium php-mysqlnd)
for ((i=0; i<${#MODULE_LIST[@]}; i++))
do
echo "Install Module: ${MODULE_LIST[$i]}"
dnf install -y ${MODULE_LIST[$i]} &> /dev/null
RTN_CODE=$?
if [ ${RTN_CODE} -ne 0 ]; then
echo "Failed to install module: ${MODULE_LIST[$i]}"
fi
done
【参考】
WordPressの要件は、公式ホームページの「Server Environment」に記載されていますので、ご参照下さい。
PHPの設定
「/etc/php.ini」ファイルを以下のとおり変更します。
[maint@almalinux10-2 ~]$ sudo vi /etc/php.ini
【変更内容】
[mbstring]
; language for internal character representation.
; This affects mb_send_mail() and mbstring.detect_order.
; https://php.net/mbstring.language
;mbstring.language = Japanese
mbstring.language = Japanese <-- Japaneseに設定
; Maximum amount of memory a script may consume
; https://php.net/memory-limit
memory_limit = 128M <-- 128MBに設定
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; https://php.net/post-max-size
;post_max_size = 8M <-- コメントアウト
post_max_size = 40M <-- 追記:40MBに設定
; Maximum allowed size for uploaded files.
; https://php.net/upload-max-filesize
;upload_max_filesize = 2M <-- コメントアウト
upload_max_filesize = 30M <-- 追記:30MBに設定
[maint@almalinux10-2 ~]$
「memory_limit」、「post_max_size」、「upload_max_filesize」の初期の設定値では、サイズの大きなテーマをアップロードした場合にエラーになる場合があります。このため、設定変更を行います。各設定値は、「memory_limit」の数値が一番大きく、続いて、「post_max_size」の数値、そして、「upload_max_filesize」が一番小さい数値になるよう調整する必要があります。
php-fpmのインストール
「php-fpm」は、自動的にインストールされますが、念のため、「php-fpm」がインストールされていることを確認します。
[maint@almalinux10-2 ~]$ systemctl status php-fpm.service
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; preset: disabled)
Active: active (running) since Wed 2026-11-11 22:30:54 JST; 4min 42s ago
Invocation: 64c92e33e66b444ab6e939be39812619
Main PID: 1313 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0.00req/sec"
Tasks: 6 (limit: 22791)
Memory: 44.5M (peak: 44.8M)
CPU: 104ms
CGroup: /system.slice/php-fpm.service
├─1313 "php-fpm: master process (/etc/php-fpm.conf)"
├─1579 "php-fpm: pool www"
├─1582 "php-fpm: pool www"
├─1584 "php-fpm: pool www"
├─1586 "php-fpm: pool www"
└─1593 "php-fpm: pool www"
11月 11 22:30:54 almalinux10-2.ingenious.jp systemd[1]: Starting php-fpm.service - The PHP FastCGI Process Manager...
11月 11 22:30:54 almalinux10-2.ingenious.jp systemd[1]: Started php-fpm.service - The PHP FastCGI Process Manager.
[maint@almalinux10-2 ~]$
php-fpmは、FPM(FastCGI Process Manager)と言われるPHPのFastCGI実装のひとつです。
Firewalldの許可設定
Firewalldが「http」、「https」を許可するように設定します。
[maint@almalinux10-2 ~]$ sudo firewall-cmd --permanent --add-service=http
success
[maint@almalinux10-2 ~]$ sudo firewall-cmd --permanent --add-service=https
success
[maint@almalinux10-2 ~]$ sudo firewall-cmd --reload
PHPの動作確認
以下のテスト用ファイル「test.php」をドキュメントルート「/var/www/html」に作成し、PHPの動作確認を行います。
[maint@almalinux10-2 ~]$ sudo vi /var/www/html/test.php
【記載内容】
<?php
phpinfo();
?>
[maint@almalinux10-2 ~]$
Webブラウザを使用して、以下のURLにアクセスし、PHPの各種情報が表示されることを確認します。
「Server API」欄を確認し、「FPM/FastCGI」と記載されていれば、「php-fpm」が使用されています。
URL:http://<IPアドレスまたはドメイン名>/test.php

MariaDB Serverのインストール
MariaDB Serverのインストール
「MariaDB Server 13.0」は、Almalinux標準リポジトリでは提供されていないため、MariaDBリポジトリを使用してインストールします。
「/etc/yum.repos.d」ディレクトリに、「MariaDB.repo」レポジトリファイルを作成します。
※リポジトリファイルへの記載内容は、「MariaDB Foundation」公式サイトを参照してください。
[maint@almalinux10-2 ~]$ sudo vi /etc/yum.repos.d/MariaDB.repo
【記載内容】
# MariaDB 13.0 RedHatEnterpriseLinux repository list - created 2026-11-11 23:27 UTC
# https://mariadb.org/download/
[mariadb]
name = MariaDB
# rpm.mariadb.org is a dynamic mirror if your preferred mirror goes offline. See https://mariadb.org/mirrorbits/ for details.
# baseurl = https://rpm.mariadb.org/13.0/rhel/$releasever/$basearch
baseurl = https://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/yum/13.0/rhel/$releasever/$basearch
# gpgkey = https://rpm.mariadb.org/RPM-GPG-KEY-MariaDB
gpgkey = https://ftp.yz.yamagata-u.ac.jp/pub/dbms/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
[maint@almalinux10-2 ~]$
MariaDBリポジトリが追加されていることを確認します。
[maint@almalinux10-2 ~]$ sudo dnf repolist
repo id repo の名前
appstream AlmaLinux 10 - AppStream
baseos AlmaLinux 10 - BaseOS
crb AlmaLinux 10 - CRB
epel Extra Packages for Enterprise Linux 10 - x86_64
extras AlmaLinux 10 - Extras
mariadb MariaDB
remi-modular Remi's Modular repository for Enterprise Linux 10 - x86_64
remi-safe Safe Remi's RPM repository for Enterprise Linux 10 - x86_64
[maint@almalinux10-2 ~]$
「MariaDB Server」、「MariaDB Client」をインストールします。
[maint@almalinux10-2 ~]$ sudo dnf install MariaDB-server MariaDB-client
インストールされたMariaDB Serverのバージョンを確認します。
[maint@almalinux10-2 ~]$ mariadbd --version
mariadbd Ver 13.0.2-MariaDB for Linux on x86_64 (MariaDB Server)
[maint@almalinux10-2 ~]$
MariaDB Serverの初期設定
MariaDB Serverで使用する「文字セット」、「照合順序」を設定します。
[maint@almalinux10-2 ~]$ sudo vi /etc/my.cnf.d/server.cnf
【編集内容】
~(省略)~
# this is read by the standalone daemon and embedded servers
[server]
# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
character-set-server=utf8mb4 <-- 追記(文字セットの指定)
collation-server=utf8mb4_unicode_ci <-- 追記(照合順序の指定)
~(省略)~
[maint@almalinux10-2 ~]$
MariaDB Clientで使用する「デフォルト文字セット」を設定します。
[maint@almalinux10-2 ~]$ sudo vi /etc/my.cnf.d/client.cnf
【編集内容】
# This group is not read by mysql client library,
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]
default-character-set=utf8mb4 <-- 追記(デフォルト文字セットの指定)
[maint@almalinux10-2 ~]$
MariaDB Serverサービスの有効化と起動
MariaDB Serverサービスを有効化します。
[maint@almalinux10-2 ~]$ sudo systemctl enable mariadb.service
Created symlink '/etc/systemd/system/multi-user.target.wants/mariadb.service' → '/usr/lib/systemd/system/mariadb.service'.
[maint@almalinux10-2 ~]$
MariaDB Serverサービスを起動します。
[maint@almalinux10-2 ~]$ sudo systemctl start mariadb.service
[maint@almalinux10-2 ~]$ systemctl status mariadb.service
● mariadb.service - MariaDB 13.0.2 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled)
Drop-In: /etc/systemd/system/mariadb.service.d
└─migrated-from-my.cnf-settings.conf
Active: active (running) since Thu 2026-11-12 10:07:28 JST; 21s ago
Invocation: 2e4092a27e4b4f89b6109bd50d79e1e9
Docs: man:mariadbd(8)
https://mariadb.com/docs/server/server-management/starting-and-stopping-mariadb/systemd
Main PID: 6338 (mariadbd)
Status: "Taking your SQL requests now..."
Tasks: 13 (limit: 28203)
Memory: 122.7M (peak: 123M)
CPU: 502ms
CGroup: /system.slice/mariadb.service
└─6338 /usr/sbin/mariadbd
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] Plugin 'FEEDBACK' is disabled.
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] Plugin 'wsrep-provider' is disabled.
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] InnoDB: Buffer pool(s) load completed at 261112 10:07:28
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] Server socket created on IP: '0.0.0.0', port: '3306'.
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] Server socket created on IP: '::', port: '3306'.
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: 2026-11-12 10:07:28 0 [Note] /usr/sbin/mariadbd: ready for connections.
11月 12 10:07:28 almalinux10-2.ingenious.jp mariadbd[6338]: Version: '13.0.2-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
11月 12 10:07:28 almalinux10-2.ingenious.jp systemd[1]: Started mariadb.service - MariaDB 13.0.2 database server.
[maint@almalinux10-2 ~]$
MariaDB Serverのセキュリティ設定
「mariadb-secure-installation」スクリプトを使用して、MariaDB Serverのセキュリティ設定を行います。
[maint@almalinux10-2 ~]$ sudo mariadb-secure-installation
NOTE: MariaDB is secure by default. Running this script is mostly
unecessary and it will likely be removed in a future release,
but it is for now preserved for backwards compatibility.
Enter root user password or leave blank:
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
... skipping.
You already have your root account protected, so you can safely answer 'n'.
Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
Query OK, 2 rows affected
SQL executed without errors!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
Query OK, 0 rows affected
SQL executed without errors!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
Query OK, 0 rows affected
SQL executed without errors!
- Removing privileges on test database...
Query OK, 2 rows affected
SQL executed without errors!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[maint@almalinux10-2 ~]$
MariaDB Serverへの接続確認
「mariadb」コマンドを使用して、MariaDB Serverへ接続できることを確認します。
[maint@almalinux10-2 ~]$ mariadb -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 13.0.2-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)]> quit;
Bye
[maint@almalinux10-2 ~]$
WordPressのインストール
WordPressのダウンロード
公式ホームページから最新バージョンのWordPressパッケージをダウンロードします。
[maint@almalinux10-2 ~]$ wget https://ja.wordpress.org/latest-ja.tar.gz
「latest-ja.tar.gz」ファイルがダウンロードされます。
[maint@almalinux10-2 ~]$ ls -l
-rw-r--r-- 1 maint maint 36683156 10月 31 11:01 latest-ja.tar.gz
[maint@almalinux10-2 ~]$
ダウンロードしたファイル「latest-ja.tar.gz」を解凍します。
[maint@almalinux10-2 ~]$ tar zxvf latest-ja.tar.gz
以下のように「wordpress」というディレクトリが作成されます。
[maint@almalinux10-2 ~]$ ls -l
-rw-r--r-- 1 maint maint 36683156 10月 31 11:01 latest-ja.tar.gz
drwxr-xr-x 5 maint maint 4096 10月 31 11:00 wordpress
[maint@almalinux10-2 ~]$
WordPress用のデータベースおよびユーザーの作成
MariaDBコマンドを使用して、WordPress用で使用するデータベースを作成します。
ここでは、データベース名を「db_wordpress」、ユーザー名を「wp_user」、パスワードを「Password」とします。
[maint@almalinux10-2 ~]$ mariadb -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 13.0.2-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)]>
MariaDB [(none)]> CREATE DATABASE db_wordpress;
Query OK, 1 row affected (0.000 sec)
MariaDB [(none)]> CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'Password';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON db_wordpress.* TO 'wp_user'@'localhost';
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> quit;
Bye
[maint@almalinux10-2 ~]$
wp-config.phpファイルの作成
WordPressの設定は、「wp-config.php」設定ファイルを事前に作成する方法とインストールスクリプトを使用する方法がありますが、ここでは、インストール・スクリプトを使用して設定を行います。
WordPressのファイルのアップロード
ここでは、Apache2 Web Serverのドキュメントルート「/var/www/html/」に、WordPressファイルをアップロード(コピー)します。
[maint@almalinux10-2 ~]$ sudo cp -R ./wordpress/* /var/www/html/
[maint@almalinux10-2 ~]$
【注意】
アップロードするWordPressのファイルは、「wordpress」ディレクトリ自体ではなく、「wordpress」ディレクトリの内容です。
WordPressファイルの権限設定
Apache2 Web ServerのドキュメントルートにアップロードしたWordPressディレクトリおよびファイルのオーナーおよびパーミッション設定を行います。
■オーナー設定
[maint@almalinux10-2 ~]$ sudo chown -R apache:apache /var/www/
[maint@almalinux10-2 ~]$
■ディレクトリのパーミッション設定
[maint@almalinux10-2 ~]$ sudo find /var/www/ -type d -print | sudo xargs chmod 770
[maint@almalinux10-2 ~]$
■ファイルのパーミッション設定
[maint@almalinux10-2 ~]$ sudo find /var/www/ -type f -print | sudo xargs chmod 660
[maint@almalinux10-2 ~]$
WordPressの初期セットアップ
ここでは、「インストール・スクリプト」を使用して、初期セットアップを行います。
Webブラウザを使用して、以下のURLにアクセスします。
URL:http://<IPアドレスまたはドメイン名>/wp-admin/install.php
以下の画面が表示されますので、「さあ、始めましょう!」をクリックします。

以下の画面が表示されますので、「データベース名」、「ユーザー名」、「パスワード」、「データベースのホスト」の各入力欄に、先ほど作成したデータベース及びユーザーに関する情報を入力します。「テーブル接頭辞」は、特に理由がない限り、変更の必要はありません。
入力が完了したら、「送信」をクリックします。

以下の画面が表示されますので、「インストール実行」をクリックします。

以下の「ようこそ」という画面が表示されますので、WordPressサイトの設定情報を入力します。
ここでは、サイトのタイトルを「Ingenious」、ユーザー名を「wp-admin」、パスワードを「password」、メールアドレスを「wp-admin@example.co.jp」とします。
入力するサイトの設定情報は、適宜、環境に応じて入力してください。
入力が完了したら、「WordPressをインストール」をクリックします。
【注意】
ここで入力するユーザー名は、WordPressサイトの管理者のユーザー名です。
前項で作成したデータベースで使用するユーザー名とは異なりますので、注意してください。
【参考】
WordPressのテスト環境などの場合は、誤って検索エンジンにサイトがインデクスされないように、「検索エンジンがサイトをインデックスしないようにする」チェックを付けることをお勧めします。

以下の画面が表示されれば、WordPressのインストールは完了です。
「ログイン」をクリックします。

「ユーザー名」、「パスワード」を入力し、「ログイン」をクリックします。

以下のWordPressのダッシュボードの画面が表示されます。

以上で終了です。

