・AlmaLinux8 + Apache2 + MariaDB10 + PHP7.4 の環境にWordPressをインストールする方法を知りたい。
・具体的な手順を分かりやすく教えてほしい。
こういった疑問に答えます。
本記事の内容
- AlmaLinux8 + Apache2 + MariaDB10 + PHP7.4 の環境にWordPressをインストールする方法
この記事を書いている私は、某SIerに勤務しながら、
WEB系エンジニア・インフラエンジニアに憧れて、プログラミングおよびインフラ技術の勉強をしています。
こういった私が、解説していきます。
私が実機で試したコマンドや画像を載せて書いています。
記事の信頼性担保に繋がると思います。
AlmaLinux8 + Apache2 + MariaDB10 + PHP7.4 の環境にWordPressをインストールする方法
手順① 公式サイトからダウンロード
.tar.gz
ファイルをダウンロードします。
手順② WEBサーバ―に.tar.gzファイルアップロードして展開
tar zxvf wordpress-6.3.1-ja.tar.gz
[root@SV-ALTAIR html]# tar zxvf wordpress-6.3.1-ja.tar.gz wordpress/ wordpress/wp-login.php wordpress/wp-cron.php wordpress/xmlrpc.php wordpress/wp-load.php wordpress/wp-admin/ wordpress/wp-admin/credits.php wordpress/wp-admin/admin-functions.php wordpress/wp-admin/options-reading.php wordpress/wp-admin/edit-tags.php wordpress/wp-admin/link-manager.php wordpress/wp-admin/options-writing.php
展開してできたwordpress
ディレクトリの所有者を変更。
[root@SV-ALTAIR html]# chown -R www:www wordpress
手順③ wordpress用のバーチャルホスト用confを作成
vi /etc/httpd/conf.d/wordpress.conf
手順④ MariaDBにwordpress用のDBを作成
mysql -uroot -p●●●●●●●●パスワード
[root@SV-DENEB ~]# mysql -uroot -p●●●●●●●●●●●●●●● Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 91 Server version: 10.3.35-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 wpdb;
MariaDB [(none)]> create database wpdb; Query OK, 1 row affected (0.000 sec)
show databases;
MariaDB [(none)]> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | wpdb | +--------------------+ 4 rows in set (0.000 sec)
grant all on wpdb.* to '●●●ユーザー名'@'localhost' identified by '★★★パスワード';
MariaDB [(none)]> grant all on wpdb.* to '●●●ユーザー名@'localhost' identified by '★★★パスワード'; Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed
MariaDB [mysql]> select user,host from user; +-------------+-----------------+ | user | host | +-------------+-----------------+ | root | 127.0.0.1 | | root | ::1 | | root | localhost | | ●●●ユーザー | localhost | +-------------+-----------------+ 5 rows in set (0.000 sec)
show grants for '●●●ユーザー名'@'localhost';
MariaDB [mysql]> show grants for '●●●ユーザー名'@'localhost'; +--------------------------------------------------------------------------------------------------------------------+ | Grants for ●●●ユーザー名@localhost | +--------------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO `●●●ユーザー名`@`localhost` IDENTIFIED BY PASSWORD '*★★★パスワード' | | GRANT ALL PRIVILEGES ON `wpdb`.* TO `●●●ユーザー名`@`localhost` | +--------------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.000 sec)
grant all on wpdb.* to '●●●ユーザー名'@'XXX.XXX.XXX.XXXWEBサーバーのIPアドレス' identified by '★★★パスワード';
MariaDB [mysql]> grant all on wpdb.* to '●●●ユーザー名'@'XXX.XXX.XXX.XXXWEBサーバーのIPアドレス' identified by '★★★パスワード'; Query OK, 0 rows affected (0.000 sec)
MariaDB [mysql]> select user,host from user; +-------------+-----------------+ | user | host | +-------------+-----------------+ | root | 127.0.0.1 | | ●●●ユーザー | XXX.XXX.XXX.XXX | | root | ::1 | | root | localhost | | ●●●ユーザー | localhost | +-------------+-----------------+ 6 rows in set (0.000 sec)
手順④ WordPressのインストール
http://●●●●●●●●●●●●●●●/wp-admin/setup-config.php
やったぜ!