Howto move Cpanel accounts from one remote server to another using command line.

12th Jan 2024 | category: Web Hosting | Hits: 967 Howto move Cpanel accounts from one remote server to another using command line.

To move cPanel accounts from one remote server to another using the command line, you can use the "pkgacct" utility provided by cPanel on the source server to create backup files of the cPanel accounts, transfer those backups to the new server, and then use the "restorepkg" utility on the new server to restore the accounts. Here are the steps you can follow:

NOTE: In this guideline we used Centos 7 server as source of pickup into AlmaLinux 8.

Step 1: - Log in to the source server as the root user via SSH.

Generate backups for the cPanel accounts you want to transfer. Use the pkgacct utility for this.
Replace USERNAME with the actual cPanel username:

 
                                    

NOTE:

  • Backup requires time to get completed depending your your file size and server resources.
  • Avoid running several files if your still in live server.
  • When complete, this will create a backup file in the /home/cpmove-USERNAME.tar.gz format.
Step 2: - Transfer backup to new server

You can then transfer these backup files to the new server. You can use various methods, such as SCP, SFTP, or FTP to copy the files to the new server

 
                                    


Replace the following:

  • /home/cpmove-USERNAME.tar.gz with the path to the backup file on your CentOS 7 server.
  • root with the username for SSH access to the AlmaLinux server.
  • 192.168.1.22 with the public IP of your destination (AlmaLinux) server.
  • /path/to/destination/directory/ with the directory path on the destination (AlmaLinux) server where you want to copy the backup file. For example /home/. So the full command will be scp /home/cpmove-USERNAME.tar.gz root@192.168.1.22:/home/
Step 3: - Log in to the destination server

On the Destination Server (AlmaLinux 8), Log in to the destination server as the root user via SSH.

Upload the cPanel account backup files you transferred from the source server to a directory on the new server, typically the home directory.

Restore the cPanel accounts using the restorepkg utility. Replace USERNAME with the actual cPanel username:

 
                                    

Your newly restored "USERNAME" account will be available in /home/ Directory with the rest of the accounts on your cpanel - whm web hosting server.