Do a backup
Install the plugin
wp plugin install all-in-one-wp-migration --activate
You must reload the page once before continuing
Do the backup
Adjust the settings for your own need, this here makes a backup of the database only. I suggest using rsync to sync media files.
wp ai1wm backup --exclude-media --exclude-themes --exclude-inactive-themes --exclude-muplugins --exclude-plugins --exclude-inactive-plugins --exclude-cache
Remove the plugin
wp plugin deactivate all-in-one-wp-migration --uninstall
Restore a backup
Go to backup directory or create if does not exist
cd wp-content/ai1wm-backups/
Download the backup
wget http://siteurl.fi/wp-content/ai1wm-backups/backup-20180105-142530-313.wpress
Install the plugin
wp plugin install all-in-one-wp-migration --activate
You must reload the page once before continuing
Restore the site from backup
wp ai1wm restore backup-20180105-142530-313.wpress
Not sure if necessary to flush permalinks twice, like when restoring from front end, but do it once or twice if you encounter problems.
wp rewrite flush
Remove the plugin and delete the backup file
wp plugin deactivate all-in-one-wp-migration --uninstall
rm backup-20180105-142530-313.wpress
Remember to remove the unneeded backup files from the source as well
On the target site:
wp option update blog_public 0
along with any rm of files such as advanced-cache.php