On Google Cloud Platform, the system hostname is changed either on boot or after some time. This can cause license errors.
The 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 google_set_hostname
script.
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.
Procedure
To resolve this issue, you must create a dhclient
exit hook script to set the hostname properly.
First, create the directory
# mkdir -p /etc/dhcp/dhclient-exit-hooks.d/
Next, create the file, remembering to change the "hostname.example.com" to your server hostname.
# nano /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh
#!/bin/sh
hostname hostname.example.com
/scripts/fixetchosts
Or, optionally, you can skip the text editor and use a one-line command to create the file. Again, be sure to insert your hostname.
# echo -ne '#!/bin/sh\nhostname hostname.example.com\n/scripts/fixetchosts\n' > /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh
Finally, once you have created the script with either method, ensure it has the correct permissions:
# chmod +x /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh
Comments
0 comments
Article is closed for comments.