Moving cPanel accounts from a shared WHM server to a Dedicated WHM server

I came across this easy way to move cPanel accounts from one server to another.

In this instance, the original server was a re-seller account on a 3rd party server, the new server was a Dedicated server owned by Matter Solutions.

Due to limitations imposed by the 3rd party, the only option to move accounts was to do a remote backup via cPanel for each user.

Step 1

We first create a new website account on our new server (This is only temporary).
Make sure to enable Shell (SSH Command Line) access.

Step 2

Using the logins for that new account we go through each account on the old server.
Using the Backup Wizard we start a Full Site backup.
In the destination source we choose “SCP Remote Location”.

We then enter in our Shell (SSH Command Line) details.
Server, Username, Password, Port (Usually always 22) and remote location (Usually had to put just a / as a blank would error).

Step 3

After clicking back, the old server then creates the full backup an transfers it across to the new server.
Now as we told it to drop it in the root folder (/) of the account we can find the files under /home/newaccuser/.
Make sure that all the backup files needed are here. (The user names are in the file name).

Step 4

Move all the backups from this location to the /home/ folder (or up one level).
as these where the only tar.gz files in the directory we where working in we could run the below command to do this for us.
mv *.tar.gz /home

Step 5

Once this was completed we then ran the restoration script for each file.
/scripts/restorepkg /home/backup-6.28.2013_13-17-33_username.tar.gz
(Changing the Dates an username to your own files).

This then creates the users on the new server, and then restores everything back into place.

Additional Steps for NAT

Now as our new server runs inside Amazon Web Services data center in Sydney we had to do one more step to finish everything off.

When the restore package script runs, it will replace the old IP address with the servers new IP address.
And as our server has NAT ip’s the New ip it gets is the local networks (ie. 10.0.1.55).

So since we knew that these accounts where the newest on this server and would be the only ones with this IP Address,
We ran the below script to just fix the DNS records up so they had the correct NAT IP address.
replace "10.0.1.55" "54.X.X.X" -- /var/named/*.db
(Here would replace the Before and After IP’s with your own.)

I originally found these commands over at this blog:
http://www.sohailriaz.com/