rsync -avz -e ssh firstname.lastname@example.org:/path/to/site.url/htdocs/* /var/www/site.url/htdocs/ --info=progress2
Remember to replace the origin server’s IP address, your system user name, the /path/to/site.url, and site.url with your website’s URL.
You’ll be prompted for your system user’s password before the process begins. If your origin server uses a custom port, specify it with the -p flag.
Option 2. Pull your files with rsync: System User + SSH Key
To use this option, set up your SSH keys so your Pressillion server can access your origin server. First, create a new key pair on your Pressillion server:
ssh-keygen -t rsa
Follow the prompts and list your files with
ls -l to view your private and public keys.
Now, display your public key:
Add this key to your origin server following your host’s documentation.
Then, execute the command to pull your files from the origin server to your Pressillion server:
rsync -avz -e 'ssh -i /path/to/private/key' email@example.com:/path/to/site.url/htdocs/* /var/www/site.url/htdocs/ --info=progress2
Remember to replace necessary fields like key paths, system user, IP, website path, and site URL.
Verify Your Files
Once rsync completes the transfer, navigate to your site’s /htdocs directory and check if the transfer was successful:
Part 4. Complete Your Migration
Now that the files are copied, proceed to import the database.
Ensure there isn’t a wp-config.php file inside your /htdocs folder before continuing.
Import Your Database
Navigate to your website’s /htdocs directory (if not already there):
Run the following command to import your database as your system user:
sudo -u systemuser wp db import database.sql
It’ll notify you once the operation completes, which might take some time for larger databases.
Run a Permissions Fix
Ensure your file permissions are correct:
fix perms site.url
Part 5. Migration Checks
Post-migration, do some cleanup to ensure your website runs smoothly:
- Check Database Table Prefix: Update wp-config.php if necessary.
- Remove Unnecessary Must-Use Plugins: Disable them by renaming the folder.
Once you’ve confirmed a successful migration, enable caching and security settings as needed.