Move WordPress to DreamHost

From DreamHost
Jump to: navigation, search

Here's how to move a WordPress installation from one location to your DreamHost account. (Warning: these instructions are written by users and may not match what you need to do exactly.) Before doing anything that cannot be reversed, back up the WordPress database.

The Easy Way: Use WordPress' export function. It's under Manage in WP 2.0 and earlier, and under Tools in later versions. This exports your posts, pages, comments and user accounts (although users will have to set new passwords).

The Better Way: Use the free Duplicator Plugin. It will package up your Wordpress install as well as the MySQL database on the "source" side. Then on the "target" side you simply create an empty database, upload the zipped package files and run the installer.php. The installer will ask you for the empty DB login details and will install the Wordpress files as well as the contents of the source DB. It will also update the Wordpress config and DB if your site URL has changed (this allows you to test on a sub-domain URL and then use this plugin to deploy to a production URL).

Note 1: Your source and target systems need to have the ZipArchive PHP extension installed so that the Duplicator plugin can zip the package. You can check this by going to the System Compatibility page in the Duplicator plugin. On Dreamhost that means your site must be running PHP 5.3. If your site isn't running 5.3, you can easily change it if you edit the web hosting options of your domain from the Domains Control Panel page.

Note 2: The 0.4.4 version of the plug in does not change the config info in wp-content/advanced-cache.php so you need to update that manually after install.

Other than that, this plugin works brilliantly and is FREE!

From your old host to DreamHost

Migrate your SQL database

See Migrate MySQL for detailed instructions. Note: to test a WordPress installation with the yourdomain.dreamhosters.com domain alias, you'll need to change the SQL values "siteurl" and "home" in the "wp_options" table.

Back up your database

Before you do anything else, back up your MySQL database. The method of creating a backup differs from host to host. The simplest method is to use phpMyAdmin, a web-based SQL manager available on many hosts' domain-management websites.

See the article Backup MySQL for instructions on three ways to make a SQL file containing your old database:

  1. From phpMyAdmin
  2. From cPanel (cPanel.net)
  3. From the shell via mysqldump

Create a destination hostname and database

Once you have a backup, make a new SQL hostname and a new, empty database for your WordPress installation, via DreamHost Web Panel > Goodies > MySQL Databases. If you make the hostname and the database's name, user, and password information the same as for your old hostname and database, you can avoid editing your wp_config.php file.

Transfer your WordPress installation

Next, transfer your WordPress installation's files from your old host to your new DreamHost account.

You can do this either:

  1. by downloading them to your computer first and then uploading them to DreamHost via FTP/SFTP, or
  2. by logging onto your DreamHost account via SSH and pulling the files from your other server via FTP/SFTP directly to your DreamHost server. This method can be much faster, especially if you have a big installation, so try it this way if you are even vaguely familiar with the Linux command prompt.

Either way, it will go faster if you archive and compress your old WordPress installation first. If your old host provides SSH access, you can log onto your old webhost's server via SSH. If not, they might provide a tool via their panel that will create a backup of your files on the server, which should allow you to download your entire directory or directories as a single .tar/.tar.gz/.zip file. You can then upload the single file to your DreamHost server and log on via SSH to decompress it on the server.

If executed correctly, this whole operation can be done in under 5 minutes.

Edit wp_config.php

After you transfer the database and WordPress files, make sure that the information in the wp_config.php file in your WordPress root directory matches the hostname and login information for your new database. Chances are that the name of the database that you set up on your DreamHost server will differ from the one on your previous host, and have a different username/password.

You may be able to avoid editing the wp_config.php file if you note this information from your previous host's control panel, and give your new DreamHost database exactly the same name as your old database; and you may be able also to create the same username/password combination for the database, depending upon whether these names are already in use on our system.

Test installation

When migrating MySQL from one host to another, you can test the new installation before modifying your domain's DNS entries. To do this, make a "mirror" of your DreamHost-hosted domain, by adding "yourdomainname.dreamhosters.com" as a mirrored subdomain. To do this, navigate to DreamHost Web Panel > Domains > Manage Domains, click the "Add New Domain / Sub-domain" button, and scroll down to the "Mirrored" section. Enter the new domain name in the "Domain that mirrors:" text field, and select the domain you want to mirror in the drop-down. Make sure to leave ".com", ".org", or ".net" out of your subdomain name: e.g. if your domain is "yourdomain.net", the new subdomain should be "yourdomain.dreamhosters.com". Then click the "Mirror with this subdomain now!" button. Once your mirror has been activated, you'll want to make sure you have a MySQL host name setup on it. You'll need to manually create the MySQL host name for your new mirrored sub-domain in the Goodies > Manage MySQL section of your web panel. The new MySQL host should be named in this format: mysql.yourdomain.dreamhosters.com. Then after that host name is setup, navigate to the mirror's phpMyAdmin interface, which should be located at yoursqlhostname.yourdomain.dreamhosters.com. Make sure to log in with the sql user login information you used to set up the database, not your DreamHost login information. Once you've logged into the phpMyAdmin interface, select the appropriate database, then "browse" the tables and edit their values to replace instances of "yourdomain.net" with "yourdomain.dreamhosters.com". When this is completed, you can then view your site at yourdomain.dreamhosters.com as installed. Once you've successfully confirmed and configured the installation, edit the appropriate SQL values back to "yourdomain.net"; you may then update your domain's DNS entries.

Update DNS records

Lastly, after you verified that everything is working on your DreamHost account, you'll have to point your domain name to DreamHost's name servers. Note that you don't need to transfer your domain to DreamHost, you only need to reconfigure its name servers to point to DreamHost. In order to do this, access your registrar, the service provider with whom you registered your domain. If you're not sure who you registered with, you can often find that information by going to Whois.net and entering your domain name in the search field. Access your registrar's control panel (it might be the same as your webhost, but doesn't have to be), and change your domain's name server settings to n1.DreamHost.com, ns2.DreamHost.com, and ns3.DreamHost.com. The change can take up to 48 hours to take effect, but often happens sooner.

Success

If you've done everything correctly, your domain will now bring up your WordPress installation on your DreamHost account. If you need to check if the domain is pointing to the right server, upload a text file to your domain's root directory on your DreamHost server (but not your old server) and try to access that file via a web browser. If it's there, that means your domain is now pointing to the right place!

Make sure that no edits take place on your WordPress installation during the 48 hour waiting period, since any changes that you make or any new content that you add will not carry over to your DreamHost account unless you retransfer the database as described above after your domain has transferred successfully. Also note that the easiest way to access your site's files during the transition period is by entering the your server's IP address as the hostname in your FTP/SSH program, making sure you note the correct IP address that is associated with each respective web hosting account.

External Links