Setting the fully qualified domain name on an Ubuntu host is way too hard. The Internet is full of confusing advice. Most people first seem to notice the FQDN isn’t right when setting up Apache, but it’s a broader problem than that. (You can fix Apache just by giving an explicit ServerName directive.) “hostname -f” should return the right thing.
- /etc/hostname contains just the system name, “wi”
- /etc/hosts contains an entry like this:
188.8.131.52 wi.nelson.monkey.org wi
- /etc/resolv.conf contains an entry like this:
And now “hostname” returns “wi”, “hostname -f” returns “wi.nelson.monkey.org”. Note I don’t have a reverse DNS entry for that IP address. (I do have forward DNS so wi.nelson.monkey.org resolves, but I don’t think it’s used.)
Part of the confusion is a lot of people (and Ubuntu by default) want you to do something like
127.0.1.1 wi.nelson.monkey.org wi
This kind of works, despite the odd loopback address number. But it’s not really correct: your FQDN should resolve to a routeable IP address, not a loopback.