Short answer: I generally use the FQDN as the hostname (as recommended on RH6/7 docs). However, the more righteous approach would be to use a single-label name as the hostname, setting the FQDN via
/etc/hosts. So, pick an approach and stick with it whenever possible.
Long answer: The main advantage of using the FQDN as the hostname is that the machine name intrinsically embeds domain information. This is very useful when receiving email alert and/or logs for multiple customers/domains, as it avoid duplicate hostnames (ie: hostnames are more-or-less guaranteed to be unique across multiple sites/customers/domains). For example, SNMP
sysName show the hostname by default and, by using the FQDN, it simply conveys a more useful information. The same is true for
zabbix-agent (and other monitor tools) or for bash
$HOSTNAME. While you can configure such tools for using FQDNs even on machine with single-label hostname, or configure them in an hierarchical model which clearly shows the domain containing the machine, this is additional work.
Some applications even require using a FQDN as the hostname, but they are quite the exception. Still, when the exception hits, the homogeneous use of single-label hostname is lost. This probably is the main reason behind RedHat's recommendation to use a FQDN as the hostname on RH6/7. More recent docs are more vague. On "Performing a standard RHEL 8 installation" one can read:
The host name can be either a fully-qualified domain name (FQDN) in
the format hostname.domainname, or a short host name with no domain
name. Many networks have a Dynamic Host Configuration Protocol (DHCP)
service that automatically supplies connected systems with a domain
name. To allow the DHCP service to assign the domain name to this
machine, specify only the short host name
while "Performing an advanced RHEL 8 installation" states:
If your network does not provide a DHCP service, always use the FQDN
as the system’s host name
In the years between the original question, user applications have learned to treat FQDN hostnames without the issue described in the previous answers. For example, bash
PS1 prompt uses
\h (the hostname up to the first '.') by default, and
rsyslog does not preserve FQDN in logfiles by default. In other words, the usability drawback of a FQDN hostname are no more for many common tools. For these reasons, I generally set the system hostname as a FQDN, leaving the shortname on
/etc/hosts as required.
The reason to not use a FQDN hostname is that, frankly, this is The Right Thing To Do. As respectively stated in the debian docs and hostname man page:
This file should contain only the system hostname, not a fully
qualified domain name
It is recommended that this name contains only a single label, i.e.
without any dots
So, while I do feel uneasy to use a FQDN hostname, it is easier using it in my environments.
Please note this is not an appeal against single-label hostname. If they work for you, continue using it. Otherwise, give the FQDN hostname a try.