In the context of a network, localhost refers to the specific computer you’re working on right now. So, rather than your computer trying to find content, images, and other things by going through the internet and back, localhost tells it to look directly at itself, i.e., the local machine.
Rather than looking up a specific, unique IP address, all IPv6 enabled network devices use ::1 as the localhost address, whereas IPv4 enabled network devices use the IP address 127.0.0.1. Therefore, localhost can be thought of as a “loopback address” that’s useful for testing programs and apps, site blocking, and running speed tests.
It’s not simply a technical term for your computer; it’s an address or reserved domain name that you can use in-network programs for testing and much more.
In this article, we’ll go over a step-by-step tutorial on how to install WordPress on localhost. But before that, let’s talk more about why you might need to use localhost with WordPress in the first place.
Why would you use localhost with WordPress?
As a developer, you might need to set up a site in a localhost environment for personal purposes. In other words, you’re building a site that isn’t meant for users or other audiences. This site is only visible to you.
Developers often need to create a locally hosted site to test the end result of their developer solution and see how it works with other apps and programs. This way, they can check for issues and make changes, updates, and configurations before the product is launched.
Put simply, localhost sites help developers check their products (themes, plugins, and apps) to ensure quality and diagnose any issues.
As a WordPress user, you should also create and use localhost websites to ensure your site functions smoothly. For example, you can create a localhost version of your live website. This way, you can test out new features (plugins, themes, or code snippets) before adding them to your site.
You can also use localhost with WordPress if you’re setting up access to your WordPress site database. For instance, when you’re editing the wp-config.php file.
So, the main purpose of a localhost website is to enable you to prepare for your final product – whether that’s a plugin, theme, app, or website. Creating a localhost site means that you can test out necessary updates and present perfectly working site pages to your audience or clients.
Installing WordPress locally
You can use general or WordPress-specific tools to create a WordPress development environment that is essentially a web server on your own computer. Some of the most popular tools to install WordPress locally on your machine include DesktopServer, WAMP, MAMP, and XAMP (for Linux).
Installing WordPress locally using DesktopServer
DesktopServer is a useful WordPress tool that lets you easily install WordPress locally i.e create a WordPress localhost.
You can use it to run a new development install within a few minutes. This solution also supports WP-CLI and multisite and is compatible with both Windows and macOS.
Step 1: Download DesktopServer to Your Computer
Start by downloading DesktopServer from its official website. You can choose to download a Windows or a macOS version depending on your operating system.
Simply click on the Free Download button on the top right side of the page. The zip file will automatically start to download.
Step 2: Launch the Installer
After the file has finished downloading, unzip it. Next, you’ll need to run the DesktopServer installer. Simply click on Install DSL.
When you run the program for the first time, you’ll be asked to relaunch with administrator privileges. Accept the terms of services and select an option for the program installation.
Keep the New Desktop Installation option selected and click the Continue button. This initiates the installation process.
Step 3: Start Apache and MySQL Services
Once it’s done installing, you’ll see a popup window saying the program has successfully been installed. It also gives you information about where the application is installed on your machine. At this point, you can choose which plugins to enable.
After you’re done, click Next. You’ll be asked if you want to start web and database services. Simply click the Next button again.
Step 4: Create a New localhost Site
After you’ve enabled the plugins and started the web and database services, proceed to select Create a new development website.
Here the DesktopServer will install the WordPress CMS for you. You can choose your website’s name, which will also serve as its local address. By default, DesktopServer gives you the latest version of WordPress, so you don’t need to manually download it from the official website.
When you’re done, click on the Create button. The URL of your local WordPress install will be shown on the screen. Simply click that link to complete the installation.
Step 5: Install WordPress
Clicking the URL of your localhost WordPress install will open up your local WordPress website in a new browser tab.
You’ll be prompted to enter a title for your website and create a username, a strong password, and your email address.
When you’re done making changes, click the Install WordPress button. That’s it! You can now open up your localhost install and test it out.
After you set it up, type in “localhost” into your browser address bar. IPv4 enabled network devices use the IP address 127.0.0.1. You will automatically be redirected to your new “website” even though it’s not actually on the web. Moreover, your MySQL database will likely be located in the same place.
This gives you a “safe” environment to try out the entirely free WordPress.org CMS, the most used CMS on the internet. This means that you can experiment with what it can do without paying for hosting or worry about maintenance, upkeep, or security. It’s particularly useful for anyone looking to build a website, either for themselves or for a client.
What are the advantages of using WordPress.com?
So, let’s say you’ve been practicing your WordPress development skills on your localhost and you’re happy with your work. Now you want to take it online! What’s the next step? Finding somewhere to put it!
One way to get your localhost site online is by moving it to WordPress.com.
When you purchase WordPress.com, the hosting is included as part of the plan. This means that you don’t have to worry about finding a hosting provider and choosing a suitable hosting plan. It’s all done for you.
That said, you can choose which plan to go for:
- Personal. Suitable for personal use such as a portfolio site or for bloggers. You can get a custom domain name, as well.
- Premium. This is perfect for freelancers that may need advanced design tools and support for Google Analytics.
- Business. This plan is best for small business owners that may need to install custom plugins, more storage space, and 24/7 live chat support.
- eCommerce. Suitable for anyone looking to launch an online store powered by WordPress.
In addition to this, the team of experts behind WordPress.com handles all maintenance for you, enabling you to focus on adding content to your website. WordPress.com gives you access to integrated security features, backups, and updates. In addition to all of this, you also get dedicated email and live chat support.
How to move your locally hosted WordPress site to WordPress.com
The process of transferring your locally hosted WordPress to WordPress.com is pretty simple.
You can migrate all of your localhost website’s content: posts, pages, comments, tags, categories, and media content. This option is available with any WordPress.com plan. There are two primary steps to this process:
- Export – First, you export content at your localhost website
- Import – Next, you need to add the exported content to your WordPress.com website
This method is particularly useful when you need to migrate from a localhost installation of WordPress.org.
From your localhost WordPress website, head over to Tools > Export and download the .xml (WXR) file to your desktop computer. Doing this will only export your pages, posts, comments, tags, and categories.
The XML file includes references to image files (and not the actual files), so you need to manually transfer the uploads and images to your new website, although there will be placeholders for where they should go.
From your new WordPress.com website, navigate to Tools > Import, select the WordPress import option, and upload the .xml file.
Click the upload it to import content link below “What WordPress site do you want to import?”
You can either click the box to browse to the file on your computer or drag your .xml file to the metabox.
Wait for the file to finish processing the uploaded file. When it completes, click on the Start Import button. Here you’ll be prompted to reassign the authors of the imported files to an existing user on the new website before starting the import process.
In case your localhost website has more than one author, and you want to keep your content assigned to the same author, you’ll need to add the other users to your website on WordPress.com before importing the files. This way, you’ll be able to assign the posts to the right author. Keep in mind that to invite the users, they’ll need to have a WordPress.com account.
WordPress will try and match URLs in the localhost site to the new site.
You’ll need to install a new theme. You can pick from tens of thousands of free or paid WordPress themes. If you’re on the Business plan or higher, you will be able to use third-party themes.
We highly recommend that you take advantage of WordPress.com’s powerful tools and connect to social networks and engage with the WordPress.com Community. Publicize is a built-in feature that enables you to easily share your WordPress posts on Twitter, Facebook, LinkedIn, and Tumblr.
Move your localhost website to WordPress.com
Whether you’re a developer building a site for a client or a WordPress user testing out the waters before launch, setting up a localhost web server on your machine can be incredibly useful.
Developing and testing WordPress websites locally allows developers to test things out without accidentally breaking a live website. A localhost WordPress site is a great place for practicing your WordPress development skills and, when it’s ready, you can take it online with WordPress.com.
Ready to take your website online? Get WordPress.com today!
WordPress.com Courses make it easy to start that blog, website or podcast.
Build, publish and grow your blog, website or podcast with on-demand go-at-your-own pace courses taught by WordPress experts.Browse courses