Take a look first at this schema, you can see quickly all the processes you have to follow. I’ll explain everything in  detail below.  This schema can help you have an idea of how this process works.

WP CentOs

First you need to install the following packages: PHP, APACHE and MYSQL

How to install the packages:

Let’s install the PHP package first

Now you need to install the Apache http daemon, if you are not sure which packages have to install type:

And you can see the list of all packages. The one that you should install is httpd, as you can see in the description is the Apache Daemon. Now you have to install it:

And finally you need to install the MySQL database server:

It’s important to add the mysql client package because you need the client to connect to the server and be able to do operations.

Once we have installed all the packages, we need to configure anything that is required. As an example:

We can use less for take a look inside the file, and if we need to modify anything we could use vi

How to configure Apache (Web Server)

Apache in CentOS has its configuration divided in two directories, /etc/httpd/conf where the main configuration is and /etc/httpd/conf.d where all files ending in .conf will be automatically imported to the main configuration.

Now change the directory to:

Once inside, we have to create a new file using the command vi example.conf and specify here the Virtual Host for our WordPress site:

Once the VirtualHost configuration is defined, we have to check that the directory specified in DocumentRoot exists:

If that directory doesn’t exist it shows you:

If the directory doesn’t exist, we can create it by using:

Once everything is in place, let’s start Apache

Now point your browser to http://www.example.com/, don’t forget to add a definition to your hosts file to make sure that example.org points to the IP of your server.

apache test

Configure MySQL

If you don’t know which one is the start script that you need to call to start mysql (or any other service), you can always list them all under the directory:

First we need to start this service, you have two ways to do this
Old school: /etc/init.d/mysqld start
And the new one: service mysqld start
Both versions are valid.

If you are not sure what options do you need, only typing /etc/init.d/mysqld will show you all available options.

Once we the MySQL daemon running, we have to create a MySQL database.

If you have configured a root password for mysql you need to type it here, otherwise just press enter.

And now create the database by running "create database wp_example;"

Once the database is created we need to create user credentials to access the database (using root is never recommended), in order to do this please run the command:

And finally to reload the permissions on MySQL run the command:

Download WordPress
Now let’s go to the directory where we want to install wordpress.

Once we’re there we can use wget to get the latest wordpress version

Now we’ll just simply untar the contents

This will create a directory wordpress with the latest version, now we can just move all the contents into the web directory by running

Now we have moved all the wordpress content into the proper directory which is defined in DocumentRoot in your VirtualHost configuration, to make sure that Apache can read and write files in here we need to give all the files the same permissions that the apache daemon runs under (user and group web in CentOS).

With all this you have successfully configured your WordPress server! Now you can just open your WordPress at http://www.example.com/ and it will drive you through the initial configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *