How to migrate a complete cPanel Account via SSH
  • 08 Feb 2023
  • 2 Minutes to read
  • Dark
    Light

How to migrate a complete cPanel Account via SSH

  • Dark
    Light

Article summary

Introduction

Migrating an account using cPanel's migration tool is extremely useful, and rather bullet-proof.

The basic principle, is the account will be packaged up in it's entirety; public_html website files, databases, all DNS settings, emails, etc; and placed into a .tar.gz file, marked as:
backup-[Timestamp]_[Account Name].tar.gz

The aim is to get this file packaged up, sent off to the receiving server, and then unpackaged and restored.

Process:

You will need access to the old server, either SSH, or FTP will do. If you don't have SSH root access, you will need to create a 'Full Account Backup' using the cPanel login you have.

Root & SSH Access:

1. Log into source / old server

ssh root@xxx.xxx.xxx.xxx

2. Create account backup file

/scripts/pkgacct account name

This command will create the archived file, and place it in the /home/ directory of the OLD server.

3. Transfer account backup file to other server

Now we will need to get it over to the receiving / new server, this can be done a number of ways. The most common method being SCP (Secure copy protocol), as it is available on any server running SSH and allows placement of the file anywhere that the destination user has access to.

scp /home/backup-x.x.xxxx_xx-xx-xx_account-name.tar.gz root@destinationIP:/home/restoreme.tar.gz

Breakdown of the above command:

scp | Initiating the Secure Copy

/home/backup-x.x.xxxx_xx-xx-xx_account-name.tar.gz (The source, or local file)

root@destinationIP:/home/restoreme.tar.gz (The user, destination, and location you wish for it to go)

4. Restore account backup

Once this transfer is completed, we are now done with the Old / source server, and can logout.

We will now need to log into the destination server via SSH, and run one single command,

/scripts/restorepkg /home/restoreme.tar.gz

This command will unpackage the account, create all the databases, email and accounts etc.

Ensure you don't close the terminal during this process, it can take up to 30 minutes to complete.

cPanel Account Access:

1. Create account backup

Login to shared hosting, or cPanel account, and navigate to 'Backup' under files:

Once in the Backup section, you need to click 'Download a full Website Backup' -despite the wording, this is a full account backup and will contain a backup with everything, not just web files.

Now you will want to enter an email address to receive the notification of completion - and click   'Generate Backup'.

3. Get the account backup transferred.

Once the account backup file has been created, you can now proceed to transfer it over to the new server.

The easiest way to do this, will be to SSH into the destination server, and then use FTP to transfer it over.

ssh root@destinationserver

ftp ftp://account-name@old-server-ip
Enter Password

Now you will be logged into the FTP server on the OLD server FROM the NEW server, you can proceed to download the file to the new server by using the following commands:

get backup-x.x.xxxx_xx-xx-xx_account-name.tar.gz /home/restoreme.tar.gz

This command will retrieve the account backup file, and place it in the /home/ directory on the new server.

Once the transfer is completed, log out and exit ftp

4. Restore the account backup on the new server

/scripts/restorepkg /home/restoreme.tar.gz

Afterword

The migration tool is very verbose, and will give you all of the necessary information, if any errors become apparent, the tool will ensure you are aware of this.

Bear in mind, the migration tool will also take initiative in areas such as DNS; it will automatically change and update records that will now be invalid on the new server, such as SPF records.





Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence