Have you ever wanted to have a complete WordPress site development setup that you can carry around in your pocket and run on any computer? If so, you‘re in luck! Installing WordPress locally on a USB flash drive using the free XAMPP software stack is an excellent solution.
As a WordPress developer, I rely on portable development environments for many reasons:
- Quickly test new themes, plugins, and code changes
- Develop sites offline without an internet connection
- Create demos to show clients or present at conferences
- Learn and experiment with WordPress without risk to a live site
- Troubleshoot and provide support for client sites
In this comprehensive guide, I‘ll walk you through the exact steps to install WordPress on a USB stick with XAMPP. You‘ll be able to follow along whether you‘re using Windows, Mac, or Linux.
Why Use WordPress and XAMPP on a USB Drive?
According to W3Techs, WordPress powers 43% of all websites on the internet. It‘s the world‘s most popular content management system. Meanwhile, XAMPP is one of the most common local server environments used by WordPress developers.
Some advantages of combining WordPress and XAMPP on a portable USB drive include:
- Cost-effective: XAMPP and WordPress are both free, open-source software
- Convenient: Take your development environment anywhere, no internet required
- Efficient: Quickly set up new WordPress installs without configuring a server
- Flexible: Run on virtually any computer with a USB port
- Isolated: Test and develop without affecting your live site or other local sites
What You‘ll Need
Before we get started, make sure you have the following:
- A USB flash drive (3.0 or higher recommended) with at least 4 GB of storage
- A computer running Windows, macOS, or Linux
- A web browser like Chrome, Firefox, Safari, or Edge
- An internet connection (for initial software downloads)
Got everything? Great! Let‘s dive into the step-by-step process.
Step 1: Download and Install XAMPP Portable
First, we need to download the portable version of XAMPP that can run from a USB drive.
- Go to the Apache Friends website
- Click the "XAMPP Portable" link under the "XAMPP Installers" section for your operating system
- Download the latest portable version (e.g. 8.1.12 for Windows at time of writing)
- For Windows: Get the EXE installer or the 7z compressed file
- For macOS or Linux: Get the compressed TAR file
- Connect your USB flash drive to your computer
- Run the EXE installer or extract the compressed portable files
- Choose your USB drive as the destination location
- Complete the installation on your USB drive
Your USB drive should now contain a directory structure like this:
xampp
├── apache
├── cgi-bin
├── contrib
├── FileZillaFTP
├── htdocs
├── licenses
├── MercuryMail
├── mysql
├── perl
├── php
├── phpmyadmin
├── sendmail
├── tmp
├── tomcat
├── webalizer
└── xampp-control.exeThe htdocs directory is where your WordPress site files will go. And xampp-control.exe launches the XAMPP control panel to manage the server.
Step 2: Start Your Portable Web Server
Now we need to start Apache and MySQL to get the web server running from the USB drive.
- Open the XAMPP control panel by double-clicking
xampp-control.exe - Click "Start" next to "Apache" to launch the web server
- Click "Start" next to "MySQL" to launch the database server
You should see the status change to "Running" in green for both modules.

If Windows Defender Firewall pops up asking to allow Apache and MySQL, be sure to check the boxes for private and public networks and click "Allow access".
Step 3: Create a MySQL Database
Next, we need to create a database for WordPress to use.
- Open your browser and go to
http://localhost/phpmyadmin - Log in with username "root" and a blank password
- Click "Databases" in the top menu
- Enter a name under "Create database" (e.g.
portable_wp) - Select "utf8_general_ci" as the collation
- Click the "Create" button

Your empty database will now be ready for WordPress.
Step 4: Download and Copy WordPress
It‘s time to download the latest version of WordPress and copy it to your USB drive.
- Go to wordpress.org and click "Get WordPress"
- Download the ZIP file (e.g.
wordpress-6.1.1.zip) - Extract the ZIP file contents to a folder on your computer
- Copy the extracted
wordpressdirectory - In your USB drive, go to the
xampp/htdocsdirectory - Paste the copied
wordpressfolder here - Rename the folder to your site (e.g.
portable)
Your WordPress site files are now in place and ready for installation.
Step 5: Install WordPress
Let‘s run the WordPress installation and setup your site.
- In your browser, go to
http://localhost/yoursite(replace "yoursite" with your folder name) - Select your language and click "Continue"
- Click "Let‘s go!" under "Welcome"
- Enter your database details:
- Database Name:
portable_wp(or whatever you named it) - Username:
root - Password: (leave blank)
- Database Host:
localhost - Table Prefix:
wp_(or change to something unique)
- Click "Submit" then "Run the installation"
- Fill out your site details:
- Site Title: Your site name
- Username: Your admin username
- Password: A strong admin password
- Your Email: An email to associate with the admin account
- Uncheck "Search engine visibility"
- Click "Install WordPress"

After a few moments, you should see a "Success!" message. Click "Log In" and enter your admin credentials to access your new WordPress dashboard.
Using Your Portable WordPress Site
Congrats! Your WordPress site is now installed locally on your USB drive. You can access it anytime by:
- Plugging your USB drive into any computer
- Starting Apache and MySQL via the XAMPP control panel
- Going to
http://localhost/yoursitein a browser
To log into your admin dashboard, go to http://localhost/yoursite/wp-admin.
You can now use your portable WordPress site for:
- Developing themes and plugins
- Designing and building sites for clients
- Writing and publishing content offline
- Previewing and testing site changes
- Learning WordPress development skills
- Demonstrating WordPress functionality
Some cool things you can do with your portable WordPress dev environment:
- Create multiple WordPress sites by repeating steps 3-5 with new databases and folders
- Use WordPress Multisite to create a local WordPress network
- Add a free SSL certificate so you can use HTTPS
- Clone live WordPress sites to your USB drive to test changes locally
- Sync your portable WordPress site to a live site when ready to deploy
Common Issues and Troubleshooting
If you run into any snags or errors during setup, here are some tips:
- Make sure your USB drive has enough storage space and is formatted as FAT32 or exFAT
- Verify that Apache, MySQL, and phpMyAdmin are running successfully in XAMPP
- Double-check that your WordPress site folder is directly inside
xampp/htdocs - Ensure your
wp-config.phpfile has the correct database connection details - Temporarily disable your computer‘s firewall or antivirus software if the server won‘t start
- Delete your browser cache and cookies if you see stale site versions
- Check XAMPP and Apache error logs for clues to diagnose problems
If you‘re still stuck, try searching the WordPress.org support forums or the XAMPP community forums for threads related to your issue.
Securing Your Portable WordPress Site
Even though your WordPress site is just running locally, it‘s still a good idea to keep it secure:
- Use strong passwords for your MySQL database, WordPress admin, and XAMPP
- Keep your WordPress core, plugins, and themes updated to the latest versions
- Only install trusted plugins and themes from reputable sources
- Avoid using "admin" as your admin username
- Add HTTP authentication to directories like
wp-adminorphpmyadmin - Enable a firewall on your computer and only allow Apache and MySQL
- Password protect your XAMPP installation and WordPress site folder
- Back up your USB drive regularly in case of loss, theft, or damage
By following these security best practices, you can minimize risks while working on your portable development site.
Conclusion
You now have a complete guide to installing WordPress on a USB stick with XAMPP. With this portable development environment, you can build, test, and demo WordPress sites from anywhere.
Some key things to remember:
- Use the latest portable version of XAMPP for your operating system
- Create a new MySQL database for each WordPress site
- Put your WordPress site folder directly inside
xampp/htdocs - Access your site at
http://localhost/yoursiteand admin athttp://localhost/yoursite/wp-admin - Start Apache and MySQL via the XAMPP control panel when you want to use your USB site
- Implement security measures to protect your portable site and its data
I hope you found this in-depth walkthrough helpful! Let me know in the comments if you have any other questions about setting up your portable WordPress dev environment.
Additional Resources
Want to learn more about WordPress development with XAMPP? Check out these tutorials and guides:
- How to Install XAMPP and WordPress Locally on Windows PC
- How to Set Up a Local WordPress Testing Environment for Free Using XAMPP
- XAMPP and WordPress – Video Guide to Installing WordPress Locally on a PC or Mac
- Secure WordPress with XAMPP
- Installing and Configuring WordPress Multisite on XAMPP
Happy portable WordPressing!
