How to Install WordPress on CentOS 7

Install WordPress on CentOS 7

We will show you, how to install WordPress on Centos 7, using Apache web-server and MySQL database. WordPress is a web software (content management system) 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. Installing WordPress on CentOS 7 is an easy task if you carefully follow our tutorial below.

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 CentOS 7.

1. Requirements

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

2. Update the system

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

# yum update

3. Install WordPress on CentOS

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

# cd /opt

4. Install wget

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

# yum install wget unzip

5. Download WordPress

Download WordPress using the wget command:

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

6. Install php-gd

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

# yum install php-gd

7. Create MySql database

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> FLUSH PRIVILEGES;
mysql> exit

8. Restart MySQL:

# systemctl restart mysqld.service

9. UnZip and configure WordPress

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

10. Finalizy your WordPress installation on CentOS via web browser

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 Install WordPress on CentOS 7,  if you use one of our WordPress hosting services, in which case you can simply ask our expert Linux admins to install WordPress on CentOS 7 for you.They are available 24×7 and will take care of your request immediately. You can also read our guide on How to Install WordPress with LEMP Stack on CentOS 8.

PS. If you liked this post, on how to Install WordPress on CentOS 7,  please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

1 thought on “How to Install WordPress on CentOS 7”

Leave a Comment