How can I change my RedHat/CentOS servers hostname?

RedHat based systems use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit.

Here is a sample:
/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=myhost.mydomain.com
 FORWARD_IPV4=yes

In order to preserve your change on system reboot, edit this file and enter the appropriate name using the HOSTNAME variable.

Your rating: None Average: 4 (1 vote)