How to Migrate WordPress with Duplicator

By | July 2, 2016

The Great MigrationWhen most people hear the words “migrating a website” the next word they think of is “migraine”. I created this post to show you this is not the case if you follow my method closely and use the Duplicator WordPress plugin. We won’t be using cPanel or myPhpAdmin – instead we will only need SSH (that means PuTTY + WinSCP for Windows users.) I began this site by self hosting with Digital Ocean. The service was great, but I was paying more than I had to – Amazon’s Web Services (AWS) allow free hosting up to certain bandwidth thresholds. I was already backing up my website with Duplicator, another task the plugin can do, so I thought “Why not try it?” At the very least, I would still have my old website up and running if the migration failed.

It did not, though. Despite the questionable AWS documentation and knowledge base, I successfully migrated my WordPress (installed on CentOS) to a Ubuntu Server EC2 instance with Amazon. It did not take long, either. I made one mistake with the database and put in the wrong username and password (one more reason to keep clear records of your servers!). Otherwise, most of my time was spent familiarizing myself with AWS. Here is how long you can expect each step to take:

  • Downloading the installer and archive – 5 to 30 minutes
  • Setting up a fresh server with LAMP stack (Linux, Apache, MySQL, PHP) – 5 to 15 minutes
  • Uploading the installer and archive to your new server – 10 to 45 minutes
  • Unpacking the archive and cleaning up the installation files – 5 to 10 minutes
  • Total time: 25 to 100 minutes

The best part of this method? It’s either that most of the time spent in this process will be uploading/downloading or that the most complicated steps range from copy/pasting commands to typing in names and passwords. The downside is if your website is very large and contains lots of high resolution pictures and videos, the uploads and downloads may go beyond the high end of what I have listed. The other trouble you might have is with your database – what version of SQL does your old WordPress use? You’ll want the new and the old databases to be as similar as possible, as per Duplicator recommendations.

The Method

  1. Regardless of whether you are keeping or changing your domain name: make sure you have your CNAME/A records setup with your hosting service, and your domain name is associated with your host’s name serversĀ (sometimes the provider does both). Domain name changes usually take 24-48 hours to propagate. This will ensure your websites links will remain intact so you don’t have to take any additional steps replacing and changing URLs and links.
  2. Install and activate the Duplicator plugin on your current website. Then select “Build a package” and make any changes you want, for example: excluding the “wp-content” folder to avoid downloading and then uploading all your bulky media files.Then download both the archive file and the “installer.php” file. You may leave the fields blank if you want to fill them out later, on the new server.
  3. Prepare your new server by updating and installing the LAMP stack. A simple and effective guide is available here. Remember to write down your MySQL/MariaDB database name, username, and password.
  4. Download WinSCP (if on Windows) or use FTP to upload the files to your new server. Place them in the /var/www/html directory. Instructions on how to do this are available here.
    WinSCP

    dragging and dropping installation files

    uploading files

    Typical slow upload speeds…

  5. Visit your server through a browser (most likely an I.P. address, unless your hosting service is managed) to unpack your website archive. The address should be: “www.yourdomain.com/installer.php” if your domain name is set up and your installer is in the /var/www/html folder.
  6. Enter the correct database hostname, commonly “localhost”, or something else if your database is located on another server. Enter in the database information you wrote down previously. Perform a test connection to see if it works.

    duplicator success

    Migration complete!

  7. If you get green text, great, finish the installation by clicking through the next steps and removing the installation files afterward. Try not to change anything in permalinks. Congratulations you just migrated your website without a migraine!

In case something went wrong:

If you get red text, or anything about a failed connection to the database, make sure your MySQL/MariaDB services are running and functioning properly. If it’s not working because you entered in the wrong information, you can remove all the files, delete the MySQL database, restart apache/nginx and mysql, and try again. If you still can’t get it to work, post a comment and I’ll see if I can help.

Things that I did not cover that you may not know:

  • How to connect to your webserver with SSH
  • How to use PuTTY/WinSCP
  • How to secure your WordPress
  • How to add your domain name to your webserver

But there should be an abundance of guides on how to do these basic tasks in general. Google is your friend!

That’s it. You just something that most people will cringe at the mention of. If you enjoyed the Duplicator plugin as much as I did, don’t forget to take 5 minutes to write a review and maybe even make a donation. Credit where credit is due!

Additional Notes:

You should spend a few minutes ensuring your file permissions and ownerships are secure – this article takes a comprehensive approach to securing your WordPress site. Or you can just paste the two commands if you have a short attention span.

Syntax for basic MySQL setup (for reference):

Log in to MySQL —> mysql -u root -p

Create a new database —> CREATE DATABASE newdatabasename;

Create a user —> CREATE USER ‘newusername’@’localhost’ IDENTIFIED BY ‘yourpassword’;

Grant privileges —> GRANT ALL PRIVILEGES ON newdatabasename . * TO ‘newusername’@’localhost’;

Delete a database —> DROP DATABASE newdatabasename;

Ensure changes take effect —> FLUSH PRIVILEGES;

Another good article on how to do basic things like view tables and users is available here.

Facebooktwittergoogle_plusredditpinterestlinkedintumblr

2 thoughts on “How to Migrate WordPress with Duplicator

  1. Laura

    Did you use only the EC2 instance at AWS, no separate RDS or Elastic Beanstalk? Do you still have it that way, and are you happy with it?

    Reply
    1. transposedmessenger Post author

      Yes, it’s merely an EC2 instance with no additional support. I am very happy with it because I was paying 10-20 a month before with Digital Ocean but didn’t come close to utilizing all the resources I had. Occasionally my website will go down with heavy traffic, but that’s only if my content gets shared places that have lots of daily traffic. All I have to do is restart mysql.

      Reply

Leave a Reply

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