Changing your Linux machine’s hostname is easy. Just follow the steps below.
root# hostname [new-host-name]
root# vi /etc/sysconfig/network
HOSTNAME=[new-host-name]
root# vi /etc/hosts
Make sure your new host is updated in the hosts file.
root# service network restart
Done!!