Installation/Setup and Configure an WordPress Server on CentOS/RHEL 6.4

This article will guide you through the installation and configuration steps of WordPress server on CentOS/RHEL 6.4.

The procedure mentioned in this tutorial is tested on:

OS CentOS 6.4
Apache 2.2.15
PHP 5.3.3
MySQL 5.1.69
WordPress 3.6.1

WordPress is a free and open source content management system developed for blogging that uses php and MySQL, with rich sets of widgets, themes and plugins. It was created in 2003 and has since then expanded to manage 22% of all the new websites created and has over 20,000 plugins to customize its functionality.

I) Prerequisite
1) Following pre-requistic package are required (basically LAMP stack).

   # yum update -y 
   # yum install mysql-server httpd php php-mysql php-gd -y

Note: Before installing we need to update our system using “yum update”.

2) Now we need to configure MySQL and Apache to automatically boot at startup/reboot.

   # chkconfig --level 235 mysqld on
   # chkconfig --level 235 httpd on

3) Start/Restart the MySQL and Apache Service.

   # /etc/init.d/mysqld start
   # /etc/init.d/httpd start

II) Creating Database for WordPress.

1) Securing MySQL

   # mysql_secure_installation

	Enter current password for root (enter for none):    (Just press “enter” key)
	Set root password? [Y/n]   (Just press “enter” key for yes)
	New password:    (Create a  password)
	Re-enter new password:    (Re-enter your password)
	Remove anonymous users? [Y/n]   (Press “enter” key for yes)
	Disallow root login remotely? [Y/n]     (Press “enter” key for yes)
	Remove test database and access to it? [Y/n]   (Press “enter” key for yes)
	Reload privilege tables now? [Y/n]     (Press “enter” key)

2) Login to MySQL shell and use your root password as specified above.

   # mysql -u root -p

3) Create a WordPress Database.

   mysql> CREATE DATABASE wordpress;

4) Now we create a new user.

   mysql> CREATE USER wordpressuser@localhost;

5) We will setup password for your new user.

   mysql> SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password");

6) Grant all privileges to this new user on wordpress database.

   mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';

7) Refresh MySQL.


8) Exit out of the MySQL shell.

   mysql> exit;

Note: Feel free to change WordPress DATABASE,USER and PASSWORD (specified above) as you like.

II) WordPress Setup
Once we have setup the database now is the time to install wordpress.

1) Download WordPress sourcecode from wordpress site.

   # cd /usr/local/src
   # wget 

2) Untar it.

   # tar -zxvf latest.tar.gz

3) Move the code to Apache default Web Root directory (i.e. /var/www/html).

   # mv wordpress /var/www/html/

III) Configuring WordPress.

1) Copy the sample config file located in wordpress directory.

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

2) Update the following parameter in wordpress config file (wp-config.php) that we have declared in MySQL Setup.

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

3) Update “Authentication Unique Keys and Salts” section in wp-config.php from wordpress site (

   # vi wp-config.php
	define('AUTH_KEY',         'put your unique phrase here');
	define('SECURE_AUTH_KEY',  'put your unique phrase here');
	define('LOGGED_IN_KEY',    'put your unique phrase here');
	define('NONCE_KEY',        'put your unique phrase here');
	define('AUTH_SALT',        'put your unique phrase here');
	define('SECURE_AUTH_SALT', 'put your unique phrase here');
	define('LOGGED_IN_SALT',   'put your unique phrase here');
	define('NONCE_SALT',       'put your unique phrase here');

Note: Each time you visit this site (, it generates different Keys and Salts.

4) Create the following directory to store wordpress cache and update package.

   # mkdir wp-content/uploads wp-content/cache
   # chown -R apache:apache wp-content/uploads wp-content/cache ./

5) Web Installation step.
Last step is to fill the short online form using the following web based URL.


5.1) If you are unable to view this page then either IPTables or SELinux is blocking it.
a) So try to disable iptables temporary and check.

   # service iptables stop

b) See my docs to disable SELinux temporary.


One thought on “Installation/Setup and Configure an WordPress Server on CentOS/RHEL 6.4

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.