Install WordPress in a Few Quick Steps

Use WordPress to Create Your own Website

WordPress is a very simple content management system with extreme plugin support.  Because it is so popular, you can get plugins and themes that can help you create nearly any simple website just by using plugins and themes that the user community has shared.

When I install a wordpress blog I prefer to host it on a full VPS rather than on shared hosting.  If you are worried about the cost of a full VPS, then you should look at one of DigitalOcean’s small plans.  For just $5 a month, you can have a full VPS complete with all of the benefits and features.  For the purpose of this article, I will assume that you have a full machine or VPS that you can install with.  I used CentOS 6.4 for this article.

For the purposes of this article, I want to create a phone directory for my company with all of the employees phone numbers and email addresses.  You will see references to a webpage named “phonedirectory” which is what I used for my webpage in this example, yours will be named however you choose.  So, let’s get started on the topic of:  Install WordPress in a Few Quick Steps

Step 1 – Install the Prerequisites

WordPress runs on php and requires a database –typically MySQL– to run properly.  For this article, we will install the MySQL community database.  To begin, we need to install all of the packages required to run MySQL.  Also, since WordPress was written in php, we need to install the typical php packages so that it will also run properly.  Additionally, we need a http daemon to serve our wordpress pages to people’s browsers.  We will use Apache by installing the httpd package.

# yum install mysql mysql-server mysql-php php-cli php-xml php-mbstring php-mysql php-common php php-pdo php-gd httpd

 

Step 2 – Configure MySQL

To get MySQL running properly, we need to configure it with some really simple configuration to get started.  I always set my table names to case insensitive before creating my objects and I also want to be sure that I have plenty of connections available for apache to connect to my database.

Edit /etc/my.cnf  put these lines under mysqld region:

lower_case_table_names=1
max_connections=100

Setup MySQL to start at boot time:

# chkconfig mysqld on

Restart MySQLd

 # service mysqld restart

Give MySQL a root password by running the mysqladmin command and telling it the password you wish to use for mysql.

mysqladmin -u root password <put root password here>

Step 3 – Create a Database for WordPress

Now, with MySQL up and running and a password set, we can create a database for WordPress to store all of its tables and data in:


# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.69 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> create database phonedirectory
-> ;
Query OK, 1 row affected (0.00 sec)mysql> grant all on phonedirectory.* to 'phonedirectory'@'localhost' identified by 'phonedirectory';
Query OK, 0 rows affected (0.00 sec)

In the case above, I created a user named: phonedirectory  with a password of “phonedirectory”.  I would suggest setting a password with proper length and complexity.  This user will be used by WordPress to login to its database.

Step 4 – Install WordPress

Now that we have a database setup for WordPress, the next step is to install WordPress itself.  You will want to decide where to put your WordPress files for Apache to serve.  In my case, I just created a directory named “www” in the / directory.  Inside this directory, I plan to have another directory where my phonedirectory wordpress instance will reside.  I will rename the wordpress directory to “phonedirectory” to make that work.  So, the next several steps are to create our directory, download wordpress and rename the directory.

# mkdir /www
# cd /www
# wget http://wordpress.org/latest.zip
--2013-09-26 15:18:23--  http://wordpress.org/latest.zip
Resolving wordpress.org... 66.155.40.249, 66.155.40.250
Connecting to wordpress.org|66.155.40.249|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4475880 (4.3M) [application/zip]
Saving to: “latest.zip”100%[======================================>] 4,475,880   2.19M/s   in 1.9s2013-09-26 15:18:26 (2.19 MB/s) - “latest.zip” saved [4475880/4475880]
# unzip wordpress.zip
# mv wordpress phonedirectory
# chown -R apache:apache /www/phonedirectory

Since WordPress is running as the apache user, we give it the ownership.

Step 5 – Configure WordPress

Now that we have our WordPress directory all setup we need to configure WordPress to talk to its database.  We do this by creating and editing the wp-config.php file.  WordPress ships with a sample wp-config.php file, so we will use it to begin from.

cd /www/phonedirectorycp wp-config-sample.php wp-config.php

Now, we edit the wp-config.php file with our favorite editor being certain to replace these bolded fields:

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

with the username, password, and database name that you chose above in step 3.  You may remember that I set all of these to “phonedirectory” for this simple example, so I put them in my file below:

/** The name of the database for WordPress */
(‘DB_NAME’, ‘phonedirectory‘);

/** MySQL database username */
define(‘DB_USER’, ‘phonedirectory’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘phonedirectory‘);

With WordPress configured to talk to its database, we are now ready to configure Apache to know where WordPress has been installed.

Step 6 – Configure Apache for WordPress

While there are lots of things that you can do to configure Apache for WordPress for security, performance, etc…, we will focus on what is required for functionality in this step.  We first need to ensure that our Apache configuration file has NameVirtualHost enabled.  To verify this, edit the /etc/httpd/conf/httpd.conf file and ensure that the “NameVirtualHost” line is not commented out with a # mark.

NameVirtualHost *:80

With that set, I now need to create a configuration file specifically to enable Apache to find and serve the WordPress files so I change to the /etc/httpd/conf.d directory and create a wordpress.conf file.

Now, I edit the /etc/httpd/conf.d/wordpress.conf file and put the following lines in.  Be certain to modify the lines as needed to fit your choices made above for destination as well as the domain name that you will create authority records for this site.

My /etc/httpd/conf.d/wordpress.conf file:

<VirtualHost *:80>
ServerName phonedirectory.uptimemadeeasy.com
ServerAlias phonedirectory.uptimemadeeasy.com
DocumentRoot “/www/phonedirectory”
CustomLog logs/phonedirectory.com-access_log combined<Directory “/www/phonedirectory”>
Options FollowSymLinks MultiViews Includes ExecCGI
AllowOverride All
</Directory></VirtualHost>

With our Apache configuration file complete, we are ready to restart our Apache daemon

service httpd restart

Step 7 – Complete WordPress Configuration

We are now ready to finish our initial WordPress configuration by browsing to our webpage!  This assumes that you have configured your domain’s DNS records to point to the machine we are working on.  In my case, I browsed to:  http://phonedirectory.uptimemadeeasy.com (Note:  you will not be able to access this as it is private and is not publicly hosted.

We need to complete the following fields:

  • Site Title – This is what we want to name the website.
  • Username – This is the default administrator userid that can login to the wp-admin to configure our WordPress instance.
  • Password – We need to enter it twice
  • Your Email Address – Enter your email address and your WordPress instance will use it to communicate important events with you.

Once you have populated the fields, hit the “Install WordPress” button which will cause WordPress to login to its database, create its tables and populate them with default data.

Finish WordPress Configuration

Finish WordPress Configuration

Now, that we have completed the initial WordPress configuration, we should be able to browse to it and take a look!  Here’s what my webpage looked like when I got to this point:

Default WordPress Webpage

Default WordPress Webpage

Our WordPress webpage is installed!

Step 8 – What’s Next?

Now that your WordPress installation is complete, the sky is the limit as to what you can make it do.  However, there are seveal steps that I would suggest that you begin with:

  • WordPress Security – One of my friends has written several blog articles on WordPress security.  I would suggest reading these articles specifically:  http://chasesagum.com/10-steps-protect-wordpres  and http://chasesagum.com/the-only-4-wordpress-security-plugins-you-need.  Additionally, you will want to setup a firewall to protect the machine from other types of attacks.
  • Change the Look and Feel – You can pick from stacks and stacks of themes that have been created and shared by others.  Many are free and others can be purchased for small fees.  Go to your wp-admin page / Appearance / Themes and search for new ones.  You can also search at:  http://wordpress.org/themes/
  • Plugins for Features – There are so many different plugins that you can run on your WordPress.  I have found plugins that transform your WordPress website into a full invoicing system, others that give you fun holiday themes.  Others that offer functional benefits such as Connections to help you setup — You guessed it — my phone directory for the company.

 

 

The following two tabs change content below.
Jeff has 20 years of professional IT experience, having done nearly everything in his roles of IT consultant, Systems Integrator, Systems Engineer, CNOC Engineer, Systems Administrator, Network Systems Administrator, and IT Director. If there is one thing he knows for sure, it is that there is always a simple answer to every IT problem and that downtime begins with complexity. Seasoned IT professional by day, Jeff hopes to help other IT professionals by blogging about his experiences at night on his blog: http://uptimemadeeasy.com. You can find Jeff on or LinkedIn at: LinkedIn or Twitter at: Twitter

Latest posts by Jeff Staten (see all)

Leave a Reply

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