install-wordpress-locally

Install WordPress Locally

When you are developing a new website, you will more than likely want to setup a working copy on your local machine. Here you can quickly and easily build the site, before migrating it to a development server online and then finally, to the final ‘live’ server.

For this tutorial, I will be using a Mac but the process is almost exactly the same if you are on Windows.

I will also assume that you have downloaded and setup either MAMP (for Mac) or WAMP (for Windows) or maybe you have XAMPP, which runs on both. If you haven’t already, choose one, download it and install it. I will be using MAMP PRO for this tutorial as that is what I use on a daily basis.

Download WordPress

Head on over to the WordPress.org website, and download the latest version. Once downloaded, unzip the folder and drag or copy the folder to your localhost folder. Rename the folder to the name of your website.

download-wordpress
Click to enlarge

 

The next thing you’ll need to do is open the folder, locate wp-config-sample.php and open it in your code editor. We need to enter the database details in here, in just a sec, so keep it open.

Setup Database

You will now need to create the database. Open phpMyAdmin. You can usually find this on the start page of your MAMP, WAMP or XAMMP installation.

setup-database
Click to enlarge

Click New, then enter your database name into the Create database field. I tend to name it the same as the root folder of the new site I am creating. Then click Create. Click the Users tab at the top, and then Add User.

You will now need to enter a user name, choose localhost and enter a password. Make sure to copy that password. Scroll down, and click Check All, and then click the Go button in the bottom right hand corner.

setup-user
Click to enlarge

 

Install WordPress

Now, let’s go back to our code editor and add in the database details into wp-config-sample.php file. Save the file and then rename it to just wp-config.php

wp-config-file
Click to enlarge

 

Visit the URL that your site is located at. Mine was: http://localhost/WordPress/Tutorials/test-website/

You should now see the installation page which allows you to choose a default language. Choose your language, and click continue.

On the next page, you can enter the Site Title, User Name, Password and Email Address. Under Privacy, I would uncheck the box. Whilst working locally, or within a development server setup,  you don’t want or need to let google know the site is there.

install-wordpress
Click to enlarge

 

But remember! When you are ready to launch the website, visit Settings > Reading and uncheck the ‘Discourage search engines from indexing this site’ box.

search-engine
Click to enlarge

 

Complete the installation steps and log in. You’re done.

Error establishing database

This means that the website cannot find the database. Double check the details in phpMyAdmin and the wp-config.php file.

Leave a Reply

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