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:
- Update your Linux OS.
- Install Apache.
- Install MySQL.
- Install PHP.
- Install WordPress.
- 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:
- In phpMyAdmin, click on New and name your database. Importantly, remember your database name because you will need it during the WordPress installation.
- In the Collation drop menu, choose utf8_unicode_ci and click Create.
- 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.
- Click on Users > Add user.
- Enter a name for the database user; remember it because you’ll need it for the WordPress installation.
- In the Host drop-down menu, choose Local.
- Enter a strong password you will remember.
- Give all permissions to the user you are creating; select Check all.
- 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.
- 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.
- 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.
- Choose your language and click Continue.
- Enter the database name you created, your username, and the corresponding password.
- Type localhost in the Database host field, then wp_ in the Table prefix field. Click Submit.
- WordPress is ready to be installed. Click Run the installation.
- 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.
- Considering that you will be running WordPress locally, ignore any options about search engine visibility – your website will only be seen by you.
- Click Install WordPress.
- 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
- In your browser’s address bar, type localhost/wordpress and hit Enter.
- On the left sidebar of your WordPress dashboard, click on Appearance > WordPress themes.
- Choose the WordPress theme you want to install, then click on Activate.
- 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.
- 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.
- 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.
- Enter your login credentials for your hosting provider.
- 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.
- Place the index file in the public_html folder.
- Right-click on the compressed folder and choose Extract.
- Click on the cPanel logo to return to the main menu.
- Select MySQL databases, create a database, and add a database user.
- Open PHPMyAdmin and click Import, then select the database you just created.
- Set up the config files of your website according to the parameters you set during database creation.
- 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.