Hal yang perlu dilakukan untuk migrasi tentu saja instalasi zimbra mailserver. Saya menggunakan OS Ubuntu 10 LTS dgn ZCS 7.2
Langkah berikutnya kurang lebih sbb :
1. List semua domain yg ada pada mailserver lama dan tambahkan domain ke zimbra melalui zimbra admin https://webmai.domain.ltd:7071. Klik pada panel kiri menu configuration klik domain. Klik new tambahkan domain email di server lama klik finish.
2. Eksport email account dari mailserver lama
3. Import email account ke server zimbra
4. Pindahkan data email dari server lama ke server zimbra.
Detailnya sbb :
Point 1 saya kira sudah jelas, point2 selanjutnya penjelasannya sbb :
2. Eksport email account dari mailserver lama
Gunakan script php berikut berikut, sesuaikan login dan nama db email.
Simpan dgn nama misalnya eksport.php dan jalankan dgn perintah php eksport.php
jika berhasil maka akan file exported.sh akan digenerate.
<?php ///////////////////////////////////////////////////////// $user="Your_mysql_login"; $pass="Your_mysql_pass"; $base="Your_mysql_database"; $tabl="Your_Table_mailbox"; //table $file="exported.sh"; ///////////////////////////////////////////////////////// echo "Usage: as "zimbra" user on destination server:n"; echo "# sh ./exported.shnn"; echo ""; $mydb = mysql_connect('localhost',$user, $pass) or die ('Error of connection with server'); mysql_select_db($base); mysql_query("SET CHARACTER SET utf8"); mysql_query("SET NAMES utf8"); $query = "SELECT username,password,name,maildir,quota,domain FROM ".$tabl; $dane = mysql_query($query) or die ('Error during query for bazy1'.mysql_error()); $handle = fopen($file, "w"); while ($row = mysql_fetch_array($dane, MYSQL_NUM)) { $StringData = "zmprov ca ".$row[0]." dsfs123hsdyfgbsdgfbsd displayName '".$row[2]."'n"; fwrite($handle, $StringData); $StringData = "zmprov ma ".$row[0]." userPassword '{crypt}".$row[1]."'"."n"; fwrite($handle, $StringData); } ?>
3. Import email account ke server zimbra
Copy file exported.sh ke mailserver zimbra, ubah owner filenya jadi milik zimbra dan beri hak akses eksekusi (chmod), ketik : # su - zimbra $ ./home/aku/exported.sh Tunggu sampai proses selesai dan coba cek pada halaman zimbra admin, apakah account sudah masuk atau belum.
4. Pindahkan data email dari server lama ke server zimbra.
Pada mailserver lama email disimpan pada directory /usr/local/virtual. Gunakan perintah scp di server zimbra untuk mengambil semua file.
# cd /usr/local
# scp -r -P 22 root@ipserverlama:/usr/local/virtual .
Tunggu sampai selesai.
Format dari file email sbb /usr/local/virtual/nmdomain/username/...
Setelah selesai proses pengambilan email lewat scp, buat sebuah file dgn nama convertmail.sh yg isinya script sbb :
Tunggu hingga proses selesai, dan coba login ke account anda di mailserver zimbra.
#!/bin/bash # Postfix virtual transport -> Zimbra mailbox migration # written by NERvOus (http://www.nervous.it) - 2009-12-25, Modified By Gigih Forda Nama 2011 # base folder where msgs will be imported BFOLDER="Arsip-Mail" ZMMBOX="/opt/zimbra/bin/zmmailbox" BDIR=$(pwd) echo You must run $0 from inside /var/mail/virtual directory echo $0 expects to find the mailboxes in the current path! echo The structure of maildirs must be as follows: echo echo "domain/username/{cur|new|tmp}" echo "domain/username/subfolder1/{cur|new|tmp}" echo "domain/username/subfolder2/{cur|new|tmp}" echo ... echo echo All folders will be stored in a subfolder called $BFOLDER echo The hierarchy of subfolders will be maintained under $BFOLDER. echo echo Press Enter to start, CTRL+C to abort. read # handle folders with a space inside, they are more common than you may # think IFS=' ' for p in $(find . -type d -name cur); do DOMAIN=`echo $p | cut -d'/' -f2` UNAME=`echo $p | cut -d'/' -f3` DIRNAME=`echo $p | cut -d'/' -f4` # this may fail, if folder already exists. Who cares. Ignore the # error. echo createFolder /$BFOLDER | $ZMMBOX -z -m $UNAME@$DOMAIN if [ "$DIRNAME" == "cur" ]; then echo Importing INBOX folder for $UNAME@$DOMAIN from $BDIR/$DOMAIN/$UNAME/ 1>&2 # we are importing the top level folder echo addMessage /$BFOLDER $BDIR/$DOMAIN/$UNAME/cur | $ZMMBOX -z -m $UNAME@$DOMAIN echo addMessage /$BFOLDER $BDIR/$DOMAIN/$UNAME/new | $ZMMBOX -z -m $UNAME@$DOMAIN else DIRNAME=$(echo $DIRNAME | sed -e 's//cur$//') echo Importing folder $DIRNAME for $UNAME@$DOMAIN from $BDIR/$DOMAIN/$UNAME/$DIRNAME 1>&2 echo createFolder '/$BFOLDER/$DIRNAME' | $ZMMBOX -z -m $UNAME@$DOMAIN echo addMessage '/$BFOLDER/$DIRNAME' '$BDIR/$DOMAIN/$UNAME/$DIRNAME/cur' | $ZMMBOX -z -m $UNAME@$DOMAIN echo addMessage '/$BFOLDER/$DIRNAME' '$BDIR/$DOMAIN/$UNAME/$DIRNAME/new' | $ZMMBOX -z -m $UNAME@$DOMAIN fi done
Script taken from : http://staff.unila.ac.id/gigih/2011/08/04/mail-migration-from-postfix-mysql-to-zimbraldap-backend-again/