Installing WordPress on CentOS webserver

Recently I had my Jetpack plugin going loco and I could not find the way to fix it. So I decided to reinstall it WordPress. Since I have not renewed my cPanel license for months and I do not want to renew it just because I want to use Softaculous, I decided to reinstall WordPress manually. It has been a while and the installation went well as instructed.

Here is how I do it :

First of all, my webserver is running on Linux CentOS and it already has Apache, PHP and MySQL running on it. Please refer to my previous post on how to install these software. I will also post a tutorial on how to install WordPress on Windows later on.

So the first step is to download the WordPress software. Type :

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

Then unzzip it by typing :

tar -xzvf latest.tar.gz

You will find the files in a WordPress directory. Name it to whatever you want. I named it to wp folder by typing :

mv wordpress wp

Next you need to create the MySQL database for the WordPress. Log in to the MySQL shell by typing :

mysql -u root -p

And enter your root password. Just in case you forget the password, you can retrieve it by typing :

grep password /root/.my.cnf

Next you need to create a database and a user for the WordPress. To add a database, type :

create database yourdatabase;

To view the database that you just created, type :

show databases;

Next is create a user for that database, by typing :

create user userfordatabase;

Then you need to create a password for the user, by typing :

set password for userfordatabase= password (‘yourpassword’);

Finally, you need to grant all privileges to the user. Type :

grant all privileges on yourdatabase.* to userfordatabase identified by ‘password123’;

Refresh your database by typing :

flush privileges;

Then to exit, type :

exit;

Now back to the WordPress where you need to edit the configuration file. Browse your wordpress folder by typing :

cd wordpress

And look for wp-config-sample.php. You will need to rename this file to wp-config.php, by typing :

mv wp-config-sample.php wp-config.php

Then you need to edit the wp-config.php, by using the vi editor. Type :

vi wp-config.php

Look for the lines WordPress settings, where you need to change the database name, user name and password. Change it to what we have created in the MySQL shell earlier. Once done, save it by pressing Escape type ZZ. This will save the file and exit.

The hard part is done. Now you can simply browser your WordPress page by typing http://localhost or the domain name that use for the WordPress installation. In my case, it will be http://localhost/wp. It will redirect you to the installation page, which is http://localhost/wp-admin/install.php. Just follow the steps shows and you are done.

Please leave a comment if you need any further assistance. Thank you.

Leave a Reply