Install WordPress on a CentOS 7 VPS

Today we will show you how to install WordPress on a Centos 7 VPS using Apache web-server and MySQL database.

WordPress is a web software you can use to create a beautiful website or blog. An open source CMS, WordPress is often used as a blog publishing application powered by PHP and MySQL. Currently it is the most popular of the blogging platforms available.

Before you start the installation, please make sure that you have LAMP stack installed on your server. If not, follow our excellent tutorial about installing LAMP (Linux Apache, MariaDB & PHP) on a CentOS 7 VPS.


We are using our SSD 1 VPS hosting plan for this tutorial.


First make sure your CentOS 7 VPS is fully up-to-date using the command below:

# yum update


Enter a directory by your choice and download WordPress. For our purpoces we are using the /opt directory.

# cd /opt

Install wget and unzip that are needed for the installation further:

# yum install wget unzip

Download WordPress using the wget command:

# wget http://wordpress.org/latest.zip

Install php-gd in order to work with images, install plugins etc…

# yum install php-gd


Enter MySQL as root:

# mysql -u root -p

mysql> CREATE DATABASE wordpress;
mysql> GRANT ALL PRIVILEGES on wordpress.* to 'wpuser'@'localhost' identified by 'your_password';
mysql> exit

Restart MySQL:

# systemctl restart mysqld.service

Now we will unzip the WordPress zip file in the /var/www/html/ directory.

# unzip -q latest.zip -d /var/www/html/

Set the proper permissions:

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

We need to create the upload directory manually:

# mkdir -p /var/www/html/wordpress/wp-content/uploads

Allow the Apache web server to write to the uploads directory. Do this by assigning group ownership of this directory to your web server which will allow Apache to create files and directories. Issue the following command:

# chown -R :apache /var/www/html/wordpress/wp-content/uploads

Enter the WordPress directory:

# cd /var/www/html/wordpress/

Rename wp-config-sample.php into wp-config.php:

# mv wp-config-sample.php wp-config.php

Open the WordPress configuration file with your favorite text editor and change the database values with the ones you gave at the time of the database creation.

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

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

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

Now you can finish your WordPress installation by opening your favorite web browser and navigate to: http://your_ip_address/wordpress/wp-admin/install.php

Of course you don’t have to do any of this if you use one of our Linux VPS hosting services, in which case you can simply ask our expert Linux admins to install WordPress for you.They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories: Tutorials