Install Centos 7

Step One — Install Apache

Install Web Server
yum install httpd
Enable Firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
Start Web Server
sudo systemctl start httpd.service
Navigate to the website
Enable Webserver on Startup
sudo systemctl enable httpd.service

Step Two — Install MySQL (MariaDB)

yum install mariadb-server mariadb
Start Database
sudo systemctl start mariadb
Configure Database

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorization.

New password: password
Re-enter new password: password
Password updated successfully!
Reloading privilege tables..
 ... Success!

Enable Database at startup
systemctl enable mariadb.service

Step Three — Install PHP 7.3

sudo yum install epel-release yum-utils -y
sudo yum install -y
sudo yum-config-manager --enable remi-php73
sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd -y

php -v
Restart Webserver
sudo systemctl restart httpd.service

Install php Modules

sudo yum install php php-mysql

Optional Modules
php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
php-cli.x86_64 : Command-line interface for PHP
php-common.x86_64 : Common files for PHP
php-dba.x86_64 : A database abstraction layer module for PHP applications
php-devel.x86_64 : Files needed for building PHP extensions
php-embedded.x86_64 : PHP library for embedding in applications
php-enchant.x86_64 : Enchant spelling extension for PHP applications
php-fpm.x86_64 : PHP FastCGI Process Manager
php-gd.x86_64 : A module for PHP applications for using the gd graphics library

Step Four — Test PHP Processing on your Web Server

vi /var/www/html/info.php
<?php phpinfo(); ?>
Go to Website http://your_server_IP_address/info.php

Edit /etc/php.ini

cp /etc/php.ini /etc/php.ini.bup
vi /etc/php.ini

Change the lines below

memory_limit = 512M
post_max_size = 512M
upload_max_filesize = 512M
Log into MYSQL
mysql -u root -p
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';

Step Four — Install WordPress

yum install php-gd
sudo service httpd restart
cd ~
tar xzvf latest.tar.gz
rsync -avP ~/wordpress/ /var/www/html/
mkdir /var/www/html/wp-content/uploads
sudo chown -R apache:apache /var/www/html/*

Step Five — Configure WordPress

cd /var/www/html
cp wp-config-sample.php wp-config.php
vi wp-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress');

/** MySQL database username */
define('DB_USER', 'wordpressuser');

/** MySQL database password */
define('DB_PASSWORD', 'password');

Step Four — Complete Installation Through the Web Interface


Step Five — Fix Permalinks

After much research, I found the solution:

cp /etc/httpd/conf/httpd.conf  /etc/httpd/conf/httpd.conf.bup
sudo vi /etc/httpd/conf/httpd.conf

Type this in /AllowOverride
Find the second one with <Directory “/var/www”>
Underneath that write the following code:

<Directory "/var/www/html">
    AllowOverride All
cd /var/www/html
vi .htaccess

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
chmod 664 .htaccess
chown -R apache:apache /var/www/html
sudo systemctl restart httpd.service

a2enmod rewrite