WordPress is a free and open-source blogging. It is a website-building software that makes use of PHP and MySQL. The most widely used content management system (CMS) on the Internet is WordPress. WordPress has over 20,000 plugins to increase its functionality. This makes WordPress a fantastic option for quickly and rapidly launching a website.

This tutorial will show you how to set up a WordPress instance on CentOS 7 with an Apache web server. On the same Ubuntu computer, you can run many VNC sessions, each with a different display number. This enables many users to log in at once and take part in separate desktop sessions. If you want to understand How to Change Hostname in CentOS follow the Steps from this which will help you.

Steps to Install WordPress on CentOS 7

Step 1: Create a WordPress User and MySQL Database.

Preparation is the first action we’ll take. WordPress uses a relational database to manage the website’s and its users’ information. This feature can be provided by MariaDB, a derivative of MySQL, which is already installed. Yet, we must create a database and a user for WordPress to use.

Start by entering the following command to log into the root (administrative) account of MySQL:

mysql -u root -p

The root account password that you specified when installing MySQL will be required when you are prompted. After you enter that password, a MySQL command prompt will appear.

We’ll first build a fresh database that WordPress can manage. You can give this any name you wish, but for this example, I’ll use WordPress.

CREATE DATABASE wordpress;

If you encounter any problems, double-check that there is a semicolon (;) at the end of every MySQL query or command.

In the next step create a fresh MySQL user account. That will only be used to manage the brand-new WordPress database. It is a good idea to create databases and accounts with a single purpose. because this enables better control over permissions and other security requirements.

The new account will be given the name “wordpressuser,” and I’ll give it the password “password.” Since the login and password used in these samples are not very secure, you should use something else.

CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';

You currently have a database and user account that was both created especially for WordPress. The user cannot access the database, though. By giving our users access to the database, we can connect the two elements.

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

We must flush the privileges now that the user has access to the database. So that MySQL is aware of the most recent privilege modifications we’ve made:

FLUSH PRIVILEGES;

When all of these operations have been carried out, we can leave the MySQL command prompt by typing:

exit

Step 2: After Creating Database, Install WordPress

One PHP module needs to be installed before we download WordPress for it to function. Without this module, WordPress won’t be able to resize images to create thumbnails. Using yum, we can get that package straight from the CentOS default repositories:

sudo yum install php-gd

For Apache to recognize the new module, we must now restart it:

sudo service httpd restart

We are now prepared to access the project website to download, and install WordPress. We can access the most recent version of WordPress. WordPress team links the most recent stable version of their software to the same URL.

cd ~
wget http://wordpress.org/latest.tar.gz

This will download an archive file that is compressed and contains every WordPress file we require. With the use of tar, we can extract the archived files and reconstruct the WordPress directory:

tar xzvf latest.tar.gz

Your home directory will now contain a directory with the name “WordPress.” By moving the unzipped files to Apache’s document root. Where they can be served to website visitors, we can complete the installation. With rsync, we can move our WordPress files there keeping default permissions:

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

The whole contents of the directory you unzipped will be carefully copied by rysnc to the document root at /var/www/html/. Yet another folder that WordPress can use to store uploaded files has to be added. The mkdir command will enable us to achieve that:

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

Now we must give our WordPress files and folders the appropriate ownership and rights. This will improve security while maintaining WordPress’s intended functionality. To accomplish this, we’ll use chown to give Apache’s user and group ownership:

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

With this modification, the web server will now have the ability to create and modify WordPress files as well as enable content uploading.

Step 3: With the Following Commands, Construct a WordPress

Later, a web interface will be used to complete most WordPress settings. To make sure that WordPress can connect to the MySQL database that we set up for it, we must perform several tasks from the command line.

Enter the Apache root directory where WordPress was installed first:

cd /var/www/html

WordPress’s primary configuration file is known as wp-config.php. The default installation comes with a sample configuration file that matches the settings we need. To enable WordPress to recognize and use the file. All we need to do is copy it to the location designated by default for configuration files:

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

Let’s start by opening the configuration file in a text editor:

nano wp-config.php

The only components of this file that need modification are the parameters. Which includes the data from our database. For WordPress to connect and authenticate to the database that we created. The DB_NAME, DB_USER, and DB_PASSWORD variables must be adjusted in the MySQL settings section.

Fill in the values for these parameters using the information from the database you created. It should seem as follows:

// ** 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 settings only need to be changed, so save the file when you are through, and then shut it.

Install Everything via the Web Interface.

Once your files are prepared and your software is configured, you may complete installing WordPress via the online interface. Open your web browser and navigate to your server’s public IP address or domain name:

http://server_domain_name_or_IP

The language in which you want to install WordPress must first be selected. After selecting a language and pressing Continue, WordPress will lead you to the first settings screen, where you can create your first administrator account:

Final Wordings on Installing WordPress on CentOS

In conclusion, setting up WordPress on CentOS 7 is a simple process. That can be completed according to a few basic instructions that we have seen. A LAMP stack must be configured, MySQL database and user must be created. WordPress must be downloaded and configured, then accessed using a web browser. Understand about Listing Installed Yum or RPM Packages on CentOS.

Users Install WordPress on their CentOS 7 server and begin developing their website. Blog by following the thorough instructions in the blog post. Hope you got a clear idea about Installing WordPress in the steps we mentioned.