How to Install WordPress Locally
A beginner-friendly, step-by-step guide to running WordPress on your own computer
Installing WordPress locally lets you build, test, and break things on your own computer without paying for hosting or risking a live site. It’s the perfect sandbox for beginners and a fast development lab for experienced users.
In this guide, you’ll learn how to install WordPress on your laptop or desktop using two common approaches: an all-in-one tool like Local, and a more manual setup with XAMPP or MAMP. You’ll end up with a fully working WordPress site that only you can access from your machine.
We’ll cover every step—from installing the local server to running the WordPress setup wizard and fixing common errors—so you can confidently practice WordPress before going live with a real website.
Prerequisites
Before you start, make sure your computer and environment are ready for a local WordPress install.
- A computer running Windows, macOS, or Linux.
- Administrator rights so you can install new software.
- At least 2–3 GB of free disk space for server software, WordPress, and a test site.
- A stable internet connection (for downloading tools and WordPress).
- Optional: A code editor (VS Code, Sublime Text, etc.) if you plan to tweak theme or plugin files.
Step 1: Decide How You Want to Run WordPress Locally
There are two main ways to run WordPress on your computer. Your choice affects how many moving parts you manage and how easy it is to maintain your setup.
Option 1: Use a dedicated local WordPress tool (recommended)
Tools like Local (formerly Local by Flywheel) are designed specifically for WordPress. They install a complete local server stack for you and provide a simple interface to create and manage sites.
- Pros: Beginner-friendly, fewer manual steps, quick to create new sites, supports SSL, different PHP versions, and easy site cloning.
- Cons: Less control over low-level server configuration.
Option 2: Use a general local server stack (XAMPP, MAMP, WAMP)
These tools install Apache, PHP, and MySQL/MariaDB (the same components used by many web hosts). You then install WordPress manually inside that environment.
- Pros: Very close to a typical hosting environment, more control, useful for learning server basics.
- Cons: More steps, you must manage databases and WordPress files yourself.
Step 2: Install Your Local Server Software
This step covers installing either a dedicated WordPress tool (Local) or a generic stack (XAMPP/MAMP). You only need to follow one path.
Install Local (beginner-friendly path)
- Visit the Local website from your browser.
- Download the installer for your operating system (Windows, macOS, or Linux).
- Run the installer and follow the on-screen instructions. Accept the default options unless you have a specific reason to change them.
- Launch Local once the installation finishes.
When Local opens for the first time, you’ll see its dashboard where you can create and manage sites.
Install XAMPP or MAMP (manual path)
- Search for the official XAMPP or MAMP website and download the installer for your OS.
- Run the installer and complete the setup wizard. Keep Apache and MySQL (or MariaDB) enabled.
- Start the control panel and click “Start” for Apache and MySQL/MariaDB.
- Open a browser and visit
http://localhost/. If you see the XAMPP or MAMP start page, your local server is running.
Step 3: Create a New Local WordPress Site
Now you’ll create the actual WordPress site. Again, follow the subsection that matches your chosen tool.
Create a site in Local
- In Local, click “Create a new site” or the “+ New Site” button.
- Enter a site name, such as “my-local-wp”. Local will automatically generate a local domain (for example,
my-local-wp.local). - Click “Continue” and choose a preferred environment (the default is usually fine). Advanced users can customize PHP version, web server, and database.
- Set your WordPress admin username, password, and email when prompted. Save these details—you’ll use them to log in later.
- Click “Add Site” to let Local create the database and WordPress files for you.
Once Local finishes, you’ll see your new site listed in the sidebar with buttons to Start, Admin, and Open Site.
Prepare a site folder in XAMPP/MAMP
- Open your local server’s web root:
- On XAMPP (Windows/macOS):
htdocsfolder. - On MAMP (macOS):
htdocs(or the document root directory set in MAMP preferences).
- On XAMPP (Windows/macOS):
- Create a new folder for your site, for example
my-local-wp. - This folder will hold your WordPress files in the next step.
Step 4: Add WordPress Files and Create a Database (Manual Setups)
If you’re using Local, it already downloaded WordPress and created a database for you, so you can skip this step. For XAMPP or MAMP, you need to add WordPress files and set up a database manually.
Download WordPress
- Download the latest WordPress package as a ZIP file from the official source or follow the detailed instructions in this guide to downloading WordPress.
- Extract the ZIP file on your computer. You should see a folder named
wordpresswith core files inside. - Copy the contents of the
wordpressfolder into your site folder (for example,htdocs/my-local-wp).
Create a local database
- In your browser, go to
http://localhost/phpmyadmin. - Click Databases in the top menu.
- Enter a database name such as my_local_wp and choose the default collation (usually fine), then click Create.
- Optional but recommended: On some setups you may need to create a dedicated database user with a password and grant it all privileges to this database.
Connect WordPress to the database
When you run the WordPress installer (next step), it will ask for your database details. For most local XAMPP/MAMP setups, the defaults are:
- Database Name: The name you just created (e.g.,
my_local_wp). - Username:
root(default for many local setups). - Password: Leave blank (if your local server uses no password) or enter the password you set.
- Database Host:
localhost. - Table Prefix:
wp_(you can change this if you want).
Step 5: Run the WordPress Installation Wizard
At this point, your local server is running and WordPress files are in place. The installer will complete the setup in just a few screens.
Open the installer in your browser
- Local: In Local, click Start Site, then click Open Site, and finally go to
/wp-admin/if the installer doesn’t open automatically. - XAMPP/MAMP: In your browser, visit
http://localhost/my-local-wp/(replacemy-local-wpwith your folder name).
Complete the WordPress setup screens
- Select your preferred language and click Continue.
- Enter the database details if prompted (manual XAMPP/MAMP installs), then click Submit and Run the installation.
- Fill in your site details:
- SEO and UX, and where you will see it in daily work.”>Site Title – for example, “Local Practice Site”.
- Username – avoid using “admin”; pick something unique.
- Password – use a strong password, even for local sites.
- Your Email – used for admin notifications.
- Search Engine Visibility – you can safely check “Discourage search engines from indexing this site” for a local install.
- Click Install WordPress.
When the installer finishes, you’ll see a success message and a button to log in. Use your chosen username and password to access the WordPress dashboard.
Step 6: Tweak WordPress for Local Development
Now that WordPress is running locally, it’s a good idea to adjust a few settings so your environment is easier to use for testing and learning.
Update basic settings
- Log in to your local WordPress dashboard at
/wp-admin/. - Go to Settings > General and update the site title and tagline to something meaningful.
- Go to Settings > Permalinks and switch to Post name for cleaner URLs.
- Confirm your timezone, date, and time formats so test content looks realistic.
Enable debugging (optional but helpful)
Debugging helps you see PHP errors and notices while you’re working with themes and plugins. For a local environment, this is very useful.
- Open the
wp-config.phpfile in your site folder using a text editor. - Look for the line containing
define( 'WP_DEBUG', false );. - Change it to:
define( 'WP_DEBUG', true ); Save the file. WordPress will now display errors and warnings, which can help you catch problems early when developing or testing.
Step 7: Common Problems When Installing WordPress Locally
Local WordPress setups are usually straightforward, but a few recurring issues can slow you down. Here’s how to recognize and fix them quickly.
“Database connection error” message
- Double-check the database name, username, and password you entered in the installer.
- Make sure the MySQL/MariaDB service is running in XAMPP, MAMP, or your local stack.
- Verify that the
DB_HOSTvalue inwp-config.phpis set tolocalhostunless your stack specifies something else.
“This site can’t be reached” / “ERR_CONNECTION_REFUSED”
- Confirm that Apache and MySQL are running (or that your Local site is started).
- Check that you’re using the correct URL:
- Local: something like
https://my-local-wp.local/. - XAMPP/MAMP: typically
http://localhost/my-local-wp/.
- Local: something like
- Try a different browser or clear your browser cache if you recently changed the local URL.
Port conflicts when starting Apache or Local
- Look for other software using ports 80 or 443 (Skype, Teams, IIS, other web servers).
- Change the ports for Apache or Local in their settings (for example, use 8080 instead of 80).
- Update any bookmarks or shortcuts you use to access the local site after changing ports.
Wrap-Up: Your Local WordPress Lab Is Ready
You’ve just installed WordPress on your own computer, set up a working local site, and learned how to tweak it for development. Whether you used an all-in-one tool like Local or a manual XAMPP/MAMP stack, you now have a safe environment to experiment with themes, plugins, and customizations.
Use this local setup to practice building pages, testing layouts, and troubleshooting issues before they ever hit a live audience. When you’re confident in your workflow, you can repeat a similar process on real hosting and move your finished site online.
Further Reading
- WordPress Guides & Tutorials Overview
- How to Choose the Right WordPress Hosting
- WordPress Security: Complete Overview
- How to Migrate a WordPress Site to a New Host




