Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)copy! share!
posted in category Digital Despotism / Linux
posted at 13. Mar '20

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 (starz.myrtana.sk) 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
starz

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
127.0.0.1 localhost
127.0.1.1 starz.myrtana.sk starz

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

Add Comment