Changing hostname after installing iRedMail

Once I installed iRedMail on one Ubuntu Server and later I had to change the domain that I specified during installation, so in this article I will describe where I changed it.

First of all, you need to add a new domain through iRedAdmin.

Then I made backup copies of the files that I was going to change:

mkdir /root/
cp /etc/postfix/ /root/
cp /etc/dovecot/dovecot.conf /root/
cp /etc/hostname /root/
cp /etc/mailname /root/
cp /etc/hosts /root/
cp /etc/amavis/conf.d/50-user /root/

Then I changed the address of the old domain in these files to the new one, for example, to SOGO was not used, so there was no need to edit.

If anything, you can do a full-text search in all files in the /etc/ directory:

grep -Fr "" /etc/

I also needed to reconfigure DKIM for a new domain:

amavisd-new showkeys
amavisd-new genrsa /var/lib/dkim/ 2048
chown amavis:amavis /var/lib/dkim/
chmod 0400 /var/lib/dkim/

See my article:
How to add DKIM record for iRedMail

After that, I reloaded the services:

service postfix restart
service dovecot restart
service amavis restart

Also, do not forget to change the PTR record:
Configure the PTR record on the DNS server
Configuring Reverse DNS (PTR) in Hetzner

Leave a comment

Leave a Reply