[lug] set host name

Hugh Brown hugh at math.byu.edu
Tue Dec 6 18:36:00 MST 2005


On Tue, 2005-12-06 at 19:00 -0500, Gordon Golding wrote:
> Setting the host name.
> When I look on the internet, there are so many variations, I figured I'd ask for input.
> 
> On Fedora Core 4:
> I install and check "set hostname via DHCP".  
> In the local environment, anybody without a static address gets a default name made out of their IP address.
> 
> I put the same server out into a less sophisticated environment and it ends up with "localhost".
> 
> When I do a Java function to get the IP, it gets it via the hostname and returns 127.0.0.1
> 
> So I need to set the host name.   
> On a machine where hostname isn't set, I have this in /etc/hosts:
> 127.0.0.1       localhost.localdomain   localhost
> 
> On a machine where I set it to myhost manually at install; etc/hosts:
> 127.0.0.1       myhost  localhost.localdomain   localhost
> 
> Is it that easy?  Add "myhost<TAB>" before localhost.localdomain?


It's sometimes that easy, but then other programs (notably mysql) will
wig out because they are expecting 'localhost.localdomain' or
'localhost' to be the first hostname listed for 127.0.0.1.

Experiment.  I remember spending a good chunk of time with developers
using the getHostBy* functions in Java because it was returning
something unexpected.

Hugh




More information about the LUG mailing list