Linux – How to change the server’s host name

hostnamelinux

At work, I have a Linux server which I would like to change the name from "testmain" to "test1". I have contacted the IT guys to change the DNS to associate the new name to its static IP and it works. What is left now is to change the host name on the server. I have tried the 'hostname' command and it seems to work, but a reboot will reset the hostname back. I appreciate any pointers. Here is the output of uname -a:

Linux testmain 2.6.9-67.0.7.ELsmp #1 SMP Wed Feb 27 04:47:23 EST 2008 x86_64 x86_64 x86_64 GNU/Linux

The server is running Red Hat Enterprise Linux. Thank you.

Best Answer

You can specify it in /etc/sysconfig/network:

NETWORKING=yes
HOSTNAME=myawesomebox