For cPanel & WHM version 68
/usr/local/cpanel/bin/set_hostname utility updates the server's hostname, and performs all of the necessary actions to apply this change throughout the system. This utility is useful if you wish to change the server's hostname during a process that requires you to call the binary (for example, automated cloning processes).
- Do not select a hostname that begins with
wwwor a number, or a hostname that ends with a hyphen (
- You must use a fully-qualified domain name (FQDN) that contains two periods (for example,
- Do not choose a hostname that a cPanel account on your server will use.
Do not choose a potential proxy subdomain as a hostname (for example,
- Do not select a socially-unacceptable hostname. The hostname will appear in mail headers.
Only use lowercase, Latin-script letters in hostnames.
You can also use the following methods to change the server's hostname:
- Enter the new hostname in the Set Up Networking section of WHM's Initial Setup Assistant interface.
- Use WHM's Change Hostname interface (WHM >> Home >> Networking Setup >> Change Hostname).
- Call WHM API 1's
If you use these methods, you do not need to run this utility.
To use the
/usr/local/cpanel/bin/set_hostname utility, run the following command as the
In this command,
newhostname is the new hostname that you wish to use on the server.
When you run this command, the
set_hostname utility performs the following actions:
- It updates the hostname in the
/etc/sysconfig/networkfile, and in the kernel.
- It updates the server's Apache configuration.
- It updates the cPanel license.
- It updates cPHulk.
- It restarts MySQL®.
- It rebuilds cPanel & WHM's global cache.
- It updates the FTP, Exim, Dovecot, and cPanel SSL certificates.
- Run the
/usr/local/cpanel/bin/set_hostname --helpcommand to view utility information on the command line.
If you specify the server's existing hostname when you run the command, the utility synchronizes the server's hostname configuration.
The utility returns an exit code of
0if it succeeds, or an exit code of
1if it fails.
To change the server's hostname to
hostname.example.com, run the following command:
If the update succeeded, the utility produces the following output: