WordPress is an open source tool and a content management system written in PHP. It’s one of the easiest and powerful website creation tool for blogging.

It’s completely customizable and it can be used for almost anything as it has a large online community for support. It is also a great way to quickly get websites up and running. So in this article we will show you some simple steps on how to setup and start using WordPress.

For this example we will be using CentOS 7 as a base operating system with basic LAMP Stack environment installed on the cloud/server, that will almost cover all the prerequisites with the required PHP libraries. You can check out our tutorial on how to setup a LAMP stack on CentOS 7.

Before starting the installation, make sure that your system is up-to-date with the required updates and missing patches. The fully qualified domain name should be configured and you’ll need root access or super user privileges to process the installation and configuration.

You can update your operating system by executing the following linux command.

[root@centos-7 ~]# yum update

Database Setup for WordPress

Now we need to setup a separate database that will only be used for WordPress, with all it’s own user privileges.

Then login to your MySQL root user with following command, by providing the root user and password to start preparing its database.

[root@centos-7 ~]# mysql –u root -p

Creating a new Database

When you are logged in to your database server, it’s simple to create a new database using the following command on MariaDB.

MariaDB [(none)]> create database wordpress; Query OK, 1 row affected (0.00 sec)

Creating a new User

Creating a new user is very simple by using the following command.

MariaDB [(none)]> CREATE USER wpuser@localhost IDENTIFIED BY 'wp123'; Query OK, 0 rows affected (0.00 sec)

Assigning Privileges

Once you’ve already created the new database and user, we will now need to grant access to the user that was created to manage the databases.

Access privileges can be assigned to a new user by using following the command.

MariaDB [(none)]> GRANT ALL ON wordpress.* TO wpuser@localhost IDENTIFIED BY 'wp123'; Query OK, 0 rows affected (0.00 sec)

Now flush the changes that you’ve recently made to make them available to the current MariaDB process, afterwards execute the exit command to log out from MariaDB to go back to the shell’s main screen.

MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> exit Bye

Installing WordPress

We are now ready to download and install WordPress into the document root directory of our web server. Download the latest version of WordPress by typing below command.

[root@centos-7 ~]# wget https://wordpress.org/latest.tar.gz [root@centos-7 ~]# ls latest.tar.gz

We will be extracting the downloaded file into the document root directory of our Apache web server. To do this you’ll need to use the following command to extract the archive.

[root@centos-7 ~]# tar -zxvf latest.tar.gz -C /nas/content/live/vexxhost/

Now we have a new WordPress directory into the web server’s document root directory.

The next step is to assign it with an apache user and group to the server as a web directory. We will now change the ownership of the WordPress directory using the command.

[root@centos-7 ~]# ls /nas/content/live/vexxhost/wordpress [root@centos-7 ~]# chown -R apache:apache /nas/content/live/vexxhost/*

Configuring WordPress

In this step we will configure the main configuration file of WordPress, where we need to configure it’s basic parameters so that it can be connected with the database and user.

So prior to making any changes to the configuration file, we need to rename it as wp-config.php . To do that let’s leave a sample file as it is and copy its contents into original configuration file.

[root@centos-7 wordpress]# cp wp-config-sample.php wp-config.php

Now open it using any of your favourite editor, to make any changes in the WordPress configuration file.

[root@centos-7 wordpress]# vim wp-config.php

Here are the values that we need to update according to our previous database and user’s setup.

// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'database_name_here'); /** MySQL database username */ define('DB_USER', 'username_here'); /** MySQL database password */ define('DB_PASSWORD', 'password_here'); /** MySQL hostname */ define('DB_HOST', 'localhost'); /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', '');

As per our database setup, we will update these records as shown below and then save it with wq! To finish configuration settings.

define('DB_NAME', 'wordpress'); define('DB_USER', 'wpuser'); define('DB_PASSWORD', 'wp123');

WordPress Web Interface Installation

Most of our server side settings and configurations are done. Finally we need to complete a short web interface process to finalize the setup.

Open your favorite web browser and access the WordPress web directory in your web browser using your server IP or FQDN like.

http://servers_ip_address/wordpress/

You will be redirected towards the web installation process for your WordPress.

Let’s choose your language settings and click Continue to move to the next step.

In the next step, fill out the required information in the fields and after doing it click “Install WordPress”.

Greetings!, You are now ready to use WordPress. All you need to do is type in your login details to start.

Conclusion

We have successfully installed and configured WordPress on our CentOS 7 cloud instance. You can now install the plug-in and themes that you want to have.

Also there are a lot of free plug-ins and themes developed by WordPress community.

Would you like to know about Zuul, a CI/CD project gating tool? Download our white paper and get reading!