Introduction:
Migrating an account via SSH is not as complex as it may seem. You will require some basic knowledge of the command line though.
The basic principle is that the account will be packaged up entirely: 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 source server, either via SSH or FTP. 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 the source server
ssh root@xxx.xxx.xxx.xxx2. Create an account backup file. This command will create the archived file, and place it in the /home/ directory of the source server.
/scripts/pkgacct account-name3. Transfer the account backup file to another 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 -P destination_PORT /home/backup-x.x.xxxx_xx-xx-xx_account-name.tar.gz root@destination_IP:/home/restoreme.tar.gzA breakdown of the above command is below:
Commandline | Definition |
|---|---|
scp | This initiates the Secure Copy |
-P | This is the flag for the destination Port, default is port 22 |
/home/backup-x.x.xxxx_xx-xx-xx_account-name.tar.gz | The source, or local file |
root@destination_IP:/home/restoreme.tar.gz | The user, destination, and location you wish for it to go |
Restore account backup
Once this transfer is completed, we are now done with the source server, and can log out.
We will now need to log into the destination server via SSH, and run one single command,
/scripts/restorepkg /home/restoreme.tar.gzThis command will unpackage the account, create all the databases, email, and accounts etc.
Ensure you don't close the terminal during this process as it can take up to 30 minutes to complete.