This procedure could be the fastest if you have many websites. With one website or just a few websites it might be easier to migrate using the migration procedure as we have outlined in this post. If you are unable to migrate using UpdraftPlus Migrator using this manual procedure could help you out.
Moving many WordPress sites
Migrate the databases
- Export the databases from the legacy server
- Create empty databases on the new Amazon RDS
- Import the database backup from the legacy server into the new RDS. Use command-line or use Sequel Pro, MySQL Workbench or Navigate to create an empty database and then import the data. The easiest and safest way is often to tunnel trough EC2 to RDS using SSH.
Migrate files and folders
- On the legacy server you should create a zip file of the file and folder system using this command:
sudo zip -r website-files.zip /var/www/
Copy the zip file to somewhere on the legacy server where it is available with a browser
sudo mv /var/www/website-files.zip /var/www/html/website-files.zip
On the new server download the zip file from the legacy server
sudo wget https://www.domainname.com/website-files.zip
Unzip.
sudo unzip website-files.zip
Then move the website content to the correct place on the new server.
sudo cd /var/www/
sudo cp -r . /var/www/
Then remove the unzipped folder
cd .. cd .. rm -r var
- Change ownership of the files. It should be correct. We do this just to verify
chown -R www-data /var/www/
- If you haven’t already done this in previous steps: On the new, fresh server create empty databases in Amazon RDS. Import the database content from the old server into the databases
- Change the database server name value in wp-config.php to point to the new RDS databases.
- Change the username and password values in wp-config.php to point to the new RDS databases if required.
Migrate the Apache configuration
Test by editing the hosts file on your PC
- Here is a tip on how you can test everything without changing the DNS and go live. Prevent downtime by doing this. To make sure everything is OK before making the DNS edits it’s a good habit is to test by changing your hosts file instead of the public DNS. Editing the hosts file is often faster to do in a graphical environment than in command-line. We have made a list of graphical tools for editing the hosts file on OS X and Windows.
How to create a zip from folders and archives on the legacy server
To install the zip program:
sudo apt-get install zip
To use the zip program:
sudo zip -r compressed_filename.zip folder name
How to Unzip
To install the unzip program:
sudo apt-get install unzip
To unzip a file use this command
unzip file.zip -d destination_folder
How to change the owner of the files
After unzipping the folders, you should make sure that the owner and group of the data are correct.
chown -R www-data /var/www/html