Install WordPress Into CentOS

Objective

Provide a guideline on installing WordPress into CentOS.

Prerequisites

  1. A LAMP Server installed in CentOS

Steps

Step 1: Create MySQL Database and User for WordPress

Access the MariaDB database by logging in to MySQL’s root account via the following command.

mysql -u root -p <your_password>

Next, create a new WordPress database by using the following command.

CREATE DATABASE wordpress

Then, create a new user by entering the following.

CREATE USER wordpressuser@localhost
IDENTIFIED BY 'your_password_here'

Next, enable user access on the newly created database by entering the following.

GRANT ALL PRIVILEGES ON wordpress.* TO
wordpressuser@localhost IDENTIFIED BY 'your_password_here';

Then, enter the following to ensure that MySQL is aware of the changes made to the privileges access.

FLUSH PRIVILEGES;

Then, exit MariaDB with the following command.

exit

Step 2: Installing WordPress

Install the required PHP module for installing WordPress using the following command.

yum install -y php-gd

Then, restart your Apache services by using the following command.

service httpd restart

Next, download WordPress from the official site into the virtual machine by using wget.

If you do not have wget, install it using the following command. After installing wget, use the subsequent commands to download WordPress.

yum install -y wget
cd ~
wget http://wordpress.org/latest.tar.gz

Then, extract the downloaded file using the following command.

tar -xzvf latest.tar.gz

Then, move files from home directory to Apache’s document root by using rsync.

If you do not have rsync, install it using the following command. After installing rsync, you can proceed with the subsequent commands.

sudo rsync -avP ~/wordpress/ /var/www/html/

Then, make a directory under wp-content called uploads using the following command.

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

Next, change the ownership of all files in the WordPress folder to apache:apache using the following command.

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

Verify the ownership by using the following command.

ls -l /var/www/html/*

Step 3: Configure WordPress

Navigate to /var/www/html using the following command.

cd /var/www/html

Copy the wp-config.php file to the default configuration file location using the following command.

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

Edit the wp-config.php file via nano. Then, fill in the following parameters:

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

Step 4: Complete the Installation Through the Web Interface

Access the setup wizard GUI of WordPress by accessing the website through your web browser (http://server_domain_name_or_IP).

Then, fill up all the required information.

Finally, install WordPress.

Updated on January 22, 2021

Was this article helpful?

Related Articles

Need Help?
Submit a ticket to us and let our professional team assists you

Support Billing Sales
Support
Billing
Sales