How to Set Up WordPress for Local Development in Linux

Linux Local Wp Featured

WordPress has developed into the go-to CMS for the vast majority of sites on the Internet. While you can pay a hosting company to keep your WordPress site on their servers, that’s the best choice only for production-ready sites. If all you want to do is experiment and familiarize yourself with the CMS or want to start developing plugins/themes for WordPress, here is how you can set up everything needed with XAMPP, plus WordPress itself on your Linux computer, to learn, develop or fool around with it, without having to pay a single cent.

Install XAMPP

We’ll follow the easy route of using the XAMPP installer by ApacheFriends, which turns the installation of Apache, MariaDB, PHP into a next-next-next affair.

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

Linux Local Wp Download Installer

2. Since we’re at the downloading stage, also visit Bitnami’s site and download its latest WordPress installer for Linux.

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

cd Downloads

Make the two files executable:

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

Linux Local Wp Xampp Installer

4. Run the Apache installer with:

sudo ./xampp-*-installer.run

5. Accept the defaults and complete the process by clicking on “Next >” on each screen of the installation. When it completes, leave “Launch XAMPP” enabled and click on “Finish.”

Linux Local Wp Launch Xampp

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

7. Move to the “Manage Servers” tab and make sure that both MySQL and Apache Web Server are running. If not, select them and click on “Start” on the top right. You don’t need the ProFTPD server since you’ll have local access to all files, so you can leave this one as “Stopped.”

Linux Local Wp Start Servers

8. Check that everything’s running okay by firing up your favorite browser and visiting “localhost” as the address. XAMPP’s welcome page should show up.

Linux Local Wp Test Apache

Note: to start the stack in the future, use the command:

sudo /opt/lampp/lampp start

If you prefer instead to start and stop the individual servers through a provided GUI:

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

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

sudo ./manager-linux-x64.run

Install WordPress

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

sudo ./bitnami-wordpress*-installer.run

2. Click Next, leaving the default installation folder as it is, pausing at the “Create Admin account” screen. Enter the account details you wish to use to log in to your soon-to-be local WordPress installation. Leave the MySQL Password box empty if you followed along up to now = the default XAMPP password is blank.

Linux Local Wp Setup Wp

3. The installer will also provide you with an option to change the pre-selected (and too generic) Blog name. If you aim to turn this into an actual site hosted on a real server and accessible by others, we recommend you enter the name you intend to use and not a temporary one. This will prove useful in keeping MySQL find-and-replace actions to a minimum when you move your site to a remote host.

Linux Local Wp Blog Name

4. Since everything will take place locally, you don’t need “to receive notifications about your site’s status.” You can skip the “Configure SMTP Settings” tab and mail support for now.

Linux Local Wp Skip Mail

5. At the “Installation type” tab, select “Development Settings” instead of “Production Settings”, since you’re setting up a development environment/playground and not a production-ready site.

Linux Local Wp Development Settings

6. For the same reason of not dealing with a final and presentable site, deselect “Launch wordpress in the cloud with Bitnami.”

Linux Local Wp Disable Deployment

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

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

Linux Local Wp Test Wp

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

Linux Local Wp Blog Dashboard

Alternatives to XAMPP

As a closing note, if you’d like to have absolute control of every facet of your installation, you could go the fully manual route. You could install Apache, PHP, and MySQL or some alternative, configure each one, and then download and install WordPress yourself. This way, you’ll also become more familiar with the technologies powering WordPress.

The reason we chose the easy way (XAMPP) is that most people who just want to use WordPress probably won’t care about “the extras.” And they would prefer to avoid having to deal with them unless it’s really needed.

If you’d like a middle road between the utter simplicity of the XAMPP and Bitnami WP module approach and turning your PC into a full LAMP server, you could install WordPress through Docker. It’s more complicated than the approach we examine but would have the extra bonus of keeping everything virtualized, without having to install additional services on your actual operating system.

The difference is that XAMPP installs the necessary “infrastructure” for WordPress (Apache, PHP and MySQL) as the equivalent of “standalone applications” in your OS, whereas Docker keeps everything in a virtualized “work environment” that contains all dependencies.

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

Note, though, that full virtual environments also contain the full OS’s files and, as a result, are also larger in size and harder to maintain since they demand you keep both your host and the virtualized OS up to date. That’s why we don’t consider them the best choice for the average single user with a personal blog but for professional developers and teams who collaborate on larger projects.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox