How to migrate Zimbra 6,7,8 and next version with script from one server to another


I’ll be logged in as root. If you have lockou or closed mailbox you can not export the mailbox content. You have to check mailbox status. Step 1 – Login as Zimbra.
root@mail:/# su – zimbra

Export Script

Step 2 – Create file in which I will include the script for export .
zimbra@mail:~$ touch /opt/zimbra/backup/export.sh
Step 3 – Make this file exeutable.
zimbra@mail:~$ chmod u+x /opt/zimbra/backup/export.sh
Step 4 – Create file in which the script will save retrieve date.
zimbra@mail:~$ touch /opt/zimbra/backup/users.list
Step 5 – Open this file with the following command.
zimbra@mail:~$ nano /opt/zimbra/backup/export.sh
Step 6 – I will include mu script. The script retrieve all mailbox and all domain and save in this file /opt/zimbra/backup/users.list then will save content of all mailbox include in this list.
/opt/zimbra/bin/zmprov -l gaa > /opt/zimbra/backup/users.list
for account in `cat /opt/zimbra/backup/users.list` ; do echo “Processing ${account} …” /opt/zimbra/bin/zmmailbox -z -m $account getRestURL ‘/?fmt=tgz’ > /opt/zimbra/backup/$account.tgz done

Copy export mailbox content to new server with rsync. It’s best way.

Step 7 – On the new server you have to set full permission on folder in you which save mailbox content. Execute the following command.
zimbra@mail:~$ chmod 777 /opt/zimbra/backup/
Step 8 – Execute the following command from your old server. Rsync work on port 22 but I will use diferent port, I will use port 2222. The ip address of my new server is 192.168.0.190. You have to root user for new user.
zimbra@mail:~$ rsync -raz -e ‘ssh -p 2222? /opt/zimbra/backup/* root@:/opt/zimbra/backup/

Import Script – if you don’t have the all account from old server on your new server you have to read ‘Export and import account’ section below

Step 9 – You have to full permission on the folder in which you will save files.
zimbra@mail:~$ chmod 777 -R /opt/zimbra/backup/
Step 10 – Create file in which I will include the script for import.
zimbra@mail:~$ touch /opt/zimbra/backup/import.sh
Step 11 – Make this file exeutable.
zimbra@mail:~$ chmod u+x /opt/zimbra/backup/import.sh
Step 12 – Create file in which the script will save retrieve date.
zimbra@mail:~$ touch /opt/zimbra/backup/users.list
Step 13 – Open this file with the following command.
zimbra@mail:~$ nano /opt/zimbra/backup/export.sh
Step 14 – I will include mu script. The script retrieve all mailbox and all domain and save in this file /opt/zimbra/backup/users.listthen will import all content of all mailbox in this list.
//opt/zimbra/bin/zmprov -l gaa > /opt/zimbra/backup/users.list
for account in `cat /opt/zimbra/backup/users.list` ; do echo “Processing ${account} …” /opt/zimbra/bin/zmmailbox -z -m $account postRestURL “/?fmt=tgz&resolve=modify” /opt/zimbra/backup/$account.tgz done

Export and import account – From new server you have to connect to old server and retrieve mail account

Step 15 – On old server as Zimbra user execute the following command and retrieve password which you need later.
zimbra@mail:~$ zmlocalconfig -s zimbra_ldap_password
Step 16 – Click Migration wizard.
Step 17
Step 18 – Import from another Zimbra LDAP directory
Step 19 – Set same password for all new accounts. For SMTP Host set ip address on your old server
Step 20 – Bind password – include password which you retrieve above. For dc write name of your domain. For example linux-sys-adm.
Step 21
Step 22
Step 23 – Select account to import
Step 24 – Click search button.
Step 25 – Click add all button.
Step 26 – Use admin user and password from your old server.
Step 27
Step 28 – Click Finish button.
Posts Contents: Download More Blogspot contents(Posts) for you site

Comments