[CentOS] Changing hostname?

Mon Sep 15 12:47:07 UTC 2008
Shu Sugimoto <shu at anzubar.org>


on 2008/09/14 0:41, Marcus Moeller wrote:
> Concerning RH or CentOS: I have to define /etc/hosts on all machines
> that do not obtain their hostname via DHCP. I have not yet figured out
> that the HOSTNAME variable in /etc/sysconfig/network is used in any
> form (correct me if I am wrong).

See /etc/rc.d/rc.sysinit. In that file you can find following lines


if [ -f /etc/sysconfig/network ]; then
     . /etc/sysconfig/network


# Set the hostname.
update_boot_stage RChostname
action $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}


The ${HOSTNAME} variable comes form /etc/sysconfig/network.