Installing WordPress Locally

WordPress requires a web server with PHP support, a URL rewriting module and an instance of MySQL. The URL rewriting module that understands .htaccess directives is required for the purpose of getting search engine friendly URLs. WordPress generates search engine friendly URLs also called permalinks through URL rewriting modules. Hence, the servers such as Apache or IIS7 providing URL rewriting are popularly used for installing WordPress.

The installation process is quite simple. We need a server software (MAMP, XAMP or WAMP) and a WordPress package (download it from wordpress.org) and follow the below given steps:

  • Install a local server (Mac: MAMP, PC:XAMPP or WAMP). Figure 1 displays XAMPP control panel that automatically appears on successful installation of XAMPP. We can see that Apache and MySQL both are in running mode.

Note: Mac OS X comes with an Apache web server (with PHP and URL rewriting).

Figure 1. XAMPP Control Panel

  • Next, we have to create a new database. Select the Admin button besides MySQL from XAMPP control panel to open phpMyAdmin. In the Create new database textbox, enter the name of the new database as wordpress_local (any) followed by selecting the Create button as shown in Figure 2. After creating the database, the next thing we have to do is to set the password of the root. We will be using the user, root (that has all the privileges by default) to access the newly created database. By default, when we install XAMPP, there is no password set for the root. To set the password of the root, select Privileges link from the top (Figure 2). We get a User overview page displaying the list of default users. Select the Edit privileges icon for the root on localhost. We get a box to specify password for the root. Lets enter the password for the root as mce (any text)

Note: The phpMyAdmin is a free software tool written in PHP that manages the administration of MySQL over the World Wide Web. It helps us perform variety of database manipulation tasks quite easily.

Figure 2. Creating MySQL database through phpMyAdmin

  • Extract the downloaded WordPress package in a folder say blog (or any other name). Copy the blog folder containing the WordPress files into the root directory of our server, i.e., in its htdocs folder.
  • In the blog folder, we will see that besides other files, WordPress package provides a template configuration file also. The configuration file is named wp-config-sample.php. First, we have to rename the wp-config-sample.php file to wp-config.php and then update it to specify the information (db_name, user, password, host) of the newly created database, wordpress_local in it. Hence, open the wp-config.php file and search for the following three lines:

define(‘DB_NAME’, ‘database_name_here’);

define(‘DB_USER’, ‘username_here’);

define(‘DB_PASSWORD’, ‘password_here’);

and modify them to appear as shown below:

define(‘DB_NAME’, ‘wordpress_local’);

define(‘DB_USER’, ‘root’);

define(‘DB_PASSWORD’, ‘mce’);

where wordpress_local is the database we just created through phpMyAdmin, root is the default user with all privileges and mce is the password that we have set for the root through phpMyAdmin. Save the wp-config.php file after making these changes.

  • Open the browser and point it at the URL, http://localhost/blog/wp-admin/install.php to begin the WordPress installation process. The word, blog appears in the URL because we have renamed the WordPress package directory to blog before copying it on our web server’s root directory. On doing this, we get a Welcome page asking information for the blog that we want to create. The page represents the beginning of the WordPress’s five minute installation process. We enter the title of the blog, name, password and email address of the administrator in the respective textboxes as shown in Figure 3. Also, select the checkbox, Allow my site to appear in search engines like Google and Technorati if we are making a blog that is open for public and finally select the Install WordPress button.

Figure 3. Page showing WordPress’s five minute installation process

We get a Success message (Figure 4) declaring that WordPress is successfully installed on our local server. If we enter administrator’s name and password and select the Log In button, the Dashboard of our blog opens up to administer our blog. Later in this chapter, we will understand Dashboard and its role in administering a blog.

Figure 4.  Page confirming successful installation of WordPress

To visit our newly created blog, open the browser and point it at the address, http://localhost/blog/. Our blog is displayed with a default post, Hello world! provided by WordPress as shown in Figure 5.

Figure 5. Blog displaying the default post Hello world!

In order to open the login page again, point the browser to the following address, http://localhost/blog/wp-login.php

For more information, refer my book, Blogging with WordPress 3 for Beginners available at Amazon.

One thought on “Installing WordPress Locally

Leave a Reply

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