If you are working toward your RHCE and the EX300 exam you will know that you will need some MariaDB (MySQL) knowledge and this is all well and good but if you do not put the experience to good use it is all a little meaningless. In this blog we will look at installing the LAMP stack: (Linux, Apache, MariaDB, and PHP) , onto RHEL 7.1 and then adding and configuring WordPress the popular blog platform.
Install Software
# yum install -y httpd php mariadb mariad-server php-mysql # systemctl start mariadb httpd # systemctl enable mariadb httpd
Secure MariaDB
# mysql_secure_installation
- set root password
- remove anonymous
- set local only
- remove test db
- reload permissions
Configure MariaDB
We now need to to log in to the database server:
# mysql -u root -p MariaDB [(none)]> create database wp; MariaDB [(none)]> create user wp@localhost identified by 'Password1'; MariaDB [(none)]>grant all privileges on wp.* to wp@localhost; MariaDB [(none)]>flush privileges; MariaDB [(none)]> quit
Create WordPress Directory
# cd /var/www/html # mkdir wp # chgrp apache wp/ # chmod 3770 wp/
Copy WordPress files to /var/www/html/wp
Down load the latest version of WordPress from http://www.wordpress.org. Expand the archive and copy the contents of the expanded WordPress directory into the wp sub-folder. Add the write permission to the group owner:
# chmod -R g+w /var/www/html/wp
Configure WordPress
Start the browser and navigate to localhost/wp : this should start the configuration where we add the database name, database user and password.
SELinux may prevent the web-server writing to the configuration file. If SELinux is enable you can copy the configuration into the file /var/www/html/wp/wp-config.php
The simplest way to allow httpd to write in an SELinux environment is to run the following command:
# setsebool -P httpd_unified 1
With the configuration file in place we can complete the configuration of WordPress by returning to the web page and click the Run Install button. We now configure the site title and admin user account.