Migrate old iRedMail server to the latest stable release

Warning

Please practise the migration on a test server first, make sure you understand the whole procedure and migrate all required data.

Since new iRedMail server will install same components as old server, you can choose what data you want to migrate.

Most important data are:

Warning

Do not restore database mysql exported from old server, it contains SQL usernames/passwords for Roundcube/Amavisd/iRedAPD/iRedAdmin/... used on old server. New iRedMail server has the same SQL usernames, but different passwords. So please do not restore it.

Client settings (Outlook, Thunderbird)

Since iRedMail-0.8.7, iRedMail enforces secure POP3/IMAP/SMTP connections, please update your mail client applications to use TLS connection.

Note

LDAP: migrate mail accounts

Steps to migrate LDAP mail accounts:

Normally, LDAP data can be exported into LDIF format. Here's backup/restore procedure: Backup and Restore.

Notes:

MySQL/PostgreSQL: Migrate mail accounts

All mail accounts are stored in database vmail.

Migrate mailboxes (Maildir format)

Warning

mysql> USE vmail;
mysql> SELECT CONCAT(storagebasedirectory, '/', storagenode, '/', maildir) FROM mailbox WHERE username='user@domain.com';
$ ldapsearch -x -D 'cn=Manager,dc=xx,dc=xx' -b 'o=domains,dc=xx,dc=xx' -W "(mail=user@domain.com)" homeDirectory

Migrate (mlmmj) mailing lists

Attention

mlmmj mailing list was introduced in iRedMail-0.9.8.

Mailing lists are stored in 2 places:

For mailing list accounts, they should be migrated while migrating mail accounts mentioned in steps above.

For mailing list data, you can simply copy them to new server. After copied, the data must be owned by user/group mlmmj:mlmmj with permission 0700.

Migrate Roundcube webmail data

Reference: https://github.com/roundcube/roundcubemail/wiki/Upgrade

Migrate Amavisd, iRedAPD, iRedAdmin databases

Export those database on old server, then import them on new server.

Migrate DKIM keys

Amavisd will read DKIM keys and sign outgoing emails. DKIM keys are stored under /var/lib/dkim by default, you can copy all keys under this directory to new server, and make sure they have correct file owner amavis:amavis and permission 0600.

If you prefer generating new DKIM keys on new server, don't forget to update DNS records for mail domain names.

Post-migration

After migration, please recalculate mailbox quota by following this tutorial:

References