Saturday, 15 March 2014

cPanel to cPanel migration via SSH - Multiple domains

Migrate multiple cPanel domains within a blink of an eye.  Lets do the cPanel migration. Please find the steps below.

Assume “S” is our source server and “D” is our remote server.


1) Make sure you don’t have any cPanel backups under “/home” directory in either “S” or “D” server. If you have, then move it to some other folder.

2) Login to server “D

3) Run the below command.

cat /etc/trueuserdomains | awk '{print $2}' > /home/usrlist


Here what happening is, you will get all cPanel account name in file “/home/usrlist”

4) Start a new screen session by running the below command.

screen -S screenname


( Always use screen to do long running tasks. Even if the connection close, it won’t effect the screen session )

5) Run the below command to backup all domains in your system.

for x in $(cat /home/usrlist); do /scripts/pkgacct $x; done


( The above command will take backup of all your domains and will put it under “/home” directory. )

6) Run the below command to move all backups and “usrlist” file to the directory “/home/bck”

cd /home&& mkdir /home/bck&& mv *.tar.gz usrlist /home/bck


7) Use “scp” to move the files under “/home/bck” to “S” machine. ( It could be a long process. So make sure to run this under “screen” session )

scp -r /home/bck/* root@S machine IP/Hostname:/home


8) After completing the “scp” file transfer, login to “S” machine

9) Start a “screen” session and run the below command to restore all the backups.

for x in $(cat /home/usrlist); do /scripts/restorepkg $x; done


That’s it!! :) You have migrated all the domains from “D” machine to your “S” machine”

No comments:

Post a Comment