安装之前请确认一下事情做完了

本实验以CENTOS6.4 64位为例. 最小化安装外加开发包

1.关闭SELINUX

2.关闭防火墙

3 修改主机名

vi /etc/sysconfig/network
hostname=mail.fuck.com

4修改/etc/hosts 文件

vi /etc/hosts
192.168.1.230 mail.fuck.com mail

5停止系统默认邮件服务

chkconfig postfix off
/etc/init.d/postfix stop

由于zimbra严重依赖DNS  所以本实验安装一个DNS服务器为zimbar提供服务


bind-9.8.6-P1  安装的这个版本

从这里下载 https://www.isc.org/downloads/

解压后

./configure --prefix=/usr/local/named
make && make install

安装完成后执行如下命令

[root@mail sbin]#cd /usr/local/named/sbin
[root@mail sbin]# ./rndc-confgen ../etc/rndc.conf

手动生成named.conf文件  内容如下


key "rndc-key" {
       algorithm hmac-md5;
       secret "KtmBXwhdXZLLAkZo+IBqfA==";
 };
 controls {
       inet 127.0.0.1 port 953
               allow { 127.0.0.1; } keys { "rndc-key"; };
 };
options { 
directory "/dns/data"; 
pid-file "named.pid";
}; 
zone "." IN {
        type hint;
        file "named.ca";
};
zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};
zone "fuck.com" IN {
        type master;
        file "fuck.com.zone";
        allow-update { none; };
};
zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "1.168.192.arpa";
        allow-update { none; };
};
[root@mail etc]#

其中

key "rndc-key" {
       algorithm hmac-md5;
       secret "KtmBXwhdXZLLAkZo+IBqfA==";
 };
 controls {
       inet 127.0.0.1 port 953
               allow { 127.0.0.1; } keys { "rndc-key"; };
 };

这一段时刚才用./rndc-confgen命令生成的rndc.conf文理里面的最后几句,请复制过来并取消注释.


然后新建目录 mkdir -p /dns/data

进入data目录

以此建立以下文件


[root@mail data]# ls
1.168.192.arpa  fuck.com.zone  localhost.zone  named.ca  named.local  named.pid  query.log
[root@mail data]# cat 1.168.192.arpa
$TTL   1D
@                IN     SOA     fuck.com  root.fuck.com  (
                                      2011050616 ; Serial
                                      3H         ; Refresh
                                      15M        ; Retry
                                      1W         ; Expire
                                      1D )       ; Minimum
@                 IN      NS       ns.fuck.com.
230              IN     PTR       mail.fuck.com.
253              IN     PTR       www.fuck.com.
[root@mail data]# cat localhost.zone
$TTL    86400
$RIGIN localhost.
@           1D IN SOA   @ root (
                    42      ; serial (d. adams)
                    3H      ; refresh
                    15M     ; retry
                    1W      ; expiry
                    1D )    ; minimum
            1D IN NS    @
            1D IN A     127.0.0.1
[root@mail data]# cat named.ca
; <<>> DiG 9.8.6-P1 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36444
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;.                              IN      NS
;; ANSWER SECTION:
.                       14522   IN      NS      a.root-servers.net.
.                       14522   IN      NS      b.root-servers.net.
.                       14522   IN      NS      c.root-servers.net.
.                       14522   IN      NS      d.root-servers.net.
.                       14522   IN      NS      e.root-servers.net.
.                       14522   IN      NS      f.root-servers.net.
.                       14522   IN      NS      g.root-servers.net.
.                       14522   IN      NS      h.root-servers.net.
.                       14522   IN      NS      i.root-servers.net.
.                       14522   IN      NS      j.root-servers.net.
.                       14522   IN      NS      k.root-servers.net.
.                       14522   IN      NS      l.root-servers.net.
.                       14522   IN      NS      m.root-servers.net.
;; Query time: 143 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Dec 05 14:22:59 CST 2013
;; MSG SIZE  rcvd: 228
[root@mail data]# cat named.local   
$TTL    86400
@       IN      SOA     localhost. root.localhost.  (
                                      2011050522 ; Serial
                                      3H         ; Refresh
                                      15M        ; Retry
                                      1W         ; Expire
                                      1D )       ; Minimum
        IN      NS      localhost.
1       IN      PTR     localhost.
[root@mail data]# cat fuck.com.zone
$TTL  1D
@                 IN SOA     fuck.com  root.fuck.com  (
                                      2011050522 ; Serial
                                      3H         ; Refresh
                                      15M        ; Retry
                                      1W         ; Expire
                                      1D )       ; Minimum
        IN      NS      ns.fuck.com.
        IN      MX 10   mail.fuck.com.
@       IN      A       192.168.1.230
ns      IN      A       192.168.1.230
mail    IN      A       192.168.1.230
[root@mail data]#

完成后启动DNS  /usr/local/named/sbin/named -c /usr/local/named/etc/named.conf


测试DNS


[root@mail data]# nslookup
> 192.168.1.230
Server:         192.168.1.230
Address:        192.168.1.230#53
230.1.168.192.in-addr.arpa      name = mail.fuck.com.
> exit
[root@mail data]# nslookup
> mail.fuck.com
Server:         192.168.1.230
Address:        192.168.1.230#53
Name:   mail.fuck.com
Address: 192.168.1.230
> set q=mx
> fuck.com
Server:         192.168.1.230
Address:        192.168.1.230#53
fuck.com        mail exchanger = 10 mail.fuck.com.
> set q=ptr
> 192.168.1.230
Server:         192.168.1.230
Address:        192.168.1.230#53
230.1.168.192.in-addr.arpa      name = mail.fuck.com.
>

OK一起正常




6、安装zimbra依赖库

yum -y install fprintd-pam libstdc++ nc file sysstat
yum -y install libidn11 curl fetchmail libpcre3 libgmp3c2 libxml2 libstdc++6 openssl perl sysstat libtool-ltdl compat-libstdc* nc  file


zimbra 下载地址http://www.zimbra.com/downloads/os-downloads.html

最新版本是8.0.5  大概600多M

我下载的文件时 zcs-8.0.5_GA_5839.RHEL6_64.20130910123908.tgz

解压

进入   zcs-8.0.5_GA_5839.RHEL6_64.20130910123908

执行 ./install.sh  

./install 有很多参数 可以看帮助



[root@mail zcs-8.0.5_GA_5839.RHEL6_64.20130910123908]# ./install.sh
Operations logged to /tmp/install.log.3958
Checking for existing installation...
    zimbra-ldap...NOT FOUND
    zimbra-logger...NOT FOUND
    zimbra-mta...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-cluster...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.4.html
Do you agree with the terms of the software license agreement? [N] y
............
Do you agree with the terms of the software license agreement? [N] y
Checking for prerequisites...
     FOUND: NPTL
     FOUND: nc-1.84-22
     FOUND: sudo-1.8.6p3-7
     FOUND: libidn-1.18-2
     FOUND: gmp-4.3.1-7
     FOUND: /usr/lib64/libstdc++.so.6
Checking for suggested prerequisites...
     FOUND: perl-5.10.1
     FOUND: sysstat
     FOUND: sqlite
Prerequisite check complete.
Checking for installable packages
Found zimbra-core
Found zimbra-ldap
Found zimbra-logger
Found zimbra-mta
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] y
Install zimbra-logger [Y] y
Install zimbra-mta [Y] y
Install zimbra-snmp [Y] y
Install zimbra-store [Y] y
Install zimbra-apache [Y] y
Install zimbra-spell [Y] y
Install zimbra-memcached [N] y
Install zimbra-proxy [N] y
Checking required space for zimbra-core
Checking space for zimbra-store
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/prelink.conf...done.
Cleaning up /etc/security/limits.conf...done.
Finished removing Zimbra Collaboration Server.
Installing packages
    zimbra-core......zimbra-core-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-ldap......zimbra-ldap-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-logger......zimbra-logger-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-mta......zimbra-mta-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-snmp......zimbra-snmp-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-store......zimbra-store-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-apache......zimbra-apache-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-spell......zimbra-spell-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-memcached......zimbra-memcached-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
    zimbra-proxy......zimbra-proxy-8.0.5_GA_5839.RHEL6_64-20130910123908.x86_64.rpm...done
Operations logged to /tmp/zmsetup.12122013-130057.log
Installing LDAP configuration database...done.
Setting defaults...
DNS ERROR resolving MX for mail.fuck.com
It is suggested that the domain name have an MX record configured in DNS
Change domain name? [Yes] y
Create domain: [mail.fuck.com] fuck.com
        MX: mail.fuck.com (192.168.1.230)
        Interface: 192.168.1.230
        Interface: 127.0.0.1
        Interface: ::1
done.
Checking for port conflicts
Main menu
   1) Common Configuration:                                                 
   2) zimbra-ldap:                             Enabled                      
   3) zimbra-store:                            Enabled                      
        +Create Admin User:                    yes                          
        +Admin user to create:                 admin@fuck.com               
******* +Admin Password                        UNSET                        
        +Anti-virus quarantine user:           virus-quarantine.4pxgnng5@fuck.com
        +Enable automated spam training:       yes                          
        +Spam training user:                   spam.dopagkpx@fuck.com       
        +Non-spam(Ham) training user:          ham.t0plz98s@fuck.com        
        +SMTP host:                            mail.fuck.com                
        +Web server HTTP port:                 80                           
        +Web server HTTPS port:                443                          
        +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.fuck.com:7780/aspell.php
        +Enable version update checks:         TRUE                         
        +Enable version update notifications:  TRUE                         
        +Version update notification email:    admin@fuck.com               
        +Version update source email:          admin@fuck.com               
   4) zimbra-mta:                              Enabled                      
   5) zimbra-snmp:                             Enabled                      
   6) zimbra-logger:                           Enabled                      
   7) zimbra-spell:                            Enabled                      
   8) zimbra-proxy:                            Enabled                      
   9) Default Class of Service Configuration:                               
   r) Start servers after configuration        yes                          
   s) Save config to file                                                   
   x) Expand menu                                                           
   q) Quit                                   
Address unconfigured (**) items  (? - help) 3 //选择第3项目修改管理员密码
Store configuration
   1) Status:                                  Enabled                      
   2) Create Admin User:                       yes                          
   3) Admin user to create:                    admin@fuck.com               
** 4) Admin Password                           UNSET                        
   5) Anti-virus quarantine user:              virus-quarantine.4pxgnng5@fuck.com
   6) Enable automated spam training:          yes                          
   7) Spam training user:                      spam.dopagkpx@fuck.com       
   8) Non-spam(Ham) training user:             ham.t0plz98s@fuck.com        
   9) SMTP host:                               mail.fuck.com                
  10) Web server HTTP port:                    80                           
  11) Web server HTTPS port:                   443                          
  12) Web server mode:                         https                        
  13) IMAP server port:                        7143                         
  14) IMAP server SSL port:                    7993                         
  15) POP server port:                         7110                         
  16) POP server SSL port:                     7995                         
  17) Use spell check server:                  yes                          
  18) Spell server URL:                        http://mail.fuck.com:7780/aspell.php
  19) Enable version update checks:            TRUE                         
  20) Enable version update notifications:     TRUE                         
  21) Version update notification email:       admin@fuck.com               
  22) Version update source email:             admin@fuck.com               
Select, or 'r' for previous menu [r] 4
Password for admin@fuck.com (min 6 characters): [JAZg1aAZu] 1234567 //更改管理员密码
Store configuration
   1) Status:                                  Enabled                      
   2) Create Admin User:                       yes                          
   3) Admin user to create:                    admin@fuck.com               
   4) Admin Password                           set                          
   5) Anti-virus quarantine user:              virus-quarantine.4pxgnng5@fuck.com
   6) Enable automated spam training:          yes                          
   7) Spam training user:                      spam.dopagkpx@fuck.com       
   8) Non-spam(Ham) training user:             ham.t0plz98s@fuck.com        
   9) SMTP host:                               mail.fuck.com                
  10) Web server HTTP port:                    80                           
  11) Web server HTTPS port:                   443                          
  12) Web server mode:                         https                        
  13) IMAP server port:                        7143                         
  14) IMAP server SSL port:                    7993                         
  15) POP server port:                         7110                         
  16) POP server SSL port:                     7995                         
  17) Use spell check server:                  yes                          
  18) Spell server URL:                        http://mail.fuck.com:7780/aspell.php
  19) Enable version update checks:            TRUE                         
  20) Enable version update notifications:     TRUE                         
  21) Version update notification email:       admin@fuck.com               
  22) Version update source email:             admin@fuck.com               
Select, or 'r' for previous menu [r] r  //返回菜单
Main menu
   1) Common Configuration:                                                 
   2) zimbra-ldap:                             Enabled                      
   3) zimbra-store:                            Enabled                      
   4) zimbra-mta:                              Enabled                      
   5) zimbra-snmp:                             Enabled                      
   6) zimbra-logger:                           Enabled                      
   7) zimbra-spell:                            Enabled                      
   8) zimbra-proxy:                            Enabled                      
   9) Default Class of Service Configuration:                               
   r) Start servers after configuration        yes                          
   s) Save config to file                                                   
   x) Expand menu                                                           
   q) Quit                                   
*** CONFIGURATION COMPLETE - press 'a' to apply
Select from menu, or press 'a' to apply config (? - help) a //保存配置
Save configuration data to a file? [Yes] y
Save config in file: [/opt/zimbra/config.13069]
Saving config in /opt/zimbra/config.13069...done.
The system will be modified - continue? [No] y
Operations logged to /tmp/zmsetup.12122013-130057.log
Setting local config values...done.
Initializing core config...Setting up CA...done.
Deploying CA to /opt/zimbra/conf/ca ...done.
Creating SSL zimbra-store certificate...done.
Creating new zimbra-ldap SSL certificate...done.
Creating new zimbra-mta SSL certificate...done.
Creating new zimbra-proxy SSL certificate...done.
Installing mailboxd SSL certificates...done.
Installing MTA SSL certificates...done.
Installing LDAP SSL certificate...done.
Installing Proxy SSL certificate...done.
Initializing ldap...done.
Setting replication password...done.
Setting Postfix password...done.
Setting amavis password...done.
Setting nginx password...done.
Creating server entry for mail.fuck.com...done.
Setting Zimbra IP Mode...done.
Saving CA in ldap ...done.
Saving SSL Certificate in ldap ...done.
Setting spell check URL...done.
Setting service ports on mail.fuck.com...done.
Adding mail.fuck.com to zimbraMailHostPool in default COS...done.
Setting zimbraFeatureTasksEnabled=TRUE...done.
Setting zimbraFeatureBriefcasesEnabled=FALSE...done.
Setting MTA auth host...done.
Setting TimeZone Preference...done.
Initializing mta config...done.
Setting services on mail.fuck.com...done.
Creating domain fuck.com...done.
Setting default domain name...done.
Creating domain fuck.com...already exists.
Creating admin account admin@fuck.com...done.
Creating root alias...done.
Creating postmaster alias...done.
Creating user spam.dopagkpx@fuck.com...done.
Creating user ham.t0plz98s@fuck.com...done.
Creating user virus-quarantine.4pxgnng5@fuck.com...done.
Setting spam training and Anti-virus quarantine accounts...done.
Initializing store sql database...done.
Setting zimbraSmtpHostname for mail.fuck.com...done.
Configuring SNMP...done.
Setting up syslog.conf...done.
Starting servers...done.
Installing common zimlets...
        com_zimbra_adminversioncheck...done.
        com_zimbra_attachmail...done.
        com_zimbra_viewmail...done.
        com_zimbra_tooltip...done.
        com_zimbra_phone...done.
        com_zimbra_clientuploader...done.
        com_zimbra_cert_manager...done.
        com_zimbra_bulkprovision...done.
        com_zimbra_srchhighlighter...done.
        com_zimbra_date...done.
        com_zimbra_attachcontacts...done.
        com_zimbra_email...done.
        com_zimbra_proxy_config...done.
        com_zimbra_url...done.
        com_zimbra_webex...done.
        com_zimbra_ymemoticons...done.
Finished installing common zimlets.
Restarting mailboxd...done.
Creating galsync account for default domain...done.
You have the option of notifying Zimbra of your installation.
This helps us to track the uptake of the Zimbra Collaboration Server.
The only information that will be transmitted is:
        The VERSION of zcs installed (8.0.5_GA_5839_RHEL6_64)
        The ADMIN EMAIL ADDRESS created (admin@fuck.com)
Notify Zimbra of your installation? [Yes] y
Notifying Zimbra of installation via http://www.zimbra.com/cgi-bin/notify.cgi?VER=8.0.5_GA_5839_RHEL6_64&MAIL=admin@fuck.com
ERROR: Notification failed
Setting up zimbra crontab...done.
Moving /tmp/zmsetup.12122013-130057.log to /opt/zimbra/log
Configuration complete - press return to exit //按回车退出
[root@mail zcs-8.0.5_GA_5839.RHEL6_64.20130910123908]#



至此安装完成,下面我们启动zimbar


[root@mail /]# su zimbra
[zimbra@mail /]$ zmcontrol start
Host mail.fuck.com
        Starting zmconfigd...Done.
        Starting logger...Done.
        Starting mailbox...Done.
        Starting memcached...Done.
        Starting proxy...Done.
        Starting antispam...Done.
        Starting antivirus...Done.
        Starting opendkim...Done.
        Starting snmp...Done.
        Starting spell...Done.
        Starting mta...Done.
        Starting stats...Done.


如果没有发生错误证明启动成功 我们可以看一下各个服务器的状态


[zimbra@mail /]$ zmcontrol status
Host mail.fuck.com
        antispam                Running
        antivirus               Running
        ldap                    Running
        logger                  Running
        mailbox                 Running
        memcached               Running
        mta                     Running
        opendkim                Running
        proxy                   Running
        snmp                    Running
        spell                   Running
        stats                   Running
        zmconfigd               Running
[zimbra@mail /]$

可以看到全部服务都应成功启动并运行

下面我就可以通过浏览器进入管理

https://mail.fuck.com //进入邮箱

https://mail.fuck.com:7071 //进入管理页面 管理账号是admin@fuck.com 密码我们刚才安装的时候设置的1234567


剩下的大家自己研究了


下面是一些常见的zimbra使用命令

重置管理员密码 as zimbra

zmprov sp admin@xxx.com newpassword


修改管理端口后台 as zimbra

zmprov ms mail.xxx.com zimbraAdminPort 8888
zmlocalconfig -e zimbra_admin_service_port=8888


然后重启zimbra服务 as zimbra

zmcontrol restart


列出所有管理员 as zimbra

zmprov gaaa


更改系统最大邮件大小:查看最大系统邮件大小 as zimbra

postconf message_size_limit //查看
zmprov modifyConfig zimbraMtaMaxMessageSize 20480000 //更改


更改系统最大附件大小:将系统中所有帐户允许最大的附件更改为5M as zimbra

zmprov modifyConfig zimbraFileUploadMaxSize 5000000


将系统中mail.domain.com帐户允许最大的附件更改为20M as zimbra

zmprov modifyServer mail.domain.com zimbraFileUploadMaxSize 200000

更改LDAP root和zimbra 密码as zimbra

/opt/zimbra/bin/zmldappasswd -r  newpass
/opt/zimbra/bin/zmldappasswd newpass


更改MYSQL密码 as zimbra

zmmypasswd --root newrootpass
zmmypasswd zimbrapass


新建一个组 as zimbra

zmprov cdl group@fuck.com

给组增加一个成员  as zimbra

zmprov adlm group@fuck.com admin@fuck.com

新建一个用户  as zimbra

zmprov ca user@fuck.com passwd

给一个用户设置别名  as zimbra

zmprov aaa user@fuck.com  sr@fuck.com




批量新建用户 as root

新建两个文件 createuser user

user文件内容如下

#用户名 别名

guojing gj

huangrong hr

xialongnv xlv

........

createuser文件内容如下 运行后生成的用户名和密码对应文件在当前目录下 username.txt


#!/bin/bash
function randnum()
{
    di=(0 1 2 3 4 5 6 7 8 9 \
        a b c d e f g h i j k l m n o p q r s t u v w x y z \
        A B C D E F G H I G K L M N O P Q R S T U V W X Y Z)
    for((i=0;i<$1;i++))
    do
        num=$num`echo -n ${di[$RANDOM % ${#di[*]}]}`
    done
    echo $num
}
num=`cat user | wc -l`
i=1
for((i=1;i<=$num;i++));do
     pass=$(randnum 10)
     user=`cat user | sed -n ${i}p | awk '{print $1}'`
     aluser=`cat user | sed -n ${i}p | awk '{print $2}'`
     /opt/zimbra/bin/zmprov ca $user@fuck.com $pass
     /opt/zimbra/bin/zmprov aaa $user@fuck.com $aluser@fuck.com
     echo "UserName:"$user@fuck.com "Passwd:"$pass "AliasName:"$aluser@fuck.com
     echo "UserName:"$user@fuck.com "Passwd:"$pass "AliasName:"$aluser@fuck.com >> username.txt
done




关于备份和恢复请参考如下:

http://blog.sina.com.cn/s/blog_467b0fd50100sfrr.html

下面是具体步骤:

备份


1. 备份mailbox


su – zimbra


mkdir /opt/zimbra/backup/store


cp -r /opt/zimbra/store/* /opt/zimbra/backup/store/


2. 备份mysql

su - zimbra

/opt/zimbra/mysql/bin/mysqldump -uroot –p$mysql_pswd  --socket=/opt/zimbra/db/mysql.sock --all-databases  > /opt/zimbra/backup/dump.2011.sql


3. 备份ldap

su - zimbra

/opt/zimbra/libexec/zmslapcat /opt/zimbra/backup/


会在/opt/zimbra/backup/目录下生成 后面接日期的文件 ldap.bak..$data


恢复

1. 恢复 mailbox


su – zimbra

mkdir /opt/zimbra/backup/store.old

mv /opt/zimbra/store/* /opt/zimbra/backup/store.old/

cp -r /opt/zimbra/backup/store/* /opt/zimbra/store


2. 恢复 mysql


mysql -uroot -p$mysql_pswd < /opt/zimbra/backup/dump.2011.sql


3         恢复 ldap


mkdir /opt/zimbra/backup/ldap.db.old

mv /opt/zimbra/data/ldap/hdb/db/* /opt/zimbra/backup/ldap.db.old/


/opt/zimbra/openldap/sbin/slapadd -q -b "" -F /opt/zimbra/data/ldap/config -cv –l /opt/zimbra/backup/ ldap.bak..$data


重启zimbra:   zmcontrol restart