Backup your WordPress site for FREE

How to backup your WordPress site for free without any plugins.

Requirements:
SSH access to your server/provider

Step 1 – Set things up

Login to your server and cd into your docroot.

Check to see it WP-CLI is installed

wp cli version
WP-CLI 0.24.1

If the version doesn’t show, Install WP-CLI

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Make the file executable

hmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp

Step 2 – Backup your database

Backup the database

wp db export ~/backup.sql

If that doesn’t work, try

sudo -u www-data -i wp db export ~/backup.sql

If it STILL doesn’t work, you can run it as sudo (not recommended)

sudo wp db export ~/backup.sql --allow-root

Step 3 – Backup and compress your website’s files

tar -vczf ~/backup.gz .

Or if you prefer ZIP

zip -r ~/backup.zip *

Leave a Reply