Hackernoon logoWordPress Site Migration To AWS Lightsail With Duplicator by@wesleybaxterhuber

WordPress Site Migration To AWS Lightsail With Duplicator

In this article we’ll go over how to migrate an entire Wordpress site with the Duplicator plugin. In this example, my client has a Wordpress Managed Hosting plan with Godaddy and would like to migrate his site to a AWS Lightsail Instance. The first thing we are going to do is login to our current website via FTP (I use FileZilla for my FTP client) and download the wp-content directory. Once you’ve downloaded the folder, go to your current websites WP-Admin dashboard and go to add a new plugin.
image

In this article we’ll go over how to migrate an entire Wordpress site with the Duplicator plugin. In this example, my client has a Wordpress Managed Hosting plan with Godaddy and would like to migrate his site to a AWS Lightsail Instance. 

image

The first thing we are going to do is login to our current website via FTP (I use FileZilla for my FTP client) and download the wp-content directory.

image

This may take a while depending on how big your site is. Once you’ve downloaded the folder, go to your current websites WP-Admin dashboard and go to add a new plugin.

Search for and install the duplicator plugin.

image

Activate Duplicator. Once active, you should see Duplicator should show up in the left toolbar.

image

Check out the quick start guide for reference: https://snapcreek.com/duplicator/docs/quick-start#quick-060-q 

This is how you create a package (remember we are doing the “Database Only” method): 

Goto Duplicator ❯ Packages ❯ click "Create New" button

On Step 1 Setup ❯ Archive ❯ check "Archive Only the Database"

Build package then download installer and archive files

Once you’ve done this you should be able to download 2 files, one is a .daf extension, that is your database the other is an installer.php file that you will upload to your new server so that Duplicator can install the DB.

Now login to the AWS console: https://console.aws.amazon.com  and set up your Lightsail instance:

image

Choose a plan (I chose the $5/month plan)

image

Name and create your instance:

image

Go to Home -> Networking and create a static ip and attach it to your new instance

image

Go back to your instances, then open up the terminal by clicking the orange “terminal” icon next to the 3 dots.

image

Once you are in the terminal, use this command to find your login credentials: 

sudo cat /home/bitnami/bitnami_credentials
image

Take note of these credentials, you will use these to login to Wordpress on your website. For example you can now go to https://[your-static-ip-here]/wp-admin and login with these credentials.

While we are here in the terminal, let’s make sure that permissions and users are set correctly for when we want to upload our website files via FTP:

sudo chown -R bitnami:daemon /opt/bitnami/apps/wordpress/htdocs/wp-content/

Let’s now connect to our Lightsail instance via FTP, we want to do this so we can easily upload files. I’ll show you how I connect a Lightsail instance with Filezilla.

  • At the bottom take note of the ip address, the user name, and click the link into the account page to download your private key file
  • image
    image
  • Now open up the FileZilla site manager, the icon on the top left of your application.
  • image
  • Click on “New Site” on the bottom left of the window. On the top right, switch the protocol to SFTP. For the “Host” enter the ip address of your server. For the user type “bitnami” for the logon type choose “Key file” and browse to the .pem file you downloaded in the previous steps
  • image
  • Connect to your site
  • Navigate to the apps -> wordpress -> htdocs folder
  • Upload the two files that we downloaded from Duplicator plugin, the .daf database file and the installer.php file to this directory.
  • Now open up your favorite browser (I use chrome) and navigate to http://your-server-ip-address/installer.php
  • Check that all the requirements pass, I encountered an issue with the permissions of my wp-config.php file.
  • image
  • I edited the permissions by right clicking the file and adding “write” capability to the group:
  • image
  • The override install notice is fine, that just means we are overwriting our current WP site which is empty. Check the boxes and click continue
  • image
  • Next the Duplicator plugin will ask you to confirm that you want to override the current Database
  • image
  • Confirm and click OK then Next
  • This next step is important, Duplicator will update all links and assets such as images from your old server ip address to the new one. You can leave this with your new server ip if you would like, but I’ve had issues linking assets back with this before, so I prefer to change all references to the domain name we are routing to the ip address.
  • image
    image
  • When you are satisfied with the setting, click next
  • Duplicator will install the Database of your old website
  • Next upload the wp-content directory we downloaded in the first step to replace the old wp-content
  • Now go to your domain DNS settings, change the @ or A record to the IP address of your new server ip address
  • Notice how I used https:// in the url of my data for Duplicator. To get an SSL certificate working for your bitnami wordpress instance, it’s super easy. Use the bncert-tool outlined here: https://docs.bitnami.com/aws/how-to/generate-install-lets-encrypt-ssl/
  • Once that is done, your site should be completely migrated to your new server.
  • One last thing there is to do, is in on the AWS Lightsail Bitnami wordpress, there is always a little icon in the corner
  • image
  • To remove this icon login to your lightsail and SSH into your instance - then use this command:
    sudo /opt/bitnami/apps/APPNAME/bnconfig --disable_banner 1
  • Replace APPNAME with wordpress to disable the banner. Restart your instance and you should be good to go.
  • Login to your sites wp-admin and remove the duplicator installation files from your root directory and your finished!

Also published on Medium's wesleybaxterhuber

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.