Linux : Mail issues after renaming server hostname

By | July 26, 2020

If you changed the hostname/FQDN of a Linux server, you may end up with some issues, especially with mailing if some areas were forgotten with that change. Here is a quick procedure involving all the steps you should be looking for. (The following example is based on a Debian Linux system running Postfix MTA.)

1. Update the hostname file :

/etc/hostname

2. Update the hosts file :

/etc/hosts

3. Update the mailname file :

/etc/mailname

4. Update the Postfix main.cf file :

/etc/postfix/main.cf

myhostname =
mydestination =

5. Update the DNS pointer record (PTR), if you had any :

0.0.0.0.in-addr.arpa. IN PTR your-new-hostname.domain.tld

 

OPTIONAL

6. Update the aliases file if you had any added entries with the previous FQDN

/etc/aliases

6.1. Rebuild the aliases database :

newaliases