[CentOS] Changing hostname?

Sat Sep 13 21:29:48 UTC 2008
R P Herrold <herrold at owlriver.com>

On Sat, 13 Sep 2008, John R Pierce wrote:

> RobertH wrote:
>> Marcus,
>> Exactly, I have often wondered upstream does it that way so that I always
>> have to go fix the /etc/hosts file after every CentOS install.
>> Since functionally, it is wrong.

> indeed, having the hostname bound to the loopback interface seems to break a 
> bunch of our java stuff too.    first thing we've always had to do after a 
> CentOS/RHEL install is change /etc/hosts, and put the hostname on its own 
> line with the static IP, or leave it out entirely.

To some extent this confusion on how host names are 
determined, is an artifact being expressed due to the host 
being in a environment without the reverse DNS entries lookup 
working properly, or being built at one address and deployed 
to another with static networking. (sometimes the result gets 
saved into: /etc/sysconfig/network by anaconda -- by hand 
editing /etc/hosts, one is 'cacheing' an answer there ;) )

The 'dance' of hostname setting makes a series of inquiries, 
until it hits a 'success' state.  By editting /etc/hosts, one 
is permitting it to find an answer that is 'less good' than 
the rDNS, but still good enough.  Ditto editting 
/etc/sysconfig/network as the documentation in:
 	rpm -qd initscripts

This has not changed in years, but is not as well documented 
as it might be, as this thread reveals.

-- Russ herrold