How to install WordPress Locally

Hi all,

In this post, I am going to explain about installing WordPress in your local computer. I started using WordPress locally because my Internet connection was very slow and I was not able to update and preview files often.

This is very useful for designers & users, who want to test new plugins and themes before using them in their own website. By installing WordPress locally you can also save time & money.

The following 5 steps will help you install WordPress locally,

  1. Install a Local Server
  2. Download WordPress
  3. Create a New Database
  4. Create configuration File
  5. Install WordPress

Install a Local Server

In order to run any PHP/database application locally in your system, you need a local host (ie., Apache + MySQL). For Linux, use LAMP. For Windows, use WAMP.

Requirements to run WordPress locally,

  • PHP version 4.3 or higher
  • MySQL version 4.1.2or higher

I am using Linux here, so I am going to install LAMP. LAMP stands for Linux, Apache, MySQL, PHP. Here is my previous post about How To Setup a LAMP Server for Ubuntu.

Download WordPress

Step 1: Download WordPress from wordpress.org.

Step 2: After downloading WordPress (.zip or .tar.bz ), extract it in a folder (say wordpress) and move the wordpress folder inside the /var/www/ directory. So now your installation url will be http://localhost/wordpress/ where you can have access to your WordPress.

Create a New Database

Step 1: Open up any web browser & type the following web address,

http://localhost/phpmyadmin/

Step 2: You will be taken to the login page and provide the root password.Step 3: Now create a database with the database name wordpress,

then create a new user: wpadmin with all privileges and password: wppass.Note: If you face problems to open WordPress url, then you must change permissions for /var/www/wordpress with this command as root in your terminal:

chmod -c 777 -R /var/www/wordpress/

Create configuration File

Step 1: To create the configuration file, open up wp-config-sample.php in /var/www/wordpress and paste the following lines of code:

 // *** MySQL settings *** // 
 define('DB_NAME', 'wordpress'); 
define('DB_USER', 'wpadmin'); 
 define('DB_PASSWORD', 'wppass'); 
 define('DB_HOST', 'localhost');

save it as wp-config.php.

The username & password specified in the wp-config file, is used by WordPress to access the MySQL database.

Install WordPress

Step 1: Run the WordPress installation script by pointing your browser to,

http://localhost/wordpress/wp-admin/install.php.

Once you have set up WordPress, you can initially log in as ‘admin’ with a system-generated password which will be emailed to you. Then set up a second administrator account with a strong password, log off and then log in with that account and delete the default ‘admin’.Choose something you will remember for both username and password.

You can login to WordPress at,

http://localhost/wordpress/wp-login.php

You can preview WordPress by pointing the browser to the below web address,

http://localhost/wordpress/

Now that we have successfully installed WordPress locally.

Hope you find this post helpful. Happy blogging šŸ™‚

Leave a comment