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 126.96.36.199, 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 188.8.131.52 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.