How to set up WordPress for local development on Linux

WordPress has become the go-to CMS for most websites on the web. While you can pay a hosting company to keep your WordPress site on their servers, this is the best choice for production-ready sites only. If you just want to experiment and get familiar with the CMS or develop plugins/themes for WordPress, here is everything needed to learn, develop or fool around with XAMPP and WordPress itself on your Linux machine, without having to pay a single cent.

Install XAMPP

We follow the easy way to use ApacheFriends XAMPP installer that makes installing Apache, MariaDB, PHP a next-next-next affair.

1. Visit the ApacheFriends website and download the latest “XAMPP for Linux” installer.

2. Since we are in the download stage, please also visit Bitnami’s website and download the latest WordPress installer for Linux.

3. Open a terminal and change to the directory where you downloaded the two files.

Make the two files executable:

chmod +x xampp-*-installer.run
chmod +x bitnami-wordpress*-installer.run

4. Run the Apache installer with:

sudo ./xampp-*-installer.run

5. Accept the default settings and complete the process by clicking Next> on each screen of the installation. When this is complete, leave “Start XAMPP” checked and click “Finish.”

Linux Local Wp Start Xampp

6. In the window that appears, on the Welcome tab, click Open Application Folder and minimize the file manager window that appears. We’ll need it later, so don’t close it.

7. Go to the Manage Servers tab and make sure both MySQL and Apache Web Server are running. If not, select it and click “Start” at the top right. You don’t need the ProFTPD server as you have local access to all files. So you can leave it as “Stopped”.

Linux local wp start server

8. Check if everything is ok by launching your favorite browser and going to “localhost” as the address. The XAMPP welcome page should appear.

Linux Local Wp Test Apache

notice: To start the stack in the future use the following command:

sudo /opt/lampp/lampp start

If you prefer to start and stop each server from a provided GUI instead:

cd /opt/lampp
sudo ./manager-linux.run

If you have a 64-bit installation, the second command is:

sudo ./manager-linux-x64.run

Install WordPress

1. With the XAMPP stack up and running, proceed with Bitnami’s WordPress installation. Run it with:

sudo ./bitnami-wordpress*-installer.run

2. Click Next and leave the default installation folder as is. Pause at the Create Administrator Account screen. Enter the account details you want to use to log into your upcoming local WordPress installation. Leave the MySQL Password field blank if you’ve followed this far = The default XAMPP password is blank.

Linux Local Wp Setup Wp

3. The installer also gives you the option to change the default (and overly generic) blog name. If you want to turn this into an actual site, hosted on a real server and accessible to others, we recommend you enter the name you want to use and not a temporary one. This comes in handy for keeping MySQL search and replace actions to a minimum when moving your site to a remote host.

Linux Local Wp Blog Name

4. Because everything is local, you don’t need to get notifications about the status of your site. You can skip the Configure SMTP Settings tab and email support for now.

Linux Local Wp Skip Mail

5. On the Installation Type tab, select “Development Settings” instead of “Production Settings” because you are setting up a development environment/playground and not a production-ready site.

Linux Local Wp development settings

6. For the same reason that you are not concerned with a final and presentable site, uncheck the “Launch WordPress in the cloud with Bitnami” option.

Linux Local Wp Disable Deployment

7. Click “Next” to proceed with Bitnami WordPress installation. Once complete, test it as before, but this time use the local WordPress URL: localhost/wordpress.

Your blog’s splash screen should appear using the default WordPress theme and settings.

Linux Local Wp Test Wp

After you have WordPress installed locally and working, go to the URL to login to the admin dashboard: localhost/wordpress/wp-login.php.

Linux Local Wp Blog Dashboard

Alternatives to XAMPP

Finally, if you want absolute control over every facet of your installation, you can go the fully manual route. You can install Apache, PHP, and MySQL or another alternative, configure each, and then download and install WordPress yourself. This will also introduce you to the technologies that power WordPress.

The reason we went the easy route (XAMPP) is that most people who just want to use WordPress probably don’t care about “the extras”. And they would prefer not to have to deal with them unless it’s really needed.

If you’re looking for a middle ground between the simplicity of the XAMPP and Bitnami WP module approach and turning your PC into a full LAMP server, you can install WordPress via Docker. It’s more complicated than the approach we’ve explored, but would have the added benefit of keeping everything virtualized without the need for additional services to be installed on top of your actual operating system.

The difference is that XAMPP installs the “infrastructure” (Apache, PHP, and MySQL) required by WordPress into your operating system as the equivalent of “standalone applications”, while Docker keeps everything in a virtualized “working environment” that includes all dependencies.

However, Docker still relies on “local” elements of your operating system and “adds the missing dependencies on top” for WordPress. For larger teams collaborating on joint projects whose members would benefit from access to the same server but locally for each member, a Vagrant & VirtualBox installation would probably be the best option.

Note, however, that full virtual environments also contain the files of the full operating system and are therefore also larger and more difficult to maintain as you need to keep both your host and the virtualized operating system up to date. Because of this, we don’t consider it the best choice for the average individual user with a personal blog, but for professional developers and teams collaborating on larger projects.