I was under the impression that CentOS was like RHEL. If that is the case, /etc/sysconfig/network should contain a HOSTNAME= entry that is used by /etc/rc.d/sysinit to set the hostname at boot time.
Code:
[root@athlonz ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=athlonz.tomlovell.com
[root@athlonz rc.d]# hostname
athlonz.tomlovell.com
[root@athlonz rc.d]#
/bin/hostname is an executable
Code:
[root@athlonz ~]# file /bin/hostname
/bin/hostname: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
Also, I have an entry in /etc/hosts so that reverse lookups will work, but I don't think that is necessary or even related to setting the hostname.
Code:
[root@athlonz rc.d]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.94 athlonz.tomlovell.com athlonz
[root@athlonz rc.d]#
If this is not the case on CentOS, my apologies for adding to the confusion.