To change hostname, login to the server as root and just type
where newname is the new hostname to be set
When you set hostname in that way, changes will be available till the server is rebooted only. For the changes to be effevtive even after a reboot, make the change permanent by doing the following.
vi /etc/sysconfig/network (redhat/fedora specific)
Save and quit.
Alternatively, check the /etc/hosts file and see if the old hostname is present there. IF yes, correct it as well.Read More