How to Migrate a Local WordPress Install to a Live Site
Using a local server environment will save you a bunch of time if you regularly develop new WordPress websites. Local development has many advantages – it’s faster and more secure than constantly uploading files to a server.
The only problem is migrating to a web host can be a headache. No one likes to mess around with database tables.
Fortunately, migration is simpler than it sounds and will take you not time at all if you follow the steps below.
In this article, I’ll show you how to use the Duplicator plugin to quickly and easy copy a localhost WordPress installation to an online hosting account.
There are many different ways to migrate a WordPress site, but one of the easiest, by far, is with the free Duplicator plugin.
It’s an overwhelmingly popular plugin in the WordPress Plugin Repository, with a 4.9 out of 5 stars rating and more than 700,000 downloads.
In the steps below, I’ll explain and illustrate the steps for migrating a localhost site with Duplicator. The exact steps will differ depending on your online server/host setup.
Before we get started, you’ll need:
- An FTP client and login details for your live site.
It’s also important to note that you don’t need to install WordPress on the destination server before following these steps. Duplicator will copy across all necessary WordPress files for you.
Step 1. Package Your Site With Duplicator
Download and install Duplicator on your localhost site. The plugin is available for free in the WordPress Plugin Repository, so you can search for it in the plugin interface.
Once installed and activated, click on “Duplicator” in the admin sidebar and the Duplicator Packages interface will be displayed. Since I’ve just installed Duplicator, I don’t have any packages.
So what is a package? A package consists of an archive of your site (the default is a .ZIP file) and an installer file that automates the process of setting up your archived site on another server.
Click on “Create New” to create a package.
The next screen will prompt you to name your package and make a few notes. It’s not really important what you name your package, though you might want to give it a memorable title if you plan to make multiple packages. Add a few notes if you want to.
There are optional Archive and Installer settings, but we’ll ignore these for now. The Archive settings allow you to filter your database, while the Installer options can be used to pre-fill the Installer screen so that it is setup at install time for future use. This can help speed up your overall install process.
Click “Next” to move on.
Duplicator will run a system scan to ensure the package build process will run smoothly. The scan step can help determine any potential issues. Passing all scan checks aren’t required in order to attempt a build, though the more “Warn” checks you get, the more likely it is you will run into issues during the build and install phases.
The scan didn’t uncover any major issues on my site other than large image files, which I’ll ignore because it’s unlikely the images will cause any problems in upcoming steps.
Click “Build” to create your package.
The plugin will begin backing up your site.
As mentioned above, Duplicator will produce two files: an archive of your site (as a .ZIP file) and an installer file (as a .PHP file).
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
Download both files to your desktop.
Step 2. Copy Installer and Archive Files to Live Site
In order to install and unpack my packaged site, I need to copy the archive and installer files Duplicator created to my live site’s directory. I’m going to use Filezilla to do this with FTP.
Login to your site via FTP. Navigate to your public_html folder and copy the archive and installer files from your desktop to the folder. It may take a little while for the files to copy, especially if your archive file is quite large.
Step 3. Installing Your Site On Your Live Server
The next step is to install the archived site on the live server. To do this, we’ll need to access the installer file we just copied to the live site, by adding /installer.php to the domain.
In my case, the address is http://littleraewrites.com/installer.php
The installer interface will appear, prompting you to add your MySQL details. If you’re replacing an existing WordPress site (i.e. copying across an updated version of a site), you’ll need to enter your existing database details.
If you’re creating a new site, click “Create New” and enter fresh database details. Some hosting providers don’t allow the database creation option to work, which means you’ll need to manually create the database yourself.
Since my web host won’t let me automatically create a new database, here are the steps for creating a new database in cPanel:
- In cPanel, open MySQL Database.
- Create a new database and name it anything you like, though it will have a prefix.
- Create a new user.
- Add your newly created user to your newly created database.
- Give your user access to all privileges and click “Make Changes.”
- When you’ve filled out your database details, click “Test Connection” to check whether the installer can access your database.
Ensure you get a “Success” manage for both the “Server Connected” and “Database Found” tests before moving on to the next step. This will ensure you won’t encounter any problems during installation.
Click “Close” and at the bottom of the installer screen check “I have read all warnings and notices”. Then click “Run Deployment.”
The installer will then begin installing your site on your live server. It may take a while for the installation process to complete if your site is quite large.
During installation, Duplicator will ask you to confirm old and new details for your site. Make sure they’re correct and click “Run Update.”
Final Duplicator Steps
Duplicator will ask you to complete four more short, yet important, steps:
1. Install Report – This is simply a report detailing any errors encountered (hopefully none!) and the numbers of database tables, rows and cells created, scanned and updated so you can check the plugin has copied across your database information.
2. Save Permalinks – Click on the link “Save Permalinks” link and you’ll be taken to your new, live site where you can save your permalinks preference.
3. Test Site – When you click on “Test Site” it will open the front-end of your live site so you can check that everything is working.
4. File Cleanup – It’s important to remove the installer file and any associated files that were created during the installation process for security purposes. Click on “File Cleanup” to automatically delete these files.
Check Your Live Site
And that’s it. Your live site should now be an exact replica of your localhost installation, only now it’s available online for all the world to see.
Do you use Duplicator to migrate sites? If not, what method works best for you? Tell us in the comments below.