Linux can mirror and copy a live WordPress site so that it runs on my laptop at home. Although my web host creates backups which I can recall anytime I want to, I prefer to have an up-to-date mirror of my sites running on a local computer. If the live server gets compromised, I can then take that copy and upload it to a new host within minutes and be back in business within 24 hours or less. Here is how it’s done.

How to mirror a WordPress site

In order to run a copy of a live WordPress site, I installed XAMP which is available for all major operating systems and can be downloaded from here:

After the XAMP file downloads, I make it executable by right-clicking it and selecting Properties from the pop-up. A new windows open up and the Permission tab provides an option to check “Allow this file to run as a program“. That’s it. I then close the window and open a terminal inside the download directory again by right-clicking and selecting “open Terminal here“.

To run and install the XAMPP stack, I simply type: sudo and press enter. Since I issued the command with “sudo”, I need to enter the password and a few seconds later, I have a working web server on my Linux computer. Now I can proceed to download a snapshot of all my WordPress sites and install them locally.

The best WordPress plugin to duplicate a site is Duplicator

My WordPress plugin of choice is Duplicator which makes duplicating and downloading the needed files a breeze.
Here is how Duplicator works. Duplicator makes a compressed copy of the WordPress site plus an install.php file. Both of those files need to be downloaded and copied to the /opt/lampp/htdocs directory.
In order to copy those files to the htdocs directory, the permissions need to be changed like so:
sudo chmod -R 777 /opt/lampp/htdocs

After the LAMPP servers are started (see image above), I can run myPhbAdmin and start creating databases and database users. First things first. To get to myPhbAdmin, I open a web browser and type “localhost” into the URL field. If LAMPP is running properly, then localhost will display and show the page menu which has myPhbAdmin listed in the top menu.

How to start the LAMPP server on Linux

sudo /opt/lampp/ start

To stop the server, simply do the reverse: sudo /opt/lampp/ stop
Additional options are “status” and “restart” but those are hardly ever needed.

If you prefer the GUI then use this line instead:
sudo /opt/lampp/


Many years ago, web hosting companies required that databases and administrators must be created manually. Then came Softacolus and made that task a one-click job. I am glad that I still learned how to manually create a database and because of that, I never use the automatic option. The advantage of doing things the manual way is that I can specify the table prefix and admin user name. This makes a database more secure because the table prefix is hard to guess by “wanna-be hackers”.

Final thoughts

There are tons of YouTube videos online which cover the above steps in great details but I wrote this article mainly to let readers know that it is very easy to mirror a copy of a live WordPress install on a home computer. The advantages of having a working copy are too many to list.

Hint! Don’t delete the zip and installer files which Duplicator creates. I keep the latest versions on a jump driver (USB stick) which I only connect to the computer if I need to compare certain files for security reasons. Hackers are quite clever but it is hard to edit a file without changing the file size.

Arch Linux has a handy utility app called Meld which displays two files side-by-side and highlights any changes that differ from the original. So yes, hackers are clever but not clever enough to fool Meld …. or me.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.