For changing the Hostname of a CentOS Server follow steps below:
- Open the global network configuration file:
nano /etc/sysconfig/network
- Find the HOSTNAME setting. It’s default value will looks like below:
HOSTNAME=localhost
- Replace that localhost value with chosen fully qualified domain name.
HOSTNAME=centos.tekbloq.com
- Save changes and exit and reboot the server for applying host name changes immediately