How to Install WordPress in CentOS Linux

Installing WordPress in CentOS Linux Overview

WordPress is a PHP based framework for creating database driven websites. WordPress is referred to as a content management system or CMS. WordPress is free to download and install, and is the most popular CMS today, specializing in creating online blogs.

A WordPress site is created by downloading the WordPress packaged files and extracting them into a folder on a webserver. Often time the server is a Linux operating system and an Apache webserver. The server also needs PHP and MySQL installed. Having phpMyAdmin also installed is recommended.

The instructions below walk through the process of installing and configuring WordPress on a CentOS Linux webserver.

Installation Instructions

1. Open a Bash terminal and elevate to root privileges

$ su –
#

2. Using Yum install the MySQL server, PHP, and the Apache webserver.

# yum install mysql-server php httpd

3. You will need to install additional repositories in CentOS, in order to access to necessary software packages that are not available in the default repositories. Install the Extra Packages for Enterprise Linux (EPEL), the epel-release for the current version of Enterprise Linux (EL6). You can find it at the following website: http://fedoraproject.org/wiki/EPEL. A direct link to the RPM is in the command below.  Eventually the link will be outdated and need to be replaced.

# yum install http://ftp.osuosl.org/pub/fedora-epel/6/i386/epel-release-6-8.noarch.rpm

4. Next install PhpMyAdmin. Start the MySQL server, and then initialize the server. When you run the mysql_secure_installation you will be prompted for the MySQL root user password. By default, there is no root user password, so press the enter key for none. Next you will be prompted to create a root user password for MySQL. For security reasons, it is a good idea to change the MySQL root user password. Enter Yes for all other default settings.{loadposition adposition6}

# yum install phpMyAdmin
# service mysqld start
# mysql_secure_installation

5. Next start the Apache webserver.

# service httpd start

6. These commands will make sure that the services will start on system boot.

# chkconfig httpd on
# chkconfig mysqld on

7. Next install WordPress
# yum install wordpress

8. If you cat the WordPress configuration file, the first line of output shows that the web alias to WordPress is: /wordpress. This means that the address to reach WordPress is http://localhost/wordpress. Open Firefox and go to http://localhost/wordpress, and you will get a 404 Not Found page. Restart the Apache webserver and refresh the browser window and you will see that WordPress is found, but there is a Error establishing a database connection message. This is due to the fact that you have not yet created a MySQL database, and database user and password.

# cat /etc/httpd/conf.d/wordpress.conf
#
service httpd reload

 

 


9. Go to http://localhost/phpMyAdmin and login with your MySQL root user password. Click on Databases and create a database for your WordPress site.  Next click on Users and create a new MySQL user and password. Now that you have a database and a user you need to give your new MySQL user complete access permissions to the newly created database. Click on Users to refresh the user list. Locate your new user in the user list and click on Edit Privileges. Scroll down to Database-specific privileges and under Add privileges on the following database drop-down menu, select your new database. Now select Check all for privileges and scroll down to click the accept button.

10. Using Vim or Nano, edit the WordPress configuration file to add the useraccount, password, and database name information to the file. Save and exit. Now the WordPress configuration file has the information it needs to access the MySQL database. In Vim, press the i key to get to insert mode, use the arrow keys to move the cursor to the text that you want to edit, edit the file and then press the escape key and then :wq to save and quit.

# vim /etc/wordpress/wp-config.php

11. Now open Firefox and enter the following address http://localhost/wordpress in the address bar. Enter the necessary information in the WordPress installation page to initialize the WordPress site, and populate the database with the tables and information that WordPress needs to run.

12. Start exploring, adding content, and editing your new WordPress website!

 

Author: Dan

Dan teaches computer networking and security classes at Central Oregon Community College.

Leave a Reply

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