It is standard Debian and Ubuntu practice to add a line
127.0.1.1 foo
to /etc/hosts, where foo is the content of /etc/hostname. This ensures that the
system hostname is resolvable to an address for which it is the canonical hostname
and an address, furthermore, where services on the local host can be reached.
If the machine has a permanent IP address (e.g., 123.45.67.89) and fully qualified
domain name (e.g., foo.bar.com) then this IP address and FQDN are listed as the
IP address and canonical hostname for the system hostname which is listed as an
alias.
123.45.67.89 foo.bar.com foo
The 127.0.0.1 line should always be exactly as follows:
127.0.0.1 localhost
There is no need to list "localhost.localdomain" here. The system hostname
should not be included on the 127.0.0.1 line as an alias.
It is standard Debian and Ubuntu practice to add a line
127.0.1.1 foo
to /etc/hosts, where foo is the content of /etc/hostname. This ensures that the
system hostname is resolvable to an address for which it is the canonical hostname
and an address, furthermore, where services on the local host can be reached.
If the machine has a permanent IP address (e.g., 123.45.67.89) and fully qualified
domain name (e.g., foo.bar.com) then this IP address and FQDN are listed as the
IP address and canonical hostname for the system hostname which is listed as an
alias.
123.45.67.89 foo.bar.com foo
The 127.0.0.1 line should always be exactly as follows:
127.0.0.1 localhost
There is no need to list "localhost. localdomain" here. The system hostname
should not be included on the 127.0.0.1 line as an alias.