How to Move cPanel Accounts From One Server to Another

Many web hosting services include cPanel with hosting plans. Depending on the web hosting, both cPanel and WHM may already be installed on your server. What happens if you want to replace your old server with a new one? Can you still keep the same cPanel account?

In this tutorial, we will cover how to switch cPanel accounts from one server to another. This is not including a website migration. If you are looking to backup and transfer a complete website, with information such as a database using cPanel, then you may want to look at this video that explains the process in great detail.

This tutorial will guide you to move your cPanel accounts from one server to the next, along with SSL certificates, and your main IP address. In addition, this tutorial is catered to individuals who have experience with using the terminal, and other commands for the back end. It is not for users who are unfamiliar with the command line.

Of course, before you transfer your cPanel account over to another server, you must be sure that you currently have the cPanel and WHM installed on your new server. If you do not have cPanel installed on your new server, you can do so by following the installation guide provided by cPanel. There may be other ways that one could move cPanel accounts to another server, but the methods that are used in this tutorial are standard from the cPanel website itself.

When installing cPanel to your new server, there are some steps you will need to take in order to keep your main IP address and cPanel account. To start, access the WHM’s Basic Web Host Manager Setup interface, by going to: Home–>Server Configuration–>Basic Web Host Manager Setup. It may seem counter intuitive, but you will need to select a new host name and main IP address. In addition, you will need to select the same host name and shared IP address as the previous server. These settings will help with the configuration of your DNS zones and past accounts. Your permanent license from the previous server will be transferred to the new server during the migration process.

Once you have successfully installed cPanel and WHM on your new server you will have to transfer all old accounts to your new server. If your website is on https you will need to transfer the SSL certificates + keys from the etc/ssl/ directory. To quickly transfer your accounts, use WHM’s transfer tool. Go to Home–>Transfers–>Transfer Tool. Here you will be able to select the accounts you want to transfer. You can transfer every account if desired.

Next, make sure there are no existing DNS clusters. You can check this by going to the WHM’s DNS Cluster interface. Go to Home–>Clusters–>DNS Cluster. Once you’re sure there are no existing DNS clusters, you can shut the old server down.

Once your old server has been shut down, you must change the main IP address of your new server, as previously created, to the old main IP address from the old server. To change the main IP, do the following:

  • Open the /etc/sysconfig/network-scripts/ifcfg-eth0 file.
  • Edit the IPADDR and GATEWAY lines to use the IP address and gateway of your old server.
  • Open the /etc/ips file with a text editor.
  • Remove the previous IP from the file. Add your old server’s primary IP address, net mask, and gateway to the file.
  • Restart the network service with the following commands:
    • For operating systems (and earlier versions)- CentOS 6, CloudLinux 6, Red Hat Enterprise Linux (RHEL) 6, Amazon Linux(always runs in a NAT configuration):
      • Service network restart command.
    • For operating systems (and later versions)- CentOS 7, CloudLinux 7, RHEL 7:
      • systemctl restart network command.
  • Run the /scripts/mainipcheck command to add the IP address to the /var/cpanel/mainip file.
  • Run the /scripts/fixetchosts command to add the IP address and hostname of your server to the /etc/hosts file.

Now that the main IP address has been changed, the accounts that have been transferred to the new server must contain the new main IP address that you have just made. This can be done using the IP Migration Wizard interface. Go to Home–>IP Functions–>IP Migration Wizard.

You are almost done! Reinstall the SSL certificates to the new server. If you do not have any SSL certificates from a Certificate Authority, or use an SNI-compatible operating system, than you can skip this this step. You can install the SSL certificate using WHM’s Install an SSL certificate on a domain interface. Go to Home–>SSL/TSL–>Install an SSL Certificate on a domain. You can either Fetch a .crt file, or you can manually paste the certificate into the text box. After clicking submit, it will install the certificate.

For the last step, you will need to confirm that your cPanel license is valid. Go to verify.cpanel.net to verify your license. This completes the migration of accounts from your old server to a new one!