美文网首页程序员
企业邮箱 Zimbra 的搭建

企业邮箱 Zimbra 的搭建

作者: Sunsol | 来源:发表于2017-07-06 19:13 被阅读0次

    Zimbra

    Zimbra 是一家提供专业的电子邮件软件开发供应商,主要提供ZimbraDesktop邮件管理软件。另外提供一套开源协同办公套件包括WebMail,日历,通信录,Web文档管理和创作。他的最大特色在于其采用Ajax技术模仿CS桌面应用软件的风格开发的客户端兼容Firefox,Safari和IE浏览器。

    如何在Ubuntu 14.04服务器上安装Zimbra8.6

    配置

    • Ubuntu14.04-64位
    • root权限
    • 磁盘剩余空间25G
    • RAM 4G

    实现步骤

    • 安装辅助包
    • 配置hostname和DNS服务器
    • 下载和安装Zimbra
    • 测试安装

    安装辅助包

    链接服务器,并执行以下命令来安装相应的包

    apt-get install libgmp10 libperl5.18 unzip pax sysstat sqlite3 dnsmasq wget
    

    配置hostname和DNS服务器

    第一步 编辑hostname和hosts文件

    vim /etc/hostname
    更改hostname为自己的域名,例如mail.test.com

    mail.test.com
    

    vim /etc/hosts
    在此文件中添加这行代码

    192.168.1.101   mail.test.com   mail
    
    第二步 编辑dnsmasq的配置

    vim /etc/dnsmasq.conf

    server=192.168.1.101
    domain=test.com
    mx-host=test.com, mail.test.com, 5
    mx-host=mail.test.com, mail.test.com, 5
    listen-address=127.0.0.1
    
    Reboot

    执行如下命令

    sudo reboot
    

    安装Zimbra

    第一步 下载并解压文件

    执行如下命令来下载文件

    wget https://files.zimbra.com/downloads/8.6.0_GA/zcs-8.6.0_GA_1153.UBUNTU14_64.20141215151116.tgz
    

    执行如下命令来解压文件

    tar -xvf zcs-8.6.0_GA_1153.UBUNTU14_64.20141215151116.tgz
    

    然后进入此文件

    第二步 安装

    执行以下文件来安装

    sudo ./install.sh
    

    在这个过这个过程中会出现这样的选择

    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
    
    

    输入“y”,然后继续
    遇到以下情况应该这样选择

    Select the packages to install
    
    Install zimbra-ldap [Y] y
    
    Install zimbra-logger [Y] y
    
    Install zimbra-mta [Y] y
    
    Install zimbra-dnscache [N] n
    
    Install zimbra-snmp [Y] y
    
    Install zimbra-store [Y] y
    
    Install zimbra-apache [Y] y
    
    Install zimbra-spell [Y] y
    
    Install zimbra-memcached [Y] y
    
    Install zimbra-proxy [Y] y
    

    这里不需要zimbra-dnscache,因为我们上边使用的是dnsmasq,所以不需要此包
    你需要等一会,因为安装这些包是需要一些时间的

    注意:
    在选中 zimbra-mta 过程中可能会出现如下错误:(阿里云服务器默认安装了mta框架,所以在此发生了冲突)

    Install zimbra-mta [Y] y
         Conflicting package: lsb-invalid-mta
    
    ###ERROR###
    
    One or more package conflicts exists.
    Please remove them before running this installer.
    
    Installation cancelled.
    

    这个时候需要用以下代码把mta给删掉

    apt-get remove lsb-invalid-mta
    

    下一步是配置Zimbra-store的管理员账号密码,看如下代码:

    Main menu
    
       1) Common Configuration:                                                  
       2) zimbra-ldap:                             Enabled                       
       3) zimbra-logger:                           Enabled                       
       4) zimbra-snmp:                             Enabled           
       5) zimbra-mta:                              Enabled            
       6) zimbra-store:                            Enabled                       
            +Create Admin User:                    yes                           
            +Admin user to create:                 admin@mail.test.local     
    ******* +Admin Password                        UNSET                         
            +Anti-virus quarantine user:           virus-quarantine.fhvpv9tjf@mail.test.local
            +Enable automated spam training:       yes                           
            +Spam training user:                   spam._ypbujdq@mail.test.local
            +Non-spam(Ham) training user:          ham.7ko3y15ga@mail.test.local
            +SMTP host:                            mail.test.com                         
            +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.test.local:7780/aspell.php
            +Enable version update checks:         TRUE                          
            +Enable version update notifications:  TRUE                          
            +Version update notification email:    admin@mail.test.local     
            +Version update source email:          admin@mail.test.local     
            +Install mailstore (service webapp):   yes                           
            +Install UI (zimbra,zimbraAdmin webapps): yes                           
    
       6) zimbra-spell:                            Enabled                       
       7) zimbra-proxy:                            Enabled                       
       8) Default Class of Service Configuration:                                
       s) Save config to file                                                    
       x) Expand menu                                                            
       q) Quit                                    
    
    Address unconfigured (**) items  (? - help) 6
    

    选择“6”,然后会出现

    Store configuration
    
       1) Status:                                  Enabled                       
       2) Create Admin User:                       yes                           
       3) Admin user to create:                    admin@mail.test.local     
    ** 4) Admin Password                           UNSET                         
       5) Anti-virus quarantine user:              virus-quarantine.fhvpv9tjf@mail.test.local
       6) Enable automated spam training:          yes                           
       7) Spam training user:                      spam._ypbujdq@mail.test.local
       8) Non-spam(Ham) training user:             ham.7ko3y15ga@mail.test.local
       9) SMTP host:                               mail.test.com                         
      10) Web server HTTP port:                    8080                          
      11) Web server HTTPS port:                   8443                          
      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.test.local:7780/aspell.php
      19) Enable version update checks:            TRUE                          
      20) Enable version update notifications:     TRUE                          
      21) Version update notification email:       admin@mail.test.local     
      22) Version update source email:             admin@mail.test.local     
      23) Install mailstore (service webapp):      yes                           
      24) Install UI (zimbra,zimbraAdmin webapps): yes 
      
    Select, or 'r' for previous menu [r] 4
    

    选择“4”,然后输入密码即可,之后的操作如下:

    Main menu
    
       1) Common Configuration:                                                  
       2) zimbra-ldap:                             Enabled                       
       3) zimbra-logger:                           Enabled                       
       4) zimbra-snmp:                             Enabled                       
       5) zimbra-store:                            Enabled                       
       6) zimbra-spell:                            Enabled                       
       7) zimbra-proxy:                            Enabled                       
       8) Default Class of Service Configuration:                                
       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] yes
    Save config in file: [/opt/zimbra/config.11647] 
    Saving config in /opt/zimbra/config.11647...done.
    The system will be modified - continue? [No] yes
    

    最后,你需要等待Zimbra配置完成。

    测试Zimbra

    启动Zimbra服务器,使用下面的命令

    su - zmcontrol status
    

    最后再浏览器中打开https://192.168.1.101/即可

    To figure out if all services are running please type:
    
    zmcontrol status
    
    That will give you the following output:
    
    root@zim:~# /opt/zimbra/bin/zmcontrol status
    Run as the zimbra user!
    
    Right, you can’t run Zimbra commands as the root user! Ok!
    
    su – zimbra
    
    Then try the command again.
    

    参考文件:
    http://www.tuicool.com/articles/jQjeYzu
    https://www.linode.com/docs/email/zimbra/zimbra-on-ubuntu-14-04

    其他:
    修改管理员密码

    zmprov sp admin@mail.test.com test123
    

    Zimbra的使用

    添加域别名

    正常设置好域名比如:mail.test.com 在用户登录的时候只用使用xxx@mail.test.com,但是设置了域别名为:idol.com之后,用户就可以使用xxx@idol.com了,这样就去掉了很low的mail的二级域名了。
    但是外网给这些邮件的时候就需要带上mail,xxx@mail.idol.com

    使用MX域名解析

    具体实现需要登录万网来设置域名,如下图


    Alt text

    这个时候在命令行中使用nslookup命令,步骤如下

    root@mail:/opt/zimbra/postfix/conf# nslookup
    > set type=mx
    > test.com
    

    点击Enter,你会看到一下内容

    Server:     10.143.22.116
    Address:    10.143.22.116#53
    
    Non-authoritative answer:
    test.com   mail exchanger = 1 mail.test.com.
    
    Authoritative answers can be found from:
    test.com   nameserver = vip1.alidns.com.
    test.com   nameserver = vip2.alidns.com.
    mail.test.com  internet address = 123.57.211.167
    vip1.alidns.com internet address = 47.88.44.151
    vip1.alidns.com internet address = 47.88.44.153
    vip1.alidns.com internet address = 116.211.173.151
    vip1.alidns.com internet address = 116.211.173.153
    vip1.alidns.com internet address = 121.29.51.151
    vip1.alidns.com internet address = 121.29.51.153
    vip1.alidns.com internet address = 140.205.81.51
    vip1.alidns.com internet address = 140.205.81.53
    vip1.alidns.com internet address = 140.205.228.51
    vip1.alidns.com internet address = 140.205.228.53
    vip1.alidns.com internet address = 14.1.112.11
    vip1.alidns.com internet address = 14.1.112.13
    vip2.alidns.com internet address = 47.88.44.154
    vip2.alidns.com internet address = 116.211.173.152
    vip2.alidns.com internet address = 116.211.173.154
    vip2.alidns.com internet address = 121.29.51.152
    vip2.alidns.com internet address = 121.29.51.154
    vip2.alidns.com internet address = 140.205.81.52
    vip2.alidns.com internet address = 140.205.81.54
    vip2.alidns.com internet address = 140.205.228.52
    vip2.alidns.com internet address = 140.205.228.54
    vip2.alidns.com internet address = 14.1.112.12
    vip2.alidns.com internet address = 14.1.112.14
    vip2.alidns.com internet address = 47.88.44.152
    

    此内容说明配置成功
    但这个时候别不代表去掉mail成功,如果你给hyg@test.com发送邮件的会不成功,但给hyg@mail.test.com是成功的,这个时候请查看/var/log/zimbra.log文件,你会发现一下错误

    Jun 15 19:30:47 mail postfix/smtpd[17496]: NOQUEUE: reject: RCPT from m13-153.163.com[220.181.13.153]: 554 5.7.1 <hyg@test.com>: Relay access denied; from=<guang_hy@163.com> to=<hyg@test.com> proto=ESMTP helo=<m13-153.163.com>
    

    错误解析:收件服务器(Zimbra服务器)拒绝接收,Relay access denied的意思是:转发通道被拒绝(自己理解翻译的),我遇到的问题是外网邮箱给Zimbra邮箱服务器发送邮件的时候,使用hyg@test.com的邮箱账号,经过MX的指向 ,邮件发给了Zimbra服务器,但是Zimbra服务器不能验证hyg@test.com邮箱,所以发生了Relay access denied的错误
    解决方案:需要设置对应的别域名来配合MX使用,这样才能去掉很low的mail二级域名

    参考的文档:https://bobcares.com/blog/how-to-resolve-and-prevent-554-5-7-1-relay-access-denied-email-errors-in-parallels-plesk-linux-web-hosting-servers/2/

    相关文章

      网友评论

        本文标题:企业邮箱 Zimbra 的搭建

        本文链接:https://www.haomeiwen.com/subject/fwhkhxtx.html