I'm expected to receive the fully qualified domain name when using the hostname -f command.
It takes some time and manual page reading to find out that this result is normal. Indeed the /etc/hostname file must contain the server name, and not the fully qualified domain name.
The right command to use to get the fully qualified domain names is
hostname --all-fqdns and not hostname -f. There is no need to change the /etc/hosts file. It should contain
This 127.0.1.1 is weird, but it was set so by default.