How to set up hostname and hostname --fqdn

Proper hostname is required for knowing the name of a computer (e.g. starz), used by log service for example and hostname --fqdn is hostname with fully qualified domain name ( which is required by several system services like bind and mariadb.

FQDN error message

$ hostname --fqdn
hostname: Temporary failure in name resolution

Set up hostname

$ cat /etc/hostname

Set up hostname --fqdn

The best way to set hostname with fully qualified domain is in /etc/hosts. I was able to define it in DNS server bind before, but after system upgrade bind itself required hostname --fqdn to work...

$ cat /etc/hosts localhost starz

A reboot is required after adding a hostname. "starz" on line must match hostname in /etc/hostname, i.e. keep the names the same. More info can be found in man 5 hosts.