By default, your server is started with the server’s given name as the hostname. Some software, such as cPanel, requires a valid Fully Qualified Domain Name (FQDN) for the hostname to be used during their licensing verification system.
Follow the steps to change the hostname of server
- Login as root to server and open the below file
# sudo nano /etc/sysconfig/network
- Modify the HOSTNAME=”your hostname of server” , the given value should be in FQDN. Ex: server1.example.com
HOSTNAME=server1.example.com
- For internal networking, change the host that is associated with the main IP address for your server, you can do it in this file /etc/hosts
127.0.0.1 localhost localhost.localdomain
123.45.67.89 server1.example.com hostname
- Run the hostname command. This command lets you change the hostname on the server that the command line remembers, but it does not actively update all programs that are running under the old hostname.
# hostname server1.example.com
# hostname
server1.example.com
- Restart networking on your server to ensure that changes will persist on restart.
# /etc/init.d/network restart