Creating WordPress MySQL Database
Our WordPress will require a database and a database user. To create one, simply use the following commands. Feel free to replace the database name, user and password as per your preferences:
# mysql -u root -p
Enter password:
## Create database ##
CREATE DATABASE wordpress;
## Creating new user ##
CREATE USER wordpress@localhost IDENTIFIED BY "secure_password";
## Grant privileges to database ##
GRANT ALL ON wordpress.* TO wordpress@localhost;
## FLUSH privileges ##
FLUSH PRIVILEGES;
## Exit ##
exit
Preparing WordPress Installation
Now we are ready to download the latest WordPress archive:
# cd /tmp && wget http://wordpress.org/latest.tar.gz
Next extract the archive in our web directory:
# tar -xvzf latest.tar.gz -C /var/www/html
The above will create the following directory, which will contain our WordPress script:
/var/www/html/wordpress
Now change the ownership of that directory to user “apache”:
# chown -R apache /var/www/html/wordpress
Creating Apache Virtual Host for WordPress
We will create a separate virtual host for our WordPress installation. Open /etc/httpd/conf/httpd.conf with your favorite text editor:
# vim /etc/httpd/conf/httpd.conf
And add the following code at the bottom of the file and replace the marked text with the information related to your installation:
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/wordpress
ServerName tecminttest.com
ServerAlias www.tecminttest.com
ErrorLog /var/log/httpd/tecminttest-error-log
CustomLog /var/log/httpd/tecminttest-acces-log common
</VirtualHost>
Save your changes and restart Apache:
# systemctl restart httpd
Installing WordPress on Website
Now we are ready to run our WordPress installation. To start the installation you can access either your server’s IP address at http://ip-address You should see the following page:
When you have filled all the required information finalize the installation by clicking the button at the bottom. Your installation is now complete.