How To Install WordPress on CentOS


A VPS or Dedicated Server running CentOS On CrownPanel

Putty or similar client to login to your VPS.

Create a MySQL Database and User for WordPress

Log into MySQL with the following command,

mysql -u root -p

Enter the password for the root account you set when you installed MySQL.

First, we'll create a new database,


Next, create a new MySQL user account that we will use to operate on WordPress's new database, with username "wordpressuser"

CREATE USER [email protected] IDENTIFIED BY 'password';

Link the user and DB together by granting our user access to the database,

GRANT ALL PRIVILEGES ON wordpress.* TO [email protected] IDENTIFIED BY 'password';

Flush the privileges so that MySQL knows about the user permissions we just added,


Exit out of the MySQL command prompt by typing:


Install WordPress

Install PHP, Apache and PHP-GD,

yum install httpd php php-mysql php-gd

Now we need to restart Apache so that it recognizes PHP:

service httpd restart

Download the latest version of wordpress,

cd ~

Extract the archived files to rebuild the WordPress directory,

tar xzvf latest.tar.gz

Move the unpacked files to Apache's document root,

mv /root/wordpress/ /var/www/html/

Create directory for uploads,

mkdir /var/www/html/wp-content/uploads

Use chown to grant ownership to Apache's user and group:

sudo chown -R apache:apache /var/www/html/*

Configure WordPress

Begin by moving into the Apache root directory where you installed WordPress:

cd /var/www/html

The main configuration file that WordPress relies on is called wp-config.php.

cp wp-config-sample.php wp-config.php

Now that we have a configuration file to work with, let's open it in a text editor:

nano wp-config.php

The only changes we need to make to this file are under the section titled MySQL settings and change the DB_NAME, DB_USER, and DB_PASSWORD variables.

Fill in the values of these parameters with the information for the database that you created. It should look like this, Please remember to change "password" to the password you setup above,

// ** 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');

These are the only values that you need to change, so save and close the file when you are finished.

Complete Installation Through the Web Interface

You'll need to complete the WordPress installation through the web interface, Visit the following URL, replace server_domain_name_or_IP_Address with your VPS IP or domain name and follow the instructions on screen,


Last Modified: January 19 2018 23:27:04