Ubuntu – What are the ramifications of setting the hostname

hostnamelinuxnetworkingUbuntu

I have several Amazon EC2 servers and I'm using Chef to manage the configuration. I'd like to set the hostname so that the default bash prompt is more helpful.

Right now after launching a new server it's just set as:

root@ip-10-123-123-123

Since I'm using Ubuntu 12 on these boxes I consulted the corresponding man page for hostname. It has a lot of good information on how to set it, and talks a little about the hostname and the fqdn, but it doesn't really tell me what I want to know:

What are the ramifications of setting the hostname?

I'd like to assume that setting the hostname is mostly a convenience item for users and sysadmins, giving the box a face / nice-name so it can be more easily recognized internally (via the command prompt, e-mails that are sent, etc), but I'm not positive.

I don't see the hostname listed in the /etc/hosts file, which appears to be a good sign that
it won't affect anything negatively if changed:

127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Am I on the right track? What are the ramifications of setting the hostname?

Update

I tried changing the hostname on my ec2 instance from ip-10-123-123-123 to webserver and hostname --fqdn no longer works. If I put it back then it works fine. Apache also gives me an error when starting that it can't reliably determine the fqdn. I suppose there must be some way to set the hostname without messing up the fqdn.

Best Answer

I just wanted to add that the hostname should be resolvable, either through DNS or /etc/hosts. If it isn't, many tools might exhibit long delays due to a failing host name lookup. I had this problem with many GUI programs.

Related Question