Skip to content

How To Install WordPress on Your Local Machine – Step by Step

  • 9 min read
  • by

Introduction

You want to install WordPress on your local machine to test themes, plugins or get familiar with WordPress without the need for a paid hosting, but don’t know where to begin? Don’t worry. We’ll teach you how. In this article, we’ll be showing you how you can install WordPress on your own. Follow the article and do as it says. WordPress will be running on your machine in no time.

Step 1: Downloading WordPress

The first thing we need to do if we want to install WordPress is to download WordPress. In this tutorial, we’re going to be using the latest version of WordPress – WordPress 5.4.2

You can get it from its website. Here’s the link: https://wordpress.org/download/

When you get there, click the ‘Download WordPress 5.4.2’ button (5.4.2 is the latest version of WordPress at the time this was written).

Screenshot Download WordPress 5.4.2

A zip file will be downloaded.

Extract that zip file. Once that is done, a folder with the title ‘wordpress’ will appear.

Screenshot WordPress folder

We’ll rename the ‘wordpress’ folder into ‘wp-test’ (although any name will do)

Screenshot rename WordPress folder

Step 2: Downloading/Installing XAMPP

The WordPress file by itself isn’t enough. We need a server to host the site. We will also need a database management system. XAMPP has both of those! XAMPP is a package bundled with a server, a database and more. It also comes with a panel that allows us to manage those components. Because of that, we’ll use XAMPP.

We need to do download it. We can get it from https://www.apachefriends.org/index.html

Download the latest version of XAMPP.

Screenshot XAMPP for Windows

Save the installer. Alternatively choose to run the installer directly.

Once the installer shows, click ‘Next’

Screenshot Setup - XAMPP

it will show which components are available for installation.

To run WordPress site and to manage its database , we only need to include the packages shown in the image. However, you are free to include the other modules if you need them.

Screenshot XAMPP select components

Choose a folder to store the XAMPP directory. In our case we will choose to install XAMPP in C:\xampp. Once that is finished, click ‘Next’

Screenshot XAMPP choose folder

Step 3: Creating Databases and Users for WordPress

We need to create a database. For WordPress, It’s necessary. But don’t be daunted (if you don’t know how or if you do but find it tedious). XAMPP Is bundled with a Database Management System – phpAdmin.

We will use phpMyAdmin to create a database.

To proceed, go to C:\xampp.

Next, click on ‘xampp-control’. It will open window

Screenshot go to C:\xampp.se

What you will see is a control panel for managing the different XAMPP modules.

Look for the Apache and MySQL modules.

Click ‘Start’ on the Apache Module. Click ‘Start’ on the ‘MySQL’ module as well

Screenshot XAMPP click Start

Once the modules starts, click ‘Admin’ to start phpMyAdmin.

Screenshot XAMPP click Admin

A browser window will open. Here is where we manage databases. Click on the ‘Databases’ link.

Screenshot phpMyAdmin click database

The Database fields will be seen. For the purposes of this tutorial, we will be naming the database for our WordPress site as ‘first-wp-db’. We will type our database name in the ‘Database Name field’. Click ‘Create’ once that’s done.

Screenshot phpMyAdmin naming database

Once the database is created, it will redirect to a new tab – the database ‘Create Table’ tab.

For now, we don’t need to create tables. The database just has to be ready (this database will be populated by WordPress once the WordPress site is installed.

Screenshot phpMyAdmin 'Create Table'

We will also need to create a user that has access to the database.

Click the phpAdmin logo to get back to the phpAdmin homepage.

Screenshot phpMyAdmin homepage

Once there, click ‘User accounts’.

Screenshot phpMyAdmin click user accounts

Once redirected, click ‘Add user account’

Screenshot phpMyAdmin click add user account

The following screen will be displayed. We can add database user accounts here

For this tutorial, the username we will be using is ‘wordpress-user’. Our password is ‘password’

Leave the options in ‘Global Privileges in their default (do not click any checkbox)

Screenshot phpMyAdmin add user account

Scroll down the page. And click ‘Go’

Screenshot phpMyAdmin click go

Click the ‘User accounts’ tab once finished. Once there click the ‘Edit Privileges’ link for the newly created user

Screenshot phpMyAdmin click edit privileges

When the page redirects, click ‘Database’

Screenshot phpMyAdmin click Database

Add privileges to the Database created for WordPress (in this case ‘first-wp-db). Once done click ‘Go’

Screenshot phpMyAdmin add privileges

The page will refresh with options for the database privileges. In this tutorial, we will be checking ‘Check All’. Afterwards, click ‘Go’

Screenshot phpMyAdmin click check all and go

Take note of the Server in the resulting page. This is usually ‘127.0.0.1’ also known as “localhost” (check your host file)

check your host file

We’re done, the database user and database have been created.

We can proceed to the next part (and you may choose to do so).

However, this is important. Please look at the image below.

The boxed area shows that username ‘root’ also has ‘ALL_PRIVILEGES’. So it also has access to any database created for our WordPress site. We could have chosen not to create a database user in the first place (and use ‘root’)

Screenshot phpMyAdmin

(Step 4) Setting Up ‘wp-config.php’ (Optional)

This step is optional since WordPress will create a wp-config.php file upon installing.

However, if you want to configure it on your own, go inside the folder that was extracted in Step 1. Look for ‘wp-config-sample.php’. Open the file.

You will see the following lines. Modify it in accordance with the database configuration settings you did from Step 3. (For instance, ‘DB_NAME’ is the name of the database you created. This will define the variables needed to access the WordPress database.

Code with the database configuration

For this tutorial, I modified the definitions with the configuration settings I did in step 3.

(Note: As was mentioned in the official WordPress installation – https://wordpress.org/support/article/how-to-install-wordpress/DB-CHARSET should not be changed and DB_COLLATE should be left blank.)

Code

Save the file as ‘wp-config.php’

Step 5: Installing WordPress

We are now ready to install WordPress and deploy it on our local server

Go to C:\xampp\htdocs and paste the extracted folder from Step 1 inside C:\xampp\htdocs.

In this tutorial, we renamed the extracted folder to ‘wp-test’ (Note: the name of the extracted folder will be the name of our WordPress site. If you didn’t rename the folder, the WordPress site will have the name ‘wordpress’)

renamed the extracted folder

Open a web browser.

To access our site, type localhost/foldername.

In this tutorial the foldername is ‘wp-test’. So we will type ‘localhost/wp-test’ in the address bar.

web browser with localhost/wp-test

It will redirect to this page below. Pick a language and click ‘Continue’

Choose a language

If you chose to skip creating the ‘wp-config.php’ file a shown in Step 3. You will be redirected here to this page. You will be asked for your database credentials and information. To proceed, click ‘Let’s Go’

Click "Let's go"

Fill in the fields. (The page will ask for the defined values found in ‘wp-config.php’. In particular, the values we edited.) Once done click ‘Submit’

fill in the fields

We’re almost there! Click ‘Run the installation’

Click "run the installation"

You will be redirected to this page. Fill in the details. Once done click ‘Install WordPress’

Click "install WordPress"

Conclusion

We’re done! We can now install WordPress on our local machines. We can now start working on our WordPress site.

nv-author-image

Kristin Eitel

Leave a Reply

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