CentOS7安装Zimbra邮件服务器

## 配置DNS
1. 以autumn.info域名为例,将域名本身autumn.info以A记录解析到任意IP, 然后将邮件服务器的hostname, 比如mx.autumn.info以A记录解析到我们将要搭建的邮件服务器的IP上。
2. 将autumn.info与mx.autumn.info以MX记录解析到mx.autumn.info,优先级可以为任意值。
3. 如果需要用web访问邮箱,可以将mail.autumn.info解析到邮件服务器的IP上。其他记录的设置,比如TXT, SRV等,可以后期根据自己的需要来自行配制。
![](https://img2020.cnblogs.com/blog/1208477/202008/1208477-20200803151320006-338579016.png)

## 修改Hostname
对于任何邮件服务器来说,最重要的前提步骤是正确设置服务器的hostname. 以mail.autumn.info为例,当在SSH中执行hostname命令时,应当看到的回显为短主机名,即mail;而在SSH中执行hostname -f命令时,应当看到的回显为长主机名(FQDN), 即mail.autumn.info. 若hostname没有正确设置好,请不要继续。
“`bash
echo ‘mail.52zt.info’ > /etc/hostname
“`
重启后用hostname查看,如果不一致可以用hostnamectl set-hostname 设置。
如果还不一致需要设置/etc/sysconfig/network
“`bash
vi /etc/sysconfig/network
“`
### 修改hosts
IP用内网IP,这里一定要加,否则Zimbra执行时会报错
“`bash
echo “192.168.0.4 mail.52zt.info mail” >> /etc/hosts
“`

![](https://img2020.cnblogs.com/blog/1208477/202008/1208477-20200803173645677-1977770762.png)

## 检查并停止sendmail和postfix
“`bash
systemctl stop sendmail
systemctl disable sendmail
systemctl stop postfix
systemctl disable postfix
“`

## 安装dnsmasq
dnsmasq先去解析hosts文件, 再去解析/etc/dnsmasq.d/下的*.conf文件,并且这些文件的优先级要高于dnsmasq.conf,自定义的resolv.dnsmasq.conf中的DNS也被称为上游DNS,这是最后去查询解析的;
如果不想用hosts文件做解析,我们可以在/etc/dnsmasq.conf中加入no-hosts这条语句,这样的话就直接查询上游DNS了,如果我们不想做上游查询,就是不想做正常的解析,我们可以加入no-reslov这条语句。

1. 安装dnsmasq

“`shell
yum install -y dnsmasq bind-utils
“`

2. 配置dnsmasq

“`shell
vi /etc/dnsmasq.conf
“`

添加以下到文件末尾:

“`shell
server=127.0.0.1
domain=autumn.info
mx-host=autumn.info,mail.autumn.info,5
“`

3. 修改本地dns服务器
/etc/resolv.conf中存的是定义dnsmasq从哪里获取上游DNS服务器的地址。
“`shell
vi /etc/resolv.conf
“`

添加以下到文件首行:

“`shell
nameserver 127.0.0.1
“`

4. 启动dnsmasq

“`shell
systemctl start dnsmasq
“`

5. 测试

“`shell
dig MX autumn.info
“`
![](https://img2020.cnblogs.com/blog/1208477/202008/1208477-20200803155426505-1624454599.png)

## 安装Zimbra
用root账户登录SSH, 即可开始安装。(不要sudo, 请直接su到root, 否则会出错)
“`shell
cd /tmp/
wget https://files.zimbra.com/downloads/8.8.15_GA/zcs-8.8.15_GA_3869.RHEL7_64.20190918004220.tgz #下载
tar -zxf zcs-8.8.15_GA_3869.RHEL7_64.20190918004220.tgz
cd zcs-8.8.15_GA_3869.RHEL7_64.20190918004220
./install.sh #开始安装
“`

![](https://img2020.cnblogs.com/blog/1208477/202008/1208477-20200803163033158-2031722231.png)

设置密码
“`shell
Main menu

1) Common Configuration:
2) zimbra-ldap: Enabled
3) zimbra-logger: Enabled
4) zimbra-mta: Enabled
5) zimbra-dnscache: Enabled
6) zimbra-snmp: Enabled
7) zimbra-store: Enabled
+Create Admin User: yes
+Admin user to create: admin@autumn.info
******* +Admin Password UNSET
+Anti-virus quarantine user: virus-quarantine.ueecao0f6@autumn.info
+Enable automated spam training: yes
+Spam training user: spam.7agfy9xhfy@autumn.info
+Non-spam(Ham) training user: ham.gyklapoewc@autumn.info
+SMTP host: autumn.info
+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://autumn.info:7780/aspell.php
+Enable version update checks: TRUE
+Enable version update notifications: TRUE
+Version update notification email: admin@mail.autumn.info
+Version update source email: admin@mail.autumn.info
+Install mailstore (service webapp): yes
+Install UI (zimbra,zimbraAdmin webapps): yes

8) zimbra-spell: Enabled
9) zimbra-proxy: Enabled
10) zimbra-imapd: Enabled
11) Default Class of Service Configuration:
s) Save config to file
x) Expand menu
q) Quit

Address unconfigured (**) items (? – help) 7 #输入7进入管理员界面,此时没有密码直接进入

Store configuration

1) Status: Enabled
2) Create Admin User: yes
3) Admin user to create: admin@autumn.info
** 4) Admin Password UNSET
5) Anti-virus quarantine user: virus-quarantine.ueecao0f6@autumn.info
6) Enable automated spam training: yes
7) Spam training user: spam.7agfy9xhfy@autumn.info
8) Non-spam(Ham) training user: ham.gyklapoewc@autumn.info
9) SMTP host: autumn.info
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://autumn.info:7780/aspell.php
19) Enable version update checks: TRUE
20) Enable version update notifications: TRUE
21) Version update notification email: admin@mail.autumn.info
22) Version update source email: admin@mail.autumn.info
23) Install mailstore (service webapp): yes
24) Install UI (zimbra,zimbraAdmin webapps): yes

Select, or ‘r’ for previous menu [r] 4 #按4进行设置密码

Password for admin@autumn.info (min 6 characters): [hfnL7htA] 123456 #密码默认为123456

Store configuration

1) Status: Enabled
2) Create Admin User: yes
3) Admin user to create: admin@autumn.info
4) Admin Password set
5) Anti-virus quarantine user: virus-quarantine.ueecao0f6@autumn.info
6) Enable automated spam training: yes
7) Spam training user: spam.7agfy9xhfy@autumn.info
8) Non-spam(Ham) training user: ham.gyklapoewc@autumn.info
9) SMTP host: autumn.info
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://autumn.info:7780/aspell.php
19) Enable version update checks: TRUE
20) Enable version update notifications: TRUE
21) Version update notification email: admin@mail.autumn.info
22) Version update source email: admin@mail.autumn.info
23) Install mailstore (service webapp): yes
24) Install UI (zimbra,zimbraAdmin webapps): yes

Select, or ‘r’ for previous menu [r] r #输入r退回到上级菜单

Main menu

1) Common Configuration:
2) zimbra-ldap: Enabled
3) zimbra-logger: Enabled
4) zimbra-mta: Enabled
5) zimbra-dnscache: Enabled
6) zimbra-snmp: Enabled
7) zimbra-store: Enabled
8) zimbra-spell: Enabled
9) zimbra-proxy: Enabled
10) zimbra-imapd: Enabled
11) 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)
“`
应用设置
“`shell
*** CONFIGURATION COMPLETE – press ‘a’ to apply
Select from menu, or press ‘a’ to apply config (? – help) a #按a应用设置
Save configuration data to a file? [Yes] yes #yes保存到文件
Save config in file: [/opt/zimbra/config.8277] #直接回车,保存到配置文件/opt/zimbra/config.8277
Saving config in /opt/zimbra/config.8277…done.
The system will be modified – continue? [No] yes #继续安装
Operations logged to /tmp/zmsetup.20200804-004606.log
Setting local config values…done.
Initializing core config…Setting up CA…
“`

参考:

搭建高大上的Zimbra办公与邮件服务系统


https://www.chenxie.net/archives/2279.html

点赞

Leave a Reply

Your email address will not be published. Required fields are marked *