GCPインスタンスで久々にWordpressを構築しましたので初投稿記念にアップします。
=====================
【動作環境】
OS:CentOS 7.8
WEB:Apache 2.4.6
AP:PHP 7.3.21
DB:MariaDB 1.5.5
=====================
◆SELinux無効化
sed -i -e "s/^SELINUX=enforcing$/SELINUX=disabled/g" /etc/selinux/config
setenforce 0
◆時刻合わせ
timedatectl set-timezone Asia/Tokyo
◆必要パッケージのインストール
yum -y install httpd mariadb-server mariadb-client wget
◆サービス自動起動設定
systemctl enable httpd
systemctl enable mariadb
◆Wordpressのインストール
cd /var/www/html
wget https://ja.wordpress.org/latest-ja.tar.gz
tar xvf latest-ja.tar.gz
chown -R apache:apache .
◆PHPのインストール
#最初、通常のyumでインストールしたが、500エラーが表示され、かつログにも以下のエラーが吐かれていた。
#エラーメッセージ:PHP Parse error: syntax error, unexpected '. ', expecting '&' or variable (T_VARIABLE) in /var/www/html/wordpress/wp-includes/functions.php
#よって以下のようにPHPをできるだけ最新バージョンにアップデートが必要
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum -y install --disablerepo=* --enablerepo=epel,remi,remi-safe,remi-php73 php php-mysql
◆DBサービス起動
systemctl start mariadb
mysql -e "create database wordpress default character set utf8;"
mysql -e "GRANT ALL ON wordpress.* TO wordpress@localhost IDENTIFIED BY 'password';"
mysql -e "FLUSH PRIVILEGES;"
◆WEBサービス起動
systemctl start httpd
=====================