Addition/Migrate.to.New.iRedMail.Server

From iRedMail

(Difference between revisions)
Jump to: navigation, search
(Migrate mailboxes (in maildir format))
(Important Notes for MySQL backend)
Line 56: Line 56:
'''This section is applicable to iRedMail-0.7.3 and earlier versions, with MySQL backend. Not required in iRedMail-0.7.4 and later versions.'''
'''This section is applicable to iRedMail-0.7.3 and earlier versions, with MySQL backend. Not required in iRedMail-0.7.4 and later versions.'''
-
Please force Dovecot to recalculate migrated users' mailbox quota after you copied/migrated mailboxes. Here's tutorial: [[IRedMail/FAQ/Recalculate.Mailbox.Quota |How to force Dovecot to re-calculate mailbox quota]]
+
Please refer to this section for more details: http://iredmail.org/wiki/index.php?title=Upgrade/iRedMail/0.7.3-0.7.4#Store_realtime_mailbox_quota_usage_in_seperate_SQL_table
-
 
+
-
This step is REQUIRED if you migrated mailboxes with iRedMail '''MySQL backend'''. Otherwise Dovecot will delete records in table '''vmail.mailbox''' to re-calculate mailbox quota.
+
-
 
+
-
 
+
-
Here's simple tutorial for your reference:
+
-
 
+
-
1) List all migrated users' email address in a plain text file, one address per line. Assume this file is /root/all_migrated_users.list.
+
-
 
+
-
2) Execute below shell command, it will create a file named "result.sql" under directory /root.
+
-
{{cmd|<pre>
+
-
# for email in $(cat /root/all_migrated_users.list ); do echo "UPDATE mailbox SET bytes=-1,messages=-1 WHERE username='${email}';"; done > /root/result.sql
+
-
</pre>}}
+
-
 
+
-
3) Import this SQL file to update SQL table, it will force Dovecot to re-calculate migrated users' mailbox quota when user first login to Roundcube webmail (or access mailbox via other IMAP clients).
+
-
{{cmd|<pre>
+
-
# mysql -uroot -p
+
-
mysql> USE vmail;
+
-
mysql> SOURCE /root/result.sql;
+
-
</pre>}}
+
== Migrate Roundcube webmail data ==
== Migrate Roundcube webmail data ==

Revision as of 12:32, 16 December 2011

Contents


TO BE CONTINUED.

Please try it on a test server first, if it works well, then try it on product server.

Since new iRedMail server will install same components as old server, you can choose what data you want to migrate. The major data are mail accounts, roundcube webmail database, mailboxes.


LDAP: migrate mail accounts

Steps to migrate LDAP mail accounts:

  • Setup a new server with the latest iRedMail, and make iRedAdmin-Pro-LDAP work as expected.
  • Export mail accounts from LDAP on OLD mail server.

Normally, LDAP data can be exported into LDIF format. Here's backup/export script: http://www.iredmail.org/wiki/index.php?title=IRedMail/FAQ/Backup

After exported from old server, you will get a plain text file which has LDIF data. You should remove top some items, includes:

  • dc=xxx,dc=xxx
  • cn=vmail,dc=xxx,dc=xxx
  • cn=vmailadmin,dc=xxx,dc=xxx
  • o=domains,dc=xxx,dc=xxx

Because we will use these ldap objects on new server, so remove them from exported data.

Assume the exported backup data is saved in file /root/old.ldif

  • Now, log into phpLDAPadmin with cn=Manager,dc=xxx,dc=xxx on NEW server, remove object of your mail domain. it should be:
    • domainName=your_domain.com,o=domains,dc=xxx,dc=xxx
  • Remove all sub-objects under this object.
  • Import /root/old.ldif with phpLDAPadmin.

You can find a button named "Import" in phpLDAPadmin left panel.

Note: You can find all upgrade tutorials here: http://www.iredmail.org/doc.html#upgrade_tutorial

MySQL: Migrate mail accounts

Migrate mailboxes (in maildir format)

  • Simply copy all mailboxes (in maildir format) to new iRedMail server.

WARNING: please make sure maildir path which stored/configured in LDAP will match the real path on file system, so that mail clients can find them.

Important Notes for MySQL backend

This section is applicable to iRedMail-0.7.3 and earlier versions, with MySQL backend. Not required in iRedMail-0.7.4 and later versions.

Please refer to this section for more details: http://iredmail.org/wiki/index.php?title=Upgrade/iRedMail/0.7.3-0.7.4#Store_realtime_mailbox_quota_usage_in_seperate_SQL_table

Migrate Roundcube webmail data

  • Export/import roundcube webmail database, and upgrade database to work with new version of Roundcube.

http://trac.roundcube.net/wiki/Howto_Upgrade

Personal tools