Introduction:
There are situations where you might need to manually transfer the entire or some part of your server configuration to another cPanel server. We have the /usr/local/cpanel/bin/cpconftool script that you can utilize for this specific purpose. Using the script all of the server's configuration is broken down into certain modules which correspond to specific services/interface in WHM. Here is the list of all the available modules:
/usr/local/cpanel/bin/cpconftool --list-modules
cpanel::easy::apache
cpanel::smtp::exim
cpanel::system::autossloptions
cpanel::system::backups
cpanel::system::greylist
cpanel::system::hulk
cpanel::system::modsecurity
cpanel::system::mysql
cpanel::system::whmconf
cpanel::ui::themes
You can manually transfer only a specific section of the server configuration by transferring only one of these modules. Here, for demonstration, we only attempt to transfer the cpanel::easy::apache module, but you can choose any other or all the above modules at the same time.
For general information about the cpconftool script, you can refer to the following article:
What is the cpconftool script?
Procedure:
Here we are transferring from a "source server" to a "destination server".
1- BackUp EasyApache's configuration on the source server using cpconftool:
/usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::easy::apache
Backup Successful
/home/whm-config-backup-cpanel__easy__apache-1.0.0-1620916318.tar.gz
Note: This will create an archive file under /home/. Also, you need to make sure that when running the command the "backup successful" message and a path to the backup file are shown.
2- Use your preferred tool to transfer the above backup file to the destination server. Here rsync is used since it's assumed that we have root access to both the destination and source server:
rsync -e ssh --info=progress2 $SERVER_IP:/home/whm-config-backup-cpanel__easy__apache-1.0.0-1620916318.tar.gz ~/
Note: This command needs to be run from inside the destination server and the $SERVER_IP here should be replaced by the IP of the source server.
3- Then you need to restore the configuration file using the following command:
/usr/local/cpanel/bin/cpconftool --restore=/path/to/file.tar.gz --modules=cpanel::easy::apache
If successful you should be able to see the following message:
/usr/local/cpanel/bin/cpconftool --restore=/home/whm-config-backup-cpanel__easy__apache-1.0.0-1620916318.tar.gz --modules=cpanel::easy::apache
Restore Successful
---
cpanel::easy::apache:
post_restore:
data: ~
status: 1
statusmsg: EA4 profile installed.
restore:
data:
version: 1.0.0
status: 1
statusmsg: "Whostmgr::Config::Restore::Easy::Apache: ok"
If all the above steps are completed without any error, then that means that you have successfully transferred the cpanel::easy::apache module (basically EasyApache's configuration) to the destination server. The same procedure can be used for any other module.