User Tools

Site Tools


pre-sales:manual-migration

Manual Migrations

If you have websites you need migrated to a new server with us, we can do this for you for free if all of these conditions are met:

  • The control panel of the source server and the destination server match1)
  • We are given the needed level of access in the source server to utilize that panel's standard backup2)

If either of these are not possible, the site may need to be migrated manually. We offer this as a paid service for new signups at a discounted rate of $35 per hour. You can read more about this service here. But if you prefer to do it yourself, the process would be approximately as follows.

This article will be focusing primarily on the process for a destination server using cPanel/WHM. For DirectAdmin, the process is similar but the needed sections of the panel interface will be found in different locations, as will some of the needed filepaths.

Creating Accounts in the New Server

The first step is to create the account(s) in the new server, so that there is a place to put the data. For cPanel, you can learn more about this here.

Copying the Files

Once an account for the site exists in the destination server, you can copy the site files into the new documentroot. The site's Documentroot is the folder in the server that apache will serve files from for a site. In a cPanel server, this is /home/cpuser/public_html3) by default for the main domain of the cPanel account. If you are logging into the server via ftp or sftp as the cPanel user, then you will start out in /home/cpuser so you would be looking for folder public_html there. How to fetch the files from the source server may vary based on what if any panel is installed in the source server and how it is configured, but once you have downloaded them, you can upload them to the site's new documentroot in the destination server using ftp.4)

Copying the Databases

Many types of sites are not composed entirely of files, but rather, also make use of one or more databases. In cPanel, before a database can be imported, it must first be created. If this is your first time creating a database in a cPanel server, it is recommended to use the MySQL Database Wizard. You will need to create both a database and a mysql user for the site, and make sure the mysql user has any needed permissions granted for the database. Make sure to save the database name, database username, and database user's password, since you will need these momentarily.

Once the database is created in the new server, you will need to import the data from an sql file. First you will need to export the database in the source server into an sql file. How to do this will depend on what if any panel is installed in the source server and how it is configured. Once you have it, there are a couple of methods to import the file in the new server.

If the sql file is small, it may be easier to import it using PhpMyAdmin. But if the database is large, the sql file may be too large to import efficiently in this way. In this case, the recommendation is to upload the sql file to the server and then import it directly into mysql. First, you will need to upload the sql file, for example using ftp. But do not put it in the site's documentroot. It is recommended instead to put it directly into the cPanel user's home directory.5)

The next step will require the cPanel account to have either normal shell or jailed shell enabled. This can be checked and adjusted in WHM at Home » Account Functions » Manage Shell Access as described here. After this, you can log into the server via ssh as the cPanel user. If you are using Windows you may want to use PuTTY for this as described here, except that instead of logging in as root, it is recommended to log in as the cPanel user.

If you log in as the cPanel user, you will already be in the cPanel user's home directory when you log in. If that is where you put the sql file6) then you should be able to see the file in the list when listing the files with ls -hal or similar. Then, to import it into mysql, you can use the following command:

# mysql cpuser_db < exporteddb.sql

You will need to replace cpuser_db with the full name of the database you just created. This will usually be a name in the form cpuser_something where cpuser is replaced by the first eight characters of the cPanel user's username, and something will be replaced by whatever you entered into the MySQL Database Wizard while creating the database. Similarly, you will need to replace exporteddb.sql with the filename of the sql file you uploaded.

If the sql file was compressed, you will need to first uncompress it, with the appropriate program for the type of compression used. For example, the needed command might look like one of the following:

# gunzip exporteddb.sql.gz
# bunzip2 exporteddb.sql.bz2
# unzip exporteddb.sql.zip

If the database name, mysql username, or mysql user's password are different than they were in the old server, you will need to find the site's configuration file to update these, so that the site scripts will again be able to connect to its database correctly. Where this is set will vary by the type of site, but for example if it is a site running WordPress, you will be looking for a file named wp-config.php, specifically the lines like this:

define('DB_NAME', 'cpuser_db');
define('DB_USER', 'cpuser_user');
define('DB_PASSWORD', 'somepassword');
define('DB_HOST', 'localhost');

Sites not using WordPress will have configuration files with different names, possibly in different locations, and the formats of the required lines would likely be different as well.

Testing the Site

It is strongly recommended to test the site in the new server before changing the dns to point to the new server. You can learn more about how to do this here. Although this page describes the process for Windows first, it does further down the page describe how to do this in recent Mac operating systems.

Copying Emails

If there were also email accounts associated with the domain in the source server, you will want to get those copied as well. You can read more about this process here.

Wrap-up

For most sites, these will cover what you need to remember to copy from the old server, but if your site has things besides this that are necessary for the site to work, you will need to make sure to find and get those copied as well.

Changing the DNS

After the site has been tested and confirmed to be working in the new server, you will want to update any needed dns information at the registrar so that the site will be served live from your new server. If this is the domain the nameservers are based on, you may need to register the nameservers if you haven't already.

1)
i.e., both servers are cPanel or both servers are DirectAdmin
2)
i.e., in cPanel to Generate a Full Backup or in DirectAdmin to create user backups
3)
replacing cpuser with the username of the cPanel user
4)
or sftp or webdav or scp or rsync, if preferred
5)
i.e., /home/cpuser, the folder you will start in if you log into the server via ftp as that cPanel user
6)
as was recommended
pre-sales/manual-migration.txt · Last modified: 2017/02/26 12:36 by Marjorie S.