How to Install WordPress on CentOS, AWS linux EC2


This tutorial explains how to install WordPress on Centos 7, using Apache web-server and MySQL database.

1. Requirements

We are using AWS EC2 linux CentOs as platform

2. Update the system

First make sure your CentOs 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

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


Please enter your comment!
Please enter your name here