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/old.ixnfo.com/ cp /etc/postfix/main.cf /root/old.ixnfo.com/ cp /etc/dovecot/dovecot.conf /root/old.ixnfo.com/ cp /etc/hostname /root/old.ixnfo.com/ cp /etc/mailname /root/old.ixnfo.com/ cp /etc/hosts /root/old.ixnfo.com/ cp /etc/amavis/conf.d/50-user /root/old.ixnfo.com/
Then I changed the address of the old domain in these files to the new one, for example, old.ixnfo.com to new.ixnfo.com. 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 "old.ixnfo.com" /etc/
I also needed to reconfigure DKIM for a new domain:
amavisd-new showkeys amavisd-new genrsa /var/lib/dkim/new.ixnfo.com.pem 2048 chown amavis:amavis /var/lib/dkim/new.ixnfo.com.pem chmod 0400 /var/lib/dkim/new.ixnfo.com.pem
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