One of the most common changes to CentOS servers is modifying the hostname. Hostnames are human-readable nicknames that correspond to the address of a device connected to a network. Some software such as CPanel require a valid Fully Qualified Domain Name or FQDN for the hostname to be used during their Licensing verification system.
1. Sysconfig/Network: Open the /etc/sysconfig/network file with your favourite text editor. Modify the HOSTNAME= value to match your FQDN host name:
# sudo nano /etc/sysconfig/network
2. Hosts File: Change the host that is associated to your main IP address for your server, this is for internal networking, found at /etc/hosts:
3. Hostname Command: The 'hostname' command will let you change the hostname on the server that the command line remembers, but it will not actively update all programs that are running under the old hostname.
# hostname yourserver.yourdomain.co.nz
4. Restart Networking: All necessary changes that needed to be made have been made, you need to restart networking on your server to make sure that changes will be persistent on reboot:
# /etc/init.d/network restart