How do I change the server's fqdn?

My mail server is complaining about fqdn. hostname --fqdn gives: only the short name and domainname gives: (none). Searched on Inet with no usable result, most said to add it to the /etc/hosts file so I did and rebooted and no change. Tried to search on this Rocky help site and it responded that I had done too many searches and to try again later. Didn’t return anything useful on searches I did. This seems like it should be “Linux 101” but I can’t find any reference anywhere. Can anyone help?
Thanks in advance.

1 Like

The order in /etc/hosts is important, eg:

1.2.3.4 myserver.example.com myserver

if you put it the other way around, eg myserver first, and then myserver.example.com then it won’t work.

Also, that is only part of it, since a mail server also relies on DNS, as well as the mail server configuration. Maybe the FQDN isn’t configured correctly in postfix, or whatever is being used?

1 Like

Thanks for the prompt response. I updated /etc/hosts because I did have the short name first. I’m not sure yet if the mail server is happy but your second comment is relevant → the in-service mail server is on the old machine and the dns records/NAT point there; the new server that I am testing lives on the new machine and the only way to get here so far is using redirection from the old one. A bit of a mess but I’m moving things around as time permits. The mail server software is Surgemail.

2 Likes