How to Install WordPress on Localhost

Before we begin installing Wordpress on Localhost make sure that you have installed a web server (Apache) with PHP and MySQL and they are running properly.

Download the latest version of Wordpress at http://wordpress.org/

After you've finished downloading the file, unzip the file and copy all files and folders into the Apache Document Root.

If you follow the instruction here on "How to install Apache Server on Windows 7" the Apache Document Root is "D:\My Websites"

Please read the Wordpress "readme.html" included in the Wordpress installation folder to ensure that your Local Server meet the minimum system requirements.

As for this example, I am using Wordpress 3.3.1, the system requirements are PHP version 5.2.4 or higher and MySQL version 5.0 or higher.

And the System Recommendation is the "mod_rewrite" Apache module.

The mod_rewrite is a rule-based rewriting engine to rewrite requested URLs such as htaccess. To enable this module open up the Apache configuration file located in "C:\Apache\conf\httpd.conf" and find the following line:

#LoadModule rewrite_module modules/mod_rewrite.so

Uncomment the module to enable it:

LoadModule rewrite_module modules/mod_rewrite.so

In the Directory DocumentRoot find the line below:

AllowOverride None

Change it to:

AllowOverride All

Save the file and restart the Apache Server.

Installing WordPress

In this example, I am using default MySQL database called "test" if you want to create a new MySQL database you can follow the instruction here on how to create a MySQL database.

In the Wordpress Root directory (D:\My Websites) rename "wp-config-sample.php" to "wp-config.php".

Open the wp-config.php with Text Editor (Notepad), find and fill in the following lines:

define('DB_NAME', 'database_name_here');
define('DB_USER', 'username_here');
define('DB_PASSWORD', 'password_here'); /* Enter MySQL password */
define('DB_HOST', 'localhost');

Here's what I have done with my wp-config.php, you have only to change the DB_PASSWORD if you use the "test" database and left the rest as it is.

define('DB_NAME', 'test');
define('DB_USER', 'root');
define('DB_PASSWORD', 'xxx'); /* Enter MySQL password */
define('DB_HOST', 'localhost');

Save the file.

Now open up your browser, in the address bar type in "http://localhost" or "localhost"

Click here to see the result and follow the rest steps.

Another way, you can also create Wordpress configuration file without editing "wp-config-sample.php". Just after you copy all Wordpress files and folder into your document root, open up your browser, type in "http://localhost" or "localhost" and then press Enter.

Install WordPress 01

Click "Create a Configuration File"

Install WordPress 02

Make sure that you already know the Database Name, Username, Password and Host. Click "Let's Go!" to continue.

Install WordPress 03

Fill in the Database Name, User Name, Password and Database Host. Click "Submit"

Install WordPress 04

If you entered the correct data, you'd see the above window, click "Run the install"

Install WordPress 05

Fill in the Site Title, Username and Password. Don't forget your Username and Password, we need them to be able to login later on. Your E-mail and Privacy are not too important, you can enter a fake email as well. Click "Install WordPress" to install Wordpress.

Install WordPress 06

Click "Log In" to manage your new blog.

Install WordPress 07

Enter your Username and Password, and then click "Log In"

To view your new Wordpress Blog, navigate to "http://localhost"

Congratulations!

2 comments:

  1. Very helpful. I was reluctant to do it but your article gave me the confidence to try it

    ReplyDelete
  2. Perfect instructions and it went just fine. Thanks!

    ReplyDelete