Install Mysql (MariaDB) and set password
yum -y install mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation
Install Apache
yum -y install httpd
systemctl start httpd.service
systemctl enable httpd.service
Open ports in firewall
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
Install PHP
yum -y install php
systemctl restart httpd.service
yum -y install php-mysql
yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel
systemctl restart httpd.service
Now we are ready to install WordPress. Let’s create a database and a user for wordpress to work with.
mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit
Now let’s download and install WordPress
wget http://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
rsync -avP ~/wordpress/ /var/www/html/
mkdir /var/www/html/wp-content/uploads
chown -R apache:apache /var/www/html/*
Next we will configure WordPress
cd /var/www/html
cp wp-config-sample.php wp-config.php
Now we need to modify the following parameters that hold our database information in “wp-config.php” file
vim 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');
Now we can complete the WordPress installation through the web interface. In your web browser, navigate to your server’s domain name or public IP address and fill the required information.