Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
stylenone

Overview

To configure VPS deployments, many cloud hosting providers use the dhclient script, which includes the configuration of the instance's hostname.

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.

The solution

To resolve this issue, you must create a dhclient exit hook script to set the hostname properly.

Create the set-hostname.sh file with the following contents in the /etc/dhcp/dhclient-exit-hooks.d/ directory, where hostname.example.com represents your server's new hostname:

Code Block
linenumberstrue
#!/bin/sh
hostname hostname.example.com
/scripts/fixetchosts

You can also create the file with the following command, where hostname.example.com represents your server's new hostname:

Code Block
mkdir -p /etc/dhcp/dhclient-exit-hooks.d/ && echo -ne '#!/bin/sh\nhostname hostname.example.com\n/scripts/fixetchosts\n' > /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh && chmod +x /etc/dhcp/dhclient-exit-hooks.d/zzz-set-hostname.sh


Additional documentation

Localtab Group


Localtab
activetrue
titleSuggested documentation

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("hostname","license") and label = "whm" and space = currentSpace()


Localtab
titleFor cPanel users

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("hostname","license") and label = "cpanel" and space = currentSpace()


Localtab
titleFor WHM users

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("hostname","license") and label = "whm" and space = currentSpace()


Localtab
titleFor developers

Content by Label
showLabelsfalse
max5
showSpacefalse
cqllabel in ("hostname","license") and space = "DD"