First you need to find out your hostname, you can do this with
$ hostname localhost.localdomain $
You need to edit /etc/hosts and add a line for your host name
$ cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost $
My new server IP is 184.108.40.206, i need to assign it hostname server12.hosthat.com, to do this, i have edited /etc/hosts as follows.
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 220.127.116.11 server12.hosthat.com server12
First lets see what is in the file
$ cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.localdomain $
To change servers hostname to server12.hosthat.com, change the file as follows.
$ cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=server12.hosthat.com $
Now you need to reboot the server to change the hostname.