How to install wordpress on centos server

What is WordPress ?

WordPress is free and open source content management system (CMS), based on PHP and Mysql used as website and blogging tool.

Before we start

Before installation of word press please ensure you have access to root privileges as a user.

You must ensure that LAMP is installed on your centos server. If you do not have LAMP  installed on your server than first you need to install Linux, apache, Mysql & PHP stack on your server.

Once you have fulfilled the above prerequisites you are good to go and follow below steps to complete your fresh wordpress installation.

WordPress Installation steps

Step 1. Download wordpress

You must download WordPress from the website by using the Wget command in home directory

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

Unzip downloaded wordpress

tar -xzvf latest.tar.gz

The above command shall give you unzipped downloaded wordpress Now you can move to step 2.

Step 2. Create the WordPress Database and User

After you have unzip downloaded wordpress file, you will find all files in wordpress directory within the home directory

Now we need to create a Mysql Database directory and a Mysql user for wordpress functionality and information storage utility.

Log into the MySQL Shell using root password:

mysql -u root -p

After successful login into mysql shell we need to perform following task.

  1. A wordpress database
  2. A user in created database

You would be required to assign new password to created user. Keep in mind that all MySQL commands must end with semi-colon(;).

First, let’s make the database ( i am calling mine wordpress for simplicity’s sake; feel free to give it whatever name you choose)

CREATE DATABASE wordpress;
Query OK, 1 row affected (0.00 sec)

Now you are required to create the new user. You may replace the database, name, and password values given below with values as per your preference:

CREATE USER [email protected];
Query OK, 0 rows affected (0.00 sec)

Set the password for your new user:

SET PASSWORD FOR [email protected]= PASSWORD("password");
Query OK, 0 rows affected (0.00 sec)

Grant all privileges to the newly created user:

GRANT ALL PRIVILEGES ON wordpress.* TO [email protected] IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

Refresh MySQL:

FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

Exit out of the MySQL shell:

exit

Step 3. Setting up the Configuration of WordPress

Copy the sample wordpress configuration file, located in the wordpress directory into an altogether new file which would need to be edited, creating a new usable wordpress config:

cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php

Than open the wordpress config file:

vi ~/wordpress/wp-config.php

You need to search for the section containing the fields given below, and replace with precise details for your database name, username, and password:

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

And save all changes before exit from file.

Step 4. Copy the files

The process of uploading WordPress to the server is almost complete. The final step remains to transfer the unzipped WordPress files onto the website’s root directory by using the following command:

sudo cp -r ~/wordpress/* /var/www/html

From this point wordpress have user friendly online installation form and this form would require a specific PHP module for running and can be installed directly via this command:

sudo yum install php-gd

You have now successfully downloaded the requisite PHP module, and you may run the form, Last but not the least, you are required to restart Apache by using the following command:

sudo service httpd restart


Step 5. Access the online wordpress installation page

All you need to do to access the page is add /wp-admin/install.php to your website’s domain or IP address (for instance. example.com/wp-admin/install.php), and complete the short online form with the requested details.

More from this author

Leave a Reply

Watch Dragon ball super