zimbra系统不支持直接将域名由A换至B,所以通过搭建新系统并迁移数据的方式。
一、在正式切换邮件系统前,同步现有数据到新系统,正式切换停掉服务后再同步一次:
root@mail:~# cat rsync.sh
#!/bin/bash
rsync -av –progress /opt/zimbra/index/ root@192.168.8.2:/opt/zimbra_bak/index/
rsync -av –progress /opt/zimbra/store/ root@192.168.8.2:/opt/zimbra_bak/store/
rsync -av –progress /opt/zimbra/db/data/ root@192.168.8.2:/opt/zimbra_bak/mysql/
nohup sh rsync.sh &
注:先建立信任关系,在新系统上创建目标目录
二、准备ldap文件,从老系统上导出ldap数据,修改老域名为新域名:
老系统:
ldapsearch -h mail.old.cn -x -D “uid=zimbra,cn=admins,cn=zimbra” -w pppssswwwddd > mail.old.cn.ldif
注: “pppssswwwddd” 是ldap(zimbra root)密码
将mail.old.cn.ldif 中的老域名修改为新域名
sed -i ‘s/old/new/g’ mail.old.cn.ldif
sed -i ‘s/old.cn/new.com/g’ mail.old.cn.ldif #这个地方看实际情况
mv mail.old.cn.ldif mail.new.cn.ldif
将mail.new.cn.ldif拷贝到新邮件系统。
三、如果邮件系统前有路由,先配置好端口路由及防火墙:
防火墙开放以上公网端口。
四、配置邮件系统的DNS:
new.cn :
MXmail.new.cn
Amail.new.cn1.2.3.4#1.2.3.4为公网ip
TXTv=spf1 a mx ~all#反垃圾检查
五、修改主机名、安装dnsmasq
root@mail:~# echo > /etc/hostname
root@mail:~# echo mail.new.cn > /etc/hostname
root@mail:~# cat /etc/hostname
mail.new.cn
root@mail:~# hostname mail.new.cn
apt-get install dnsmasq -y
root@mail:~# vim /etc/dnsmasq.d/new.cn.conf
server=192.168.8.2
domain=new.cn
mx-host=new.cn,mail.new.cn,5
mx-host=mail.new.cn,5
listen-address=127.0.0.1
service dnsmasq restart
六、在新机器上安装系统:
cd zcs-8.6.0_GA_1153.UBUNTU12_64.20141215195814/
./install.sh
Checking for prerequisites…
FOUND: NPTL
FOUND: netcat-openbsd-1.89-4ubuntu1
FOUND: sudo-1.8.3p1-1ubuntu3.7
FOUND: libidn11-1.23-2
FOUND: libpcre3-8.12-4ubuntu0.1
MISSING: libgmp3c2
FOUND: libexpat1-2.0.1-7.2ubuntu1.1
FOUND: libstdc++6-4.6.3-1ubuntu5
MISSING: libperl5.14
FOUND: libaio1-0.3.109-2ubuntu1
FOUND: resolvconf-1.63ubuntu16
FOUND: unzip-6.0-4ubuntu2.3
Checking for suggested prerequisites…
MISSING: pax does not appear to be installed.
FOUND: perl-5.14.2
MISSING: sysstat does not appear to be installed.
MISSING: sqlite3 does not appear to be installed.
安装相应包:
apt-get install libgmp3c2 libperl5.14 pax sysstat sqlite3 -y
再次执行:
./install.sh
root@mail:~/zcs-8.6.0_GA_1153.UBUNTU12_64.20141215195814# ./install.sh
Operations logged to /tmp/install.log.30327
Checking for existing installation…
zimbra-ldap…NOT FOUND
zimbra-logger…NOT FOUND
zimbra-mta…NOT FOUND
zimbra-dnscache…NOT FOUND
zimbra-snmp…NOT FOUND
zimbra-store…NOT FOUND
zimbra-apache…NOT FOUND
zimbra-spell…NOT FOUND
zimbra-convertd…NOT FOUND
zimbra-memcached…NOT FOUND
zimbra-proxy…NOT FOUND
zimbra-archiving…NOT FOUND
zimbra-core…NOT FOUND
PLEASE READ THIS AGREEMENT CAREFULLY BEFORE USING THE SOFTWARE.
ZIMBRA,INC. (“ZIMBRA”) WILL ONLY LICENSE THIS SOFTWARE TO YOU IF YOU
FIRST ACCEPT THE TERMS OF THIS AGREEMENT. BY DOWNLOADING OR INSTALLING
THE SOFTWARE,OR USING THE PRODUCT,YOU ARE CONSENTING TO BE BOUND BY
THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL OF THE TERMS OF THIS
AGREEMENT,THEN DO NOT DOWNLOAD,INSTALL OR USE THE PRODUCT.
License Terms for the Zimbra Collaboration Suite:
http://www.zimbra.com/license/zimbra-public-eula-2-5.html
Do you agree with the terms of the software license agreement? [N] y
Checking for prerequisites…
FOUND: NPTL
FOUND: netcat-openbsd-1.89-4ubuntu1
FOUND: sudo-1.8.3p1-1ubuntu3.7
FOUND: libidn11-1.23-2
FOUND: libpcre3-8.12-4ubuntu0.1
FOUND: libgmp3c2-2:4.3.2+dfsg-2ubuntu1
FOUND: libexpat1-2.0.1-7.2ubuntu1.1
FOUND: libstdc++6-4.6.3-1ubuntu5
FOUND: libperl5.14-5.14.2-6ubuntu2.5
FOUND: libaio1-0.3.109-2ubuntu1
FOUND: resolvconf-1.63ubuntu16
FOUND: unzip-6.0-4ubuntu2.3
Checking for suggested prerequisites…
FOUND: pax
FOUND: perl-5.14.2
FOUND: sysstat
FOUND: sqlite3
Prerequisite check complete.
Checking for installable packages
Found zimbra-core
Found zimbra-ldap
Found zimbra-logger
Found zimbra-mta
Found zimbra-dnscache
Found zimbra-snmp
Found zimbra-store
Found zimbra-apache
Found zimbra-spell
Found zimbra-memcached
Found zimbra-proxy
Select the packages to install
Install zimbra-ldap [Y]
Install zimbra-logger [Y]
Install zimbra-mta [Y]
Install zimbra-dnscache [Y] n
Install zimbra-snmp [Y]
Install zimbra-store [Y]
Install zimbra-apache [Y]
Install zimbra-spell [Y]
Install zimbra-memcached [Y]
Install zimbra-proxy [Y]
Checking required space for zimbra-core
Checking space for zimbra-store
Checking required packages for zimbra-store
zimbra-store package check complete.
Installing:
zimbra-core
zimbra-ldap
zimbra-logger
zimbra-mta
zimbra-snmp
zimbra-store
zimbra-apache
zimbra-spell
zimbra-memcached
zimbra-proxy
The system will be modified. Continue? [N] y
Removing /opt/zimbra
Removing zimbra crontab entry…done.
Cleaning up zimbra init scripts…done.
Cleaning up /etc/ld.so.conf…done.
Cleaning up /etc/security/limits.conf…done.
Finished removing Zimbra Collaboration Server.
Installing packages
zimbra-core......zimbra-core_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-ldap......zimbra-ldap_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-logger......zimbra-logger_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-mta......zimbra-mta_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-snmp......zimbra-snmp_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-store......zimbra-store_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-apache......zimbra-apache_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-spell......zimbra-spell_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-memcached......zimbra-memcached_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done zimbra-proxy......zimbra-proxy_8.6.0.GA.1153.UBUNTU12.64_amd64.deb...done
Operations logged to /tmp/zmsetup03252017-201041.log
Installing LDAP configuration database…done.
Setting defaults… MX: mail.new.cn (192.168.8.2)
Interface: 192.168.8.2 Interface: 127.0.0.1 Interface: ::1 192.168.8.2
done.
Checking for port conflicts
Main menu
1) Common Configuration:
2) zimbra-ldap: Enabled
3) zimbra-logger: Enabled
4) zimbra-mta: Enabled
5) zimbra-snmp: Enabled
6) zimbra-store: Enabled
+Create Admin User: yes
+Admin user to create: admin@mail.new.cn
* +Admin Password UNSET
+Anti-virus quarantine user: virus-quarantine.tofqin0el@mail.new.cn
+Enable automated spam training: yes
+Spam training user: spam.b4n_54dfo@mail.new.cn
+Non-spam(Ham) training user: ham.emxspmv9g@mail.new.cn
+SMTP host: mail.new.cn
+Web server HTTP port: 8080
+Web server HTTPS port: 8443
+Web server mode: https
+IMAP server port: 7143
+IMAP server SSL port: 7993
+POP server port: 7110
+POP server SSL port: 7995
+Use spell check server: yes
+Spell server URL: http://mail.new.cn:7780/aspell.php
+Enable version update checks: TRUE
+Enable version update notifications: TRUE
+Version update notification email: admin@mail.new.cn
+Version update source email: admin@mail.new.cn
+Install mailstore (service webapp): yes
+Install UI (zimbra,zimbraAdmin webapps): yes
7) zimbra-spell: Enabled
8) zimbra-proxy: Enabled
9) Default Class of Service Configuration:
s) Save config to file
x) Expand menu
q) Quit
Address unconfigured (**) items (? – help) 2
Ldap configuration