Whether you are a developer or just new to WordPress, you may want to setup and install WordPress on localhost. From testing your themes, changing configurations, and so much more. There are so many great reasons to install wordpress on localhost using XAMPP!
Steps to Install WordPress on Localhost
- Download and run the XAMPP Installer
- Start the localhost web server modules
- Download WordPress from the official website
- Create a database for WordPress
- Install WordPress using the auto-installer
- Go to the WordPress localhost login page
Step 1. Download and run the XAMPP Installer
Once you have decided to install wordpress on localhost, you need to have a localhost web server running on your localhost machine. And as always, I default to XAMPP from ApacheFriends.org.
Download the official XAMPP installer from their website. Once the download is complete, open the installer with administrative privileges. Trust me, you will need it.
On the XAMPP installer, click through like any other installer. But stop to take a look at the “Select Components” options (aka modules). Be sure you have MySQL, phpMyAdmin, and PHP selected at the very least. However, I recommend installing all the available components. This way you can later create a localhost FTP server or even send emails from your localhost server.
After you have selected the desired localhost web server modules to install, you will be asked the location to install the localhost web server to. Again, I recommend going with the default of C:\xampp. There is really no reason to change away from that installation directory.
Go ahead and click through the rest of the XAMPP installer. This will complete the install of your localhost web server.
Security popup from your new web server
Either during at the end of your installation, or in the next step while starting the web server modules, you may get two security popups. This is totally normal. These security popups are you allowing the APACHE and MySQL server applications to actually access your local network.
On both security popups, ensure the check box for “Private networks” is checked and the check box for “Public networks” is NOT checked. This will only allow users on your local network to access your new localhost web server.
Step 2. Start the localhost web server modules
After the XAMPP installer is complete, open the XAMPP control panel. Either from the option at the end of the installer or from the Windows start menu.
From the XAMPP control panel, we will need to run two modules in order to install WordPress on locahost. APACHE and MySQL. Click on the Start button next to each of these modules.
Once both the APACHE and MySQL modules are running, you will notice that they both turn green. Which is exactly what you want. If for some reason, one or both do not turn green they you will need to troubleshoot why XAMPP is unable to start the modules.
Your localhost web server is now live!
With both APACHE and MySQL running, you can test your localhost web server by clicking the “Admin” button next to APACHE or browsing to http://localhost in your favorite web browser. Both options take you to the same place. Your running localhost web server, perfect to install a local WordPress website on.
Think of this web address as your localhost domain name.
This localhost web address will display all the files and folders from inside the htdocs folder of your XAMPP installation directory. (e.g. C:\xampp\htdocs).
Any files and websites you want to be viewable from your localhost web server go in the htdocs folder. Like your localhost WordPress website!
Step 3. Download WordPress from the official website
Now that you have your local web server ready to install WordPress, you need to get WordPress! Browse on over to the official WordPress.org website and download the latest version of WordPress. (No matter what version is the latest version, your localhost install of WordPress will work)
Once the download of the zip file is complete, you will need to place it and extract it inside of the htdocs folder. This will make it so you can open your localhost WordPress website from the web browser.
Step 4. Create a database for WordPress
Almost ready to get your localhost WordPress website up and running. But first we must create the MySQL database to store all of the WordPress settings and content. We will create the MySQL database using phpMyAdmin (which was installed with XAMPP).
In your web browser, navigate to http://localhost/phpMyAdmin to open phpMyAdmin. From here you will be able to manage all of your localhost databases for WordPress or any other websites you have running.
From the phpMyAdmin home page, you should see a “Create Database” section. Simply enter a name for your new WordPress website’s database and click “Create”. I am going to name the database “wordpress”. Nice and simple.
After you create the database, you may be redirected to another page that looks like the one above. That’s alright. You can go ahead and close out of phpMyAdmin. Or….
To learn more about phpMyAdmin, check out my introduction to phpMyAdmin article. You will learn some of the basic must-know info about how to use the powerful MySQL database manger tool.
I also recommend beefing up your localhost server security by adding a MySQL account password.
Step 5. Install WordPress using the auto-installer
With your localhost server, WordPress files, and your snazzy new database ready to go. We can actually install your localhost WordPress website.
In your web browser, navigate to the folder you extracted the WordPress files to from the step above. (e.g. http://localhost/wordpress). This page will start to walk you through the WordPress auto-installer. It is simple and great.
Select your language and click “Continue”. Read through the next page and then continue when you area ready. On the third page, the WordPress auto-installer will ask you for your database connection information.
Enter your database connection information like so:
- Database Name: (the database name you created earlier, mine is “wordpress”)
- Username: “root“
- Password: blank (aka no password, leave the text box blank)
For the username and password, by default your MySQL user account will be “root” with a blank password (aka literally no password set). If you have not already configured a secure MySQL account, then simply use the default settings.
Leave the database host set to the default of “localhost”. You can also leave the table prefix setting the same as well. Click Submit, then click the “Run the Installation” button on the next page.
At this screen of the auto-installer, you can give your localhost WordPress website a title and create your first admin user account. Once satisfied, click the final “Install WordPress” button.
Step 6. Go to the WordPress localhost login page
Now you have completed the install of your localhost WordPress website. You can go navigate over to your WordPress localhost login at: http://localhost/wordpress/wp-admin
Login to the WordPress localhost login admin page and get started with your WordPress living!
What to do with your localhost WordPress website?
For starters, I would beef up the security of your localhost web server by actually setting a MySQL account password. Priority number one!
After that, I would start to install some themes and plugins inside of WordPress. Start to tinker around if you are new to WordPress. This new localhost WordPress website you have running is THE best way to learn how to actually operate WordPress. Happy tinkering!