If you run hostname and you receive the message hostname: Name or service not known, that probably means your hostname isn't set.

You may be able to run the hostname command without any options and not receive any error message, but if you run hostname -f you might see the message "hostname: Name or service not known". If so, this probably means that you have not set a fully qualified domain name for your server.