On Google Cloud Platform, the system hostname is changed either on boot or after some time. This can cause license errors.
dhclient script may not preserve the locally-configured hostname, so hosting providers use scripts to work around this issue. For example, Google Cloud Platform Services™ uses the
The workaround scripts may interfere with WHM's "Change Hostname" feature ("WHM » Home » Networking Setup » Change Hostname"), which causes hostname configuration issues and a locked cPanel & WHM license.
To resolve this issue, you must create a
dhclient exit hook script to set the hostname properly.
- Create the /etc/dhcp/dhclient-exit-hooks.d directory.
mkdir -p /etc/dhcp/dhclient-exit-hooks.d/
- Create the zzz-set-hostname.sh file.
- Edit zzz-set-hostname.sh and add the following information, replacing $host.domain.tld with the server's hostname.
- Set the executable permission on zzz-set-hostname.sh.
chmod +x /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh