Change main hostname and IP of WHM/cPanel machine

One thing you’ll probably run into sometime is changing the hostname and IP address of a cPanel machine.. whether you’re cloning it for a quick start or if you’ve taken it over.. moving it to a different datacenter, etc..

This is based on CentOS 6…

First, grab a license for the new IP address you’re going to use..

Next, edit the following files with the new information and restart the network:
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network
Next, remove /etc/.whostgrft (this will restart the cpanel setup screen)
Next, edit /etc/wwwacct.conf

Log into whm as root and run through the setup..

Next, run /scripts/rebuildhttpdconf

Afterwards, you’ll find some other files that still may have old info.. here are some:

/etc/hosts
/etc/localdomains
/etc/mail_reverse_dns

You might still see old info in the httpd.conf file, so manually edit it and run:

/usr/local/cpanel/bin/apache_conf_distiller –update

If you come across other changes that need to be made, please comment below!