January 16, 2024
WordPress logo on a web browser window illustration

There are several ways to install WordPress locally on your computer, but all of them have one core thing in common – you’ll need a localhost environment.

This guide will explain what a localhost WordPress installation refers to and why it’s useful. Next, you’ll discover which WordPress localhost environment is best for your operating system. Lastly, you’ll learn how to install WordPress on localhost using WAMP, MAMP, XAMPP, and LAMP.

What is localhost?

Localhost is a computer term that basically means “this computer,” the one you’re currently using. When applied to a WordPress installation, it refers to a website running entirely on the computer you’re viewing it from.

This isn’t the typical browsing experience. Typically, when you use a browser to visit a website, your computer receives that data, sent over the internet from a host server — essentially a powerful computer tasked with sending everyone files to be displayed as webpages.

In contrast, viewing a localhost website installation means your own computer is the source of every file needed to display the website. On the other hand, the website isn’t public — no one else can access it.

What is localhost used for? It’s an opportunity to create and test an unfinished WordPress website without paying for hosting yet.

The benefits of installing WordPress locally

The advantage of installing WordPress locally is that you will have more privacy and flexibility to experiment with different settings. This can speed up your website development and testing processes.

Considering that all of the files are stored locally, it won’t be necessary to use an FTP connection to a web hosting server — you don’t even need an internet connection.

Can I run multiple local WordPress websites?

Yes, it is possible to run multiple WordPress websites locally. All you need to do is create separate folders for each website — name them WPsite1 and WPsite2, for example — and use different databases for each website.

How do I use WordPress on localhost?

In order to install WordPress locally, you need an Apache web server, a database management system called MySQL, and a programming language called PHP.

Your web browser is everything you need to view the website you have created locally.

After installing a WordPress localhost environment using the steps outlined later in this guide, you will have all these components ready. But first, you must pick between the best localhost environments to use.

What’s the best localhost environment for WordPress?

The type of WordPress localhost environment you use depends on the operating system installed on your computer. Most WordPress localhost environments are optimized to work on multiple operating systems, but each environment is optimized for a specific one.

There are four top-tier WordPress localhost environments for you to choose from: XAMPP, WAMP, MAMP, and LAMP.

XAMPP

XAMPP is an acronym for cross-platform, Apache, MySQL, PHP and Perl. It’s a multi-platform local server environment created by Apache Friends.

XAMPP is eligible to work on all three of the most used operating systems – MacOS, Linux, and Windows. However, it’s optimized best for Windows.

Download XAMPP for free from the Apache Friends official website. Get the latest version unless you have a prebuilt website needing an older PHP version.

WAMP

WAMP stands for Windows, Apache, MySQL, and PHP. As you can guess, it’s best suited for Windows systems to run a local server environment. Download the latest version from WampServer to get started.

MAMP

The first letter of MAMP represents MacOS, which is what these local server environments are optimized to run best on. However, it’s also possible to install MAMP on WIndowsOS. Download MAMP to start.

The “A” in MAMP stands for Apache, as usual. Notably, the second “M” can be MySQL or MariaDB – both are database management systems. Likewise, the “P” can be one of three web dev programming languages: PHP, Python, or Perl.

LAMP

If you are a Linux enthusiast, LAMP is the perfect choice for you to test your WordPress website locally. In order to install the LAMP stack on your Linux machine, you will have to set up each component one by one. To create a running localhost environment on Linux, follow these steps in order:

  1. Update your Linux OS.
  2. Install Apache.
  3. Install MySQL.
  4. Install PHP.
  5. Install WordPress.
  6. Create a database for your WordPress website.

How do you install WordPress on localhost?

WordPress runs on PHP; therefore, PHP must be installed on the server running WordPress.

With a public website, your web hosting company usually handles PHP installation – but on localhost, PHP is included in the local server environment installation, whether XAMPP, MAMP, or otherwise.

Furthermore, you need a database for your WordPress website. You wouldn’t need to consider this while renting a web server, but you do need to consider it while installing WordPress on your own computer.

Follow the steps below to install WordPress locally.

1. Download and install a local server software

Pick and install one of the local server environment solutions described earlier in this guide. If you need assistance, consult our knowledge base for tutorials on installing the local server environment you prefer.

2. Download the latest version of WordPress

Download the latest version of WordPress from the official website.

3. Create a database for your install

Make a database and a user to access files using phpMyAdmin, which you can open via your browser’s address bar; type localhost/phpmyadmin and hit Enter.

Follow the steps below to create a database and user for your WordPress website:

  1. In phpMyAdmin, click on New and name your database. Importantly, remember your database name because you will need it during the WordPress installation.
  2. In the Collation drop menu, choose utf8_unicode_ci and click Create.
  3. Considering that you do not have a user already, go back to the main menu by clicking on the phpMyAdmin logo in the upper left corner.
  4. Click on Users > Add user.
  5. Enter a name for the database user; remember it because you’ll need it for the WordPress installation.
  6. In the Host drop-down menu, choose Local.
  7. Enter a strong password you will remember.
  8. Give all permissions to the user you are creating; select Check all.
  9. Finally, click Go.

Congrats, you have successfully created a database for your WordPress website.

4. Install WordPress locally using your server software

Next, install WordPress on your computer using the localhost environment you have set up.

  1. Open the directory where you have downloaded wordpress-6.0.2.zip. Extract the zip file to the htdocs folder in the local server environment’s directory.
  2. Let’s assign the database you created for your WordPress installation. Do this by opening your browser and typing localhost/wordpress into the address bar. Alternatively, replace “wordpress” with the name you chose for your database. Hit Enter, and you should see a WordPress installation page.
  3. Choose your language and click Continue.
  4. Enter the database name you created, your username, and the corresponding password.
  5. Type localhost in the Database host field, then wp_ in the Table prefix field. Click Submit.
  6. WordPress is ready to be installed. Click Run the installation.
  7. You should see a welcome screen. Enter some info about your WordPress website (you can change all of this later), including your website’s name, your username, a strong password you’ll remember, and your email.
  8. Considering that you will be running WordPress locally, ignore any options about search engine visibility – your website will only be seen by you.
  9. Click Install WordPress.
  10. When the installation is complete, enter the login credentials you created most recently.

Well done: You have successfully installed WordPress on localhost.

5. Troubleshoot and test

By successfully installing WordPress locally, you can now edit, test, and troubleshoot a website, including plugins and themes. Furthermore, you can conduct cross-browser testing.

Experiment with different operating systems, screen sizes, and mobile devices to confirm that your WordPress website works well on a wide array of popular platforms.

One of the main ways to optimize your WordPress website is to use a top-tier theme. What if you want to switch themes from within localhost? Follow the steps below.

How to install a theme in WordPress on localhost

  1. In your browser's address bar, type localhost/wordpress and hit Enter.
  2. On the left sidebar of your WordPress dashboard, click on Appearance > WordPress themes.
  3. Choose the WordPress theme you want to install, then click on Activate.
  4. To install a premium WordPress theme you have purchased elsewhere and downloaded, head to Upload, unzip the compressed file, click Install, and finally, Activate.

Moving WordPress to a live host after local development

Once you’re satisfied with your website, here’s how to move it to a live host.

  1. Go to the directory where the folder of your complete website is located. Compress the whole website folder by right-clicking on it and selecting Compress to a Zip file.
  2. Navigate to your web hosting browser’s dashboard. You can typically do so by opening your browser; in the address bar, enter your domain name followed by “/cpanel” – for example, mywordpresswebsite.com/cpanel.
  3. Enter your login credentials for your hosting provider.
  4. When cPanel opens, click on the file manager and locate the folder named /public_html. Remove the default files in the /public_html folder. Replace them with your compressed website folder by clicking on the Upload option and selecting the zipped website folder.
  5. Place the index file in the public_html folder.
  6. Right-click on the compressed folder and choose Extract.
  7. Click on the cPanel logo to return to the main menu.
  8. Select MySQL databases, create a database, and add a database user.
  9. Open PHPMyAdmin and click Import, then select the database you just created.
  10. Set up the config files of your website according to the parameters you set during database creation.
  11. Click Go.

Congratulations, you have successfully uploaded your WordPress website to a live host. The website should now be publicly available on the internet.

Final thoughts: Using localhost with WordPress

Now you know how to install WordPress on localhost using WAMP, MAMP, XAMPP, and LAMP, and you know how to install themes in WordPress on localhost.

Once you have created your WordPress website locally, publish it in minutes with Nexcess, then sit back and relax. With the fully managed WordPress hosting plan, you can now let Nexcess experts handle setup, admin, and maintenance whenever you want.

For even more assistance with your website goals, you’ll enjoy 24/7 service from the support team.

If you’re not hosting your WordPress website with Nexcess yet, check out our fully managed plans to get started today.

Neil Golden
Neil Golden


Neil tried to help solve the complex puzzle of evolution for a long time by obtaining his PhD in Archaeology. Nowadays, he just uses the Linux command-line tools in his role within the Liquid Web Abuse & Security Operations Department, instead of Paleolithic stone tools in the caves on his archaeological digs. And instead of mammoths, he is now hunting for malware on Linux servers.

He has written numerous scientific and technical articles because writing is one of his biggest passions. In his free time, Neil composes music, reads novels, and travels the world.

We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.