在CentOS 7上安装Zimbra Multi-Server

时间:2020-02-23 14:44:57  来源:igfitidea点击:

本教程是在CentOS中执行Zimbra Multi-Server安装。
Zimbra已被评为最佳的开源邮件协作套件。
它只可以与交换和其他商业电子邮件产品匹配。

单个服务器的安装Zimbra是一个简单的过程,但是要设置多服务器是一个包含许多活动部件的过程,需要按以下顺序执行。

1.安装LDAP服务器-多主复制(MMR)或复制
2.安装Zimbra邮箱服务器
3.安装MTA服务器
4.安装代理服务器

我的设置将具有以下服务器:

-2个LDAP服务器–具有多主复制(MMR)
-2个邮箱服务器
-2个MTA服务器
-2个代理服务器-具有keepalived和VIP

因此,此设置的服务器总数为7。主机名使用以下格式

-LDAP服务器– ldap-01.domain.com& ldap-02.domain.com
-邮箱服务器– mx-01.domain.com& mx-02.domain.com
-2台MTA服务器– mta-01.domain.com& mta-02.domain.com
-2台代理服务器– proxy-01.domain.com& proxy-02.domain.com。 mail.domain.com上的VIP

第1步:在所有服务器上安装CentOS 7

第一步是在所有目标服务器上安装CentOS 7并通过运行将包更新到最新版本:

# yum -y update

第2步:安装Zimbra准备工作包并设置主机名

安装Zimbra安装所需的所有包,并在所有服务器上设置主机名。
可以通过运行命令来安装这些包:

# yum -y install perl-core unzip libaio nmap-ncat sysstat openssh-clients

使用命令设置主机名:

# hostnamectl set-hostname <hostname>

例如

# hostnamectl set-hostname ldap-01.domain.com

步骤3:使用主机名和IP地址修改/etc/hosts

现在我们在每个服务器上设置了正确的主机名,请编辑主机文件以具有IP地址和主机名。
我们可以使用Echo命令:

# echo <IP Address> <Hostname> >> /etc/hosts

例如

# echo  192.168.1.20 mta-01.domain.com >> /etc/hosts

在所有的服务器上执行此操作

第4步:下载最新的Zimbra在所有服务器上发布

将Zimbra压缩包下载到每个服务器,然后提取它以使其准备好安装过程。
对于这个安装,我正在使用Zimbra 8.8

# wget https://files.zimbra.com/downloads/8.8.8_GA/zcs-8.8.8_GA_2009.RHEL7_64.20160322150747.tgz
# tar -xvf zcs-8.8.8_GA_2009.RHEL7_64.20160322150747.tgz

我喜欢保留文件和目录的全名,因为它在执行升级时稍后有助于。
如果下载相同版本的Zimbra,则应有一个名为zcs-8.8.8_ga_2009.rhel7_64.20160322150747 /。

第4步:安装Zimbra LDAP服务器1(LDAP-01.Domain.com)

我们将从LDAP服务器上首次安装Zimbra。
另一个LDAP服务器我们将为IT配置多主复制。

# cd zcs-8.8.8_GA_2009.RHEL7_64.20160322150747/

启动安装过程:

# ./install.sh

填写以下信息:

Do you agree with the terms of the software license agreement? [N] y       
Use Zimbra’s package repository [Y] y

Select the packages to install
Install zimbra-ldap [Y] y       

Install zimbra-logger [Y] n

Install zimbra-mta [Y] n

Install zimbra-dnscache [N] n

Install zimbra-snmp [Y] y

Install zimbra-store [Y] n

Install zimbra-apache [Y] n

Install zimbra-spell [Y] n

Install zimbra-memcached [Y] n

Install zimbra-proxy [Y] n

Install zimbra-chat [N] n

Install zimbra-drive [N] n
Checking required space for zimbra-core

Installing:
    zimbra-core
    zimbra-ldap
    zimbra-snmp

The system will be modified.  Continue? [N] Y

现在应该开始下载包。
我的配置如下:

Common configuration

   1) Hostname:                                ldap-01.domain.com
   2) Ldap master host:                        ldap-01.domain.com
   3) Ldap port:                               389                           
   4) Ldap Admin password:                     set                           
   5) Store ephemeral attributes outside Ldap: no                            
   6) Secure interprocess communications:      yes                           
   7) TimeZone:                                UTC                           
   8) IP Mode:                                 ipv4                          
   9) Default SSL digest:                      sha256 

Ldap configuration

   1) Status:                                  Enabled                       
   2) Create Domain:                           yes                           
   3) Domain to create:                        mail.domain.com
   4) Ldap root password:                      set                           
   5) Ldap replication password:               set                           
   6) Ldap postfix password:                   set                           
   7) Ldap amavis password:                    set                           
   8) Ldap nginx password:                     set                           
   9) Ldap Bes Searcher password:              set ″ message=

仔细检查LDAP主机主机,主机名和域的设置以创建。
一旦你相信设置,请按a启动安装和配置过程。

*** CONFIGURATION COMPLETE - press ’a’ to apply
Select from menu, or press ’a’ to apply config (? - help) a
Save configuration data to a file? [Yes] 
Save config in file: [/opt/zimbra/config.31786] 
Saving config in /opt/zimbra/config.31786…done.
The system will be modified - continue? [No] Yes

安装完成后,将为所有下一步骤中所需的密码凭据:

ldap_amavis_password = 4Y9WzugHAz
ldap_bes_searcher_password = 4Y9WzugHAz
ldap_nginx_password = 4Y9WzugHAz
ldap_postfix_password = 4Y9WzugHAz
ldap_replication_password = 4Y9WzugHAz
ldap_root_password = 4Y9WzugHAz
zimbra_ldap_password = 4Y9WzugHAz

步骤5:在LDAP-01服务器上启用LDAP MMR

由于我们将两个LDAP服务器设置为掌握,因此我们需要在我们刚刚安装的第一个主服务器上启用此功能。

在现有单节点主机上启用多主复制:

[root@ldap-01 ~]# su - zimbra
[zimbra@ldap-01 ~]$./libexec/zmldapenable-mmr -s 1 -m ldap://ldap-02.domain.com:389/
[zimbra@ldap-01 ~]$./libexec/zmldapenable-mmr -r 101 -m ldap://dap-02.domain.com:389/
[zimbra@ldap-01 ~]$/opt/zimbra/libexec/zmldapmmrtool -q
Master Server ID: 1
Master replication agreement: 1
rid: 100 URI: ldap://ldap-02.domain.com:389/TLS: critical
Master replication agreement: 2
rid: 101 URI: ldap://ldap-02.domain.com:389/TLS: critical
[zimbra@ldap-01 ~]$″ message=

在LDAP服务器2上,将Zimbra安装在一起,但其配置应如下所示:

Common configuration

   1) Hostname:                                ldap-02.domain.com
   2) Ldap master host:                        ldap-01.domain.com
   3) Ldap port:                               389                           
   4) Ldap Admin password:                     set                           
   5) Store ephemeral attributes outside Ldap: no                            
   6) Secure interprocess communications:      yes                           
   7) TimeZone:                                UTC                           
   8) IP Mode:                                 ipv4                          
   9) Default SSL digest:                      sha256 


Ldap configuration

   1) Status:                                  Enabled                       
   2) Create Domain:                           yes                           
   3) Domain to create:                        mail.domain.com
   4) Ldap replication type:                   mmr                           
   5) Ldap Server ID:                          2                             
   6) Ldap root password:                      set                           
   7) Ldap replication password:               set                           
   8) Ldap postfix password:                   set                           
   9) Ldap amavis password:                    set                           
  10) Ldap nginx password:                     set                           
  11) Ldap Bes Searcher password:              set  ″ message=

应配置以下内容:LDAP管理员PasswordLDAP复制PasswordLDAP复制类型:MMRALL其他密码

有关如何获取所需的所有密码,请参阅第4步。

第6步:安装Zimbra邮箱服务器

现在通过运行安装程序安装两个邮箱服务器。

# ./install.sh

安装的包是:

Do you agree with the terms of the software license agreement? [N] y       
Use Zimbra’s package repository [Y] y

Select the packages to install
Install zimbra-ldap [Y] n      

Install zimbra-logger [Y] y

Install zimbra-mta [Y] n

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] n

Install zimbra-proxy [Y] n

Install zimbra-chat [N] n

Install zimbra-drive [N] n
Install zimbra-imapd (BETA - for evaluation only) [N] n
Checking required space for zimbra-core

Installing:
    zimbra-core
    zimbra-logger
    zimbra-snmp
    zimbra-store
    zimbra-apache
    zimbra-spell
    zimbra-convertd
    zimbra-archiving
    zimbra-drive

The system will be modified.  Continue? [N] Y

请注意,我们需要仅在一个服务器上安装记录器。
对我来说,记录器安装在MX-01上。
配置如下所示:

Common configuration

   1) Hostname:                                mx-01.domain.com
   2) Ldap master host:                        ldap-01.domain.com
   3) Ldap port:                               389                           
   4) Ldap Admin password:                     set                           
   5) LDAP Base DN:                            cn=zimbra                     
   6) Store ephemeral attributes outside Ldap: yes                           
   7) Value for zimbraEphemeralBackendURL:     ldap://default                
   8) Secure interprocess communications:      yes                           
   9) TimeZone:                                UTC                           
  10) IP Mode:                                 ipv4                          
  11) Default SSL digest:                      sha256 ″ message=

在"公共配置",SET:hostname:mx-01.domain.comLDAP主机主机:LDAP-01.Domain.comLDAP管理员密码:

在Zimbra-Store下,确保配置了以下项目:管理员密码:SMTP主机:配置使用邮件代理:用于Web Proxy的TrueConfigure:TrueInstall UI(Zimbra,Zimbraadmin WebApps):Yesinstall MailStore(服务WebApp):是

我们可以修改所需的任何其他设置并启动安装过程。
对于其他邮箱服务器,重复相同的步骤但不安装记录器,它将在MX-01上运行。

第7步:安装Zimbra MTA服务器

下一阶段是安装MTA服务器。
软件包选择应如下:

Select the packages to install

Install zimbra-ldap [Y] n
Install zimbra-logger [Y] n
Install zimbra-mta [Y] y
Install zimbra-dnscache [Y] y
Install zimbra-snmp [Y] y
Install zimbra-store [Y] n
Install zimbra-apache [Y] n
Install zimbra-spell [Y] n
Install zimbra-memcached [Y] n
Install zimbra-proxy [Y] n
Install zimbra-chat [N] n
Install zimbra-drive [N] n

Checking required space for zimbra-core

Installing:
    zimbra-core
    zimbra-mta
    zimbra-snmp
    zimbra-dnscache

The system will be modified.  Continue? [N] y

在"配置"窗口中,确保设置以下内容:

1)常见配置,设置:hostname:LDAP主机主机:LDAP管理员密码:

1) Hostname:                                mta-01.domain.com
   2) Ldap master host:                        ldap-01.domain.com
   3) Ldap port:                               389                           
   4) Ldap Admin password:                     set                           
   5) LDAP Base DN:                            cn=zimbra                     
   6) Store ephemeral attributes outside Ldap: yes                           
   7) Value for zimbraEphemeralBackendURL:     ldap://default                
   8) Secure interprocess communications:      yes                           
   9) TimeZone:                                UTC                           
  10) IP Mode:                                 ipv4                          
  11) Default SSL digest:                      sha256  ″ message=

2)Postfix LDAP用户的Zimbra-MTA SetBind密码:Amavis LDAP用户的绑定密码:

看看第4步,了解如何获得它们。

Mta configuration

   1) Status:                                  Enabled                       
   2) Enable Spamassassin:                     yes                           
   3) Enable Clam AV:                          yes                           
   4) Enable OpenDKIM:                         yes                           
   5) Notification address for AV alerts:      [email protected]
   6) Bind password for postfix ldap user:     set                           
   7) Bind password for amavis ldap user:      set ″ message=

在Zimbra-dnscache下,配置由空间分隔的主DNS IP地址:

DNS Cache configuration

   1) Status:                                  Enabled                       
   2) Master DNS IP address(es):               8.8.4.4 1.1.1.1  8.8.8.8 
   3) Enable DNS lookups over TCP:             yes                           
   4) Enable DNS lookups over UDP:             yes                           
   5) Only allow TCP to communicate with Master DNS: no ″ message=

完成后,保存设置并执行A开始Zimbra MTA设置。

第7步:安装Zimbra Proxy Server(s)

对于安装Zimbra Proxy Server(S),我们需要在安装期间选择以下软件包:

Select the packages to install

Install zimbra-ldap [Y] n

Install zimbra-logger [Y] n

Install zimbra-mta [Y] n

Install zimbra-dnscache [N] n

Install zimbra-snmp [Y] y

Install zimbra-store [Y] n

Install zimbra-apache [Y] n

Install zimbra-spell [Y] n

Install zimbra-memcached [Y] y

Install zimbra-proxy [Y] y

Install zimbra-chat [N] n

Install zimbra-drive [N] n
Checking required space for zimbra-core

Installing:
    zimbra-core
    zimbra-snmp
    zimbra-memcached
    zimbra-proxy

The system will be modified.  Continue? [N] y

填写所有必填信息:

Common configuration

   1) Hostname:                                proxy-01.domain.com
   2) Ldap master host:                        ldap-01.domain.com
   3) Ldap port:                               389                           
   4) Ldap Admin password:                     set                           
   5) LDAP Base DN:                            cn=zimbra                     
   6) Store ephemeral attributes outside Ldap: yes                           
   7) Value for zimbraEphemeralBackendURL:     ldap://default                
   8) Secure interprocess communications:      yes                           
   9) TimeZone:                                UTC                           
  10) IP Mode:                                 ipv4                          
  11) Default SSL digest:                      sha256  

Proxy configuration

   1) Status:                                  Enabled                       
   2) Enable POP/IMAP Proxy:                   TRUE                          
   3) Enable strict server name enforcement?   TRUE                          
   4) IMAP server port:                        7143                          
   5) IMAP server SSL port:                    7993                          
   6) IMAP proxy port:                         143                           
   7) IMAP SSL proxy port:                     993                           
   8) POP server port:                         7110                          
   9) POP server SSL port:                     7995                          
  10) POP proxy port:                          110                           
  11) POP SSL proxy port:                      995                           
  12) Bind password for nginx ldap user:       set                           
  13) Enable HTTP[S] Proxy:                    TRUE                          
  14) Web server HTTP port:                    8080                          
  15) Web server HTTPS port:                   8443                          
  16) HTTP proxy port:                         80                            
  17) HTTPS proxy port:                        443                           
  18) Proxy server mode:                       redirect ″ message=

对于代理服务器模式,我们可以根据要求选择HTTP,HTTPS,两者,重定向或者混合。
在我的情况下,我正在使用重定向。

一旦安装了所有Zimbra代理服务器,通过在代理服务器上运行以下命令,在端口9071上启用代理控制台作为Zimbra用户:

# su - zimbra
$/opt/zimbra/libexec/zmproxyconfig -e -w -C -H `zmhostname`

这将在Proxy Server上启用管理控制台代理端口9071.肯定邮箱服务器的管理控制台在端口7071(默认)上配置。

进行更改后,我们需要重新启动代理服务:

$zmproxyctl restart

该服务应绑定到端口9071,可以使用SS命令确认:

$ss -tunelp | grep 9071

要通过代理访问管理控制台,URL应该是https://proxy-0x.domain.com:9071/

第8步:配置Zimbra Logger服务

如前所述,我们的记录器服务将在邮箱服务器1上运行(mx -01.domain.com)。
为此,我们需要首先在此服务器上安装和配置rsyslog服务。

取消注释/etc/rsyslog.conf上的以下行

$ModLoad imudp
$UDPServerRun 514

此外,$udpserverrun 514后添加此行:

SYSLOGD_options="-r -m 0"

然后设置Zimbra Syslog并重新启动rsyslog服务:

# /opt/zimbra/libexec/zmfixperms -e -v
# /opt/zimbra/libexec/zmsyslogsetup

updateSyslog: Updating /etc/rsyslog.conf…done.
# systemctl restart rsyslog.service
# su - zimbra
$/opt/zimbra/libexec/zmloggerinit

Stopping logswatch…done.
Starting logswatch…done.
$/opt/zimbra/bin/zmupdateauthkeys

使用下面的命令验证LogHostName。
(它应该设置为所有服务器上的记录器监视器主机的名称)

# su - zimbra
$zmprov gacf | grep zimbraLogHostname
zimbraLogHostname: mx-01.domain.com

如果它不同,请使用以下命令更改与记录器监视器主机相同。

$zmprov mcf zimbraLogHostname <Logger monitor Hostname>

配置每个Zimbra Server以登录新设置记录器服务器。

# /opt/zimbra/libexec/zmfixperms -e -v
# su - zimbra
$/opt/zimbra/bin/zmupdateauthkeys ; exit
# /opt/zimbra/libexec/zmsyslogsetup
# systemctl restart rsyslog
# su - zimbra -c "zmcontrol restart"

第9步:使用Keepalived配置Zimbra Proxy HA

由于我们有两个Zimbra Proxy服务器,我们需要确保我们为代理服务器提供了HA。
我的代理设置是:2代理服务器 - Proxy-01.domain.com&proxy-02.domain.combope将使用mail.domain.com提供服务

目标解决方案图是

简而言之,这就是它的工作原理:代理主站作为VIP代理主站成为UnavailableThe VIP将传递给将处理该服务的备份服务器

我将把Proxy-01配置为Master和Proxy-02作为备份服务器。

在两个服务器上安装Leepalive。

# yum -y install keepalived

在主服务器上配置Keepalive(Proxy-01)

# cat /etc/keepalived/keepalived.conf
vrrp_script chk_zimbra_nginx {
  script "killall -0 nginx" # check the zimbra nginx process  interval 2 # every 2 seconds
  weight 2 # add 2 points if OK}vrrp_instance VI_1 {
  interface eth0 # interface to monitor
  state MASTER # MASTER on proxy-01, BACKUP on proxy-02
  virtual_router_id 51
  priority 101 # 101 on proxy-01, 100 on proxy-02
  virtual_ipaddress {
   192.168.1.23/24
  }
  track_script {
    chk_zimbra_nginx
  }
}

在备份服务器上配置Keepalive(Proxy-01)

# cat /etc/keepalived/keepalived.conf
vrrp_script chk_zimbra_nginx {
  script "killall -0 nginx" # check the zimbra nginx process
  interval 2 # every 2 seconds
  weight 2 # add 2 points if OK
}

vrrp_instance VI_1 {
  interface eth0 # interface to monitor
  state BACKUP # MASTER on proxy-01, BACKUP on proxy-02
  virtual_router_id 51
  priority 100 # 101 on proxy-01, 100 on proxy-02
  virtual_ipaddress {
    192.168.1.23/24
  }
  track_script {
    chk_zimbra_nginx
  }
}

启用IP转发和配置防火墙:

Keepalived需要配置IP转发,并为VRRP数据包添加了一些防火墙规则。

启用IP转发:

# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
# sysctl -p
net.ipv4.ip_forward = 1

添加防火墙规则以允许使用多播IP地址224.0.0.18和vrrp协议(112)在Keepperation的每个网络接口上使用VRRP通信,例如:

# firewall-cmd –direct –permanent –add-rule ipv4 filter INPUT 0 \ 
–in-interface eth0 –destination 224.0.0.18 –protocol vrrp -j ACCEPT 
# firewall-cmd –direct –permanent –add-rule ipv4 filter OUTPUT 0 \ 
–out-interface eth0 –destination 224.0.0.18 –protocol vrrp -j ACCEPT 
# firewall-cmd –reload

启用并启动每个服务器上的keepalived服务:

# systemctl enable keepalived
# systemctl start keepalived

如果更改Keepalived配置,请重新加载Keepalive Service:

# systemctl reload keepalived

我们可以通过在主服务器上杀死nginx进程来测试Keepalived功能,并查看虚拟IP是否将切换到备份服务器:

# killall nginx
# ip add > Run on Backup server to check IP address configuration

第10步:重置管理员密码和访问Web UI

重置管理员密码:

# su - zimbra
$zmprov sp Hyman@theitroad strongpassword

通过直接访问代理服务器或者指向代理服务器的主机名访问Web UI。
管理仪表板可从端口9071访问。

我们可以使用以下内容为代理服务器配置防火墙规则

firewall-cmd --add-service={http,https,smtp,smtps,imap,imaps,pop3,pop3s} --permanent
firewall-cmd --add-port=11211/tcp --permanent
firewall-cmd --add-port=9071/tcp --permanent
firewall-cmd --reload

要从特定IP地址限制访问或者管理界面,请使用Firewalld Rich Rules:

firewall-cmd --permanent --add-rich-rule="rule family=ipv4 source address=source-ip-address/32 \
destination address=dest-ip-address/32 port port=9071 protocol=tcp accept"