How to Install WordPress Using Apache on CentOS/RHEL 7/6/5

WordPress started as a blogging system, but now has become a full content management system (CMS). Since WordPress is a free open source program, it has become the most popular CMS on the Web. It has huge number of third party plugins and themes. WordPress currently one of the most popular blogging platform available on the internet.
Install WordPress

In this article, I will show you how to install WordPress on CentOS/RHEL 7/6/5.

Step #1 Prerequisite:

You’ll need to have a LAMP (Linux, Apache, MySQL, and PHP) installed on your CentOS/RHEL server. If LAMP hasn’t installed or configured on server, you can use below articles to install LAMP.

On RHEL/CentOS 7 
# yum install httpd mariadb mariadb-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt 
On RHEL/CentOS 6/5 
# yum install httpd mysql mysql-server php php-common php-mysql php-gd php-xml php-mbstring php-mcrypt 

Next, start the service to reflect changes.

On RHEL/CentOS 7 
# systemctl start httpd
# systemctl start mysqld
On RHEL/CentOS 6/5 
# service httpd start
# service mysqld start

Install LAMP on CentOS/RHEL 7
Install LAMP on CentOS/RHEL 5/6

Step #2 Downloading & Extracting WordPress

WordPress content can be downloaded using the commands below.

# cd /opt
# wget https://wordpress.org/latest.tar.gz

Once the download finish, run the following command extract it.

# tar -xvzf latest.tar.gz -C /var/www/html

Next, change the permissions and ownership of the WordPress content folders.

# chown -R apache:apache /var/www/html/wordpress
# chmod -R 755 /var/www/html/wordpress

Step #3 Creating MySQL Database for WordPress

Now create a mysql database and user for wordpress. Use following set of command to create database and user.

# mysql -u root -p
mysql> CREATE DATABASE techoism_db;
mysql> GRANT ALL ON techoism_db.* to 'techoism_user'@'localhost' IDENTIFIED BY 'secretpassword';
mysql> FLUSH PRIVILEGES;
mysql> quit

Step #4 Creating Apache VirtualHost

Open the apache configuration file with “vi” editor and add the following lines:

# vi /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
  ServerAdmin support@techoism.com
  DocumentRoot /var/www/html/wordpress
  ServerName blog.techoism.com
  ErrorLog /var/log/httpd/blog.techoism.com-error-log
  CustomLog /var/log/httpd/blog.techoism.com-acces-log common
</VirtualHost>

Next, restart the Apache service to reflect changes.

On RHEL/CentOS 7 
# systemctl restart httpd 
On RHEL/CentOS 6/5 
# service httpd restart 

Step #5 Configuring WordPress Installation

Use following command to configure WordPress installation.

# cd /var/www/html/wordpress
# cp wp-config-sample.php wp-config.php
# chmod 777 wp-config.php
# chown apache:apache wp-config.php

Open wordpress configuration file and change MySQL setting.

# 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', 'techoism_db');

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

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

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

Step #6 WordPress Installation

Open your browser and type any of the following address.

http://blog.techoism.com
http://Server-IP

wordpress

Give your Site Title, Admin User, Admin Password, Enter Your E-Mail and then click on Install button.
wordpress_1

wordpress_2

Login into your WordPress Dashboard.
wordpress_3

View your WordPress blog Dashboard.
wordpress_4

View your New WordPress blog.
wordpress_5

Enjoy it!

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.