如何在Ubuntu 20.04上安装搭建Zimbra开源邮件服务器_Ubuntu系统配置Zimbra邮件服务
Zimbra是什么?
Zimbra是Synacor,Inc.开发的开源电子邮件、日历和协作软件套件。它附带一个shell脚本,可以自动在Linux服务器上安装和配置所有必要的邮件服务器组件,从而消除手动安装和配置。使用Zimbra,您可以轻松地在基于web的管理面板中创建无限邮箱和无限邮件域。电子邮件帐户可以在MariaDB或OpenLDAP中管理。以下是Zimbra将自动安装和配置的开源软件列表。
-
后缀SMTP服务器
-
Nginx web服务器为管理控制台和webmail提供服务。它还将用作IMAP/POP3代理。
-
Jetty:运行Zimbra软件的web应用服务器。
-
OpenLDAP存储Zimbra系统配置、Zimbra全局地址列表,并提供用户身份验证。
-
MariaDB数据库
-
OpenDKIM:用于DKIM签名和验证
-
一个新的:MTA和内容扫描程序之间的接口。
-
SpamAssassin用于反垃圾邮件
-
ClamAV:反病毒扫描仪
-
Lucene:开源全功能文本和搜索引擎
-
ApacheJSieve:电子邮件过滤器
-
LibreOffice:高保真文档预览
-
Aspell:Zimbra Web客户端上使用的开源拼写检查器
-
memcached:开源对象缓存系统。
-
未绑定:轻量级快速DNS解析程序。
Zimbra还附带了一些自己开发的软件:
-
zimbra drive:云存储。
-
zimbra聊天:文本聊天。
-
zimbra talk:具有屏幕共享和文件共享功能的群信息和视频会议。
-
mailboxd:它自己开发的IMAP/POP3服务器。
Zimbra有两个版本:
-
免费开源版。
-
商业支持的网络版,60天免费试用。
一些著名的Zimbra用户包括:Mozilla、Skype、O\'Reilly Media、斯坦福大学和康卡斯特。在本文中,我们将使用开源版本(OSE)。
Zimbra – 系统要求
根据Zimbra文档,您的系统应该满足以下最低配置。
- 中央处理器 – 1.5 GHz
- 内存 – 8 GB
- 存储空间 – 5 GB用于安装
环境
系统:Ubuntu20.04
ip地址:192.168.1.66(用内网举例
域名:mail.example.com
初始服务器设置
首先,切换到root
用户
sudo -i
接下来,更新和升级Ubuntu
apt updateapt upgrade -y
之后,设置主机名
hostnamectl set-hostname mail.example.com
现在,您需要编辑hosts文件
vim /etc/hosts
此文件应该包含:
127.0.0.1 localhost127.0.1.1 mail.example.com mail192.168.1.66 mail.example.com mail
安装与配置 Dnsmasq
我们需要安装 Dnsmasq 以创建和管理 Zimbra 所需的若干 DNS 记录,然后禁用 systemd-resolved 以避免 Dnsmasq 与 systemd-resolved 之间产生冲突。
systemctl stop systemd-resolved
systemctl disable systemd-resolved
删除原有的resolv.conf并创建新的
rm -f /etc/resolv.conf
vim /etc/resolv.conf
接下来,添加以下内容
nameserver 8.8.8.8
安装Dnsmasq
apt install dnsmasq -y
备份现有的Dnsmasq配置文件并编辑文件
cp /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
vim /etc/dnsmasq.conf
添加以下内容,不要忘记替换您的IP地址与域名
server= 192.168.1.66domain= example.commx-host= example.com, mail.example.com, 5mx-host= mail.example.com, mail.example.com, 5listen-address= 127.0.0.1
现在保存文件。如果您运行dig
命令,您应该会得到以下输出
root@mail:~# dig -t A mail.example.com ; <<>> DiG 9.16.1-Ubuntu <<>> -t A mail.example.com;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 15272;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 512;; QUESTION SECTION:;mail.example.com. IN A ;; ANSWER SECTION:mail.example.com. 1799 IN A 192.168.1.66 ;; Query time: 31 msec;; SERVER: 8.8.8.8#53(8.8.8.8);; WHEN: Wed Jul 30 14:59:46 CEST 2025;; MSG SIZE rcvd: 61
root@mail:~# dig -t MX example.com ; <<>> DiG 9.16.1-Ubuntu <<>> -t MX example.com;; global options: +cmd;; Got answer:;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4658;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION:; EDNS: version: 0, flags:; udp: 512;; QUESTION SECTION:;example.com. IN MX ;; ANSWER SECTION:example.com. 1799 IN MX 10 mail.example.com. ;; Query time: 35 msec;; SERVER: 8.8.8.8#53(8.8.8.8);; WHEN: Wed Jul 30 14:59:05 CEST 2025;; MSG SIZE rcvd: 61
安装Zimbra开源版
下载并解压zimbra
wget https://files.zimbra.com/downloads/8.8.15_GA/zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz
tar xvzf zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz
cd zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954
安装Zimbra
./install.sh
您将被要求同意许可和其他几个问题,您必须回答以下内容
Do you agree with the terms of the software license agreement? [N] y
Use Zimbra\'s package repository [Y] y
Warning: apt-key output should not be parsed (stdout is not a terminal)
Importing Zimbra GPG key
Configuring package repository
Checking for installable packages
Found zimbra-core (local)
Found zimbra-ldap (local)
Found zimbra-logger (local)
Found zimbra-mta (local)
Found zimbra-dnscache (local)
Found zimbra-snmp (local)
Found zimbra-store (local)
Found zimbra-apache (local)
Found zimbra-spell (local)
Found zimbra-memcached (repo)
Found zimbra-proxy (local)
Found zimbra-drive (repo)
Found zimbra-imapd (local)
Found zimbra-patch (repo)
Found zimbra-mta-patch (repo)
Found zimbra-proxy-patch (repo)
Select the packages to install
Install zimbra-ldap [Y] y
Install zimbra-logger [Y] y
Install zimbra-mta [Y] y
Install zimbra-dnscache [Y] 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
Install zimbra-drive [Y] n
Install zimbra-imapd (BETA - for evaluation only) [N] n
Install zimbra-chat [Y] n
Checking required space for zimbra-core
Checking space for zimbra-store
Checking required packages for zimbra-store
zimbra-store package check complete.
The system will be modified. Continue? [N] y
Beginning Installation - see /tmp/install.log.UUJ9kVuj for details...
zimbra-core-components will be downloaded and installed.
zimbra-timezone-data will be installed.
zimbra-common-mbox-conf-attrs will be installed.
zimbra-common-core-jar will be installed.
zimbra-common-mbox-conf-rights will be installed.
zimbra-common-core-libs will be installed.
zimbra-common-mbox-conf-msgs will be installed.
zimbra-common-mbox-db will be installed.
zimbra-common-mbox-docs will be installed.
zimbra-common-mbox-native-lib will be installed.
zimbra-common-mbox-conf will be installed.
zimbra-core will be installed.
zimbra-ldap-components will be downloaded and installed.
zimbra-ldap will be installed.
zimbra-logger will be installed.
zimbra-mta-components will be downloaded and installed.
zimbra-mta will be installed.
zimbra-dnscache-components will be downloaded and installed.
zimbra-dnscache will be installed.
zimbra-snmp-components will be downloaded and installed.
zimbra-snmp will be installed.
zimbra-store-components will be downloaded and installed.
zimbra-jetty-distribution will be downloaded and installed.
zimbra-mbox-store-libs will be installed.
zimbra-mbox-conf will be installed.
zimbra-mbox-admin-console-war will be installed.
zimbra-mbox-war will be installed.
zimbra-mbox-webclient-war will be installed.
zimbra-mbox-service will be installed.
zimbra-store will be installed.
zimbra-apache-components will be downloaded and installed.
zimbra-apache will be installed.
zimbra-spell-components will be downloaded and installed.
zimbra-spell will be installed.
zimbra-memcached will be downloaded and installed.
zimbra-proxy-components will be downloaded and installed.
zimbra-proxy will be installed.
zimbra-patch will be downloaded and installed (later).
zimbra-mta-patch will be downloaded and installed (later).
zimbra-proxy-patch will be downloaded and installed (later).
Downloading packages (11):
zimbra-core-components
zimbra-ldap-components
zimbra-mta-components
zimbra-dnscache-components
zimbra-snmp-components
zimbra-store-components
zimbra-jetty-distribution
zimbra-apache-components
zimbra-spell-components
zimbra-memcached
zimbra-proxy-components
...done
Removing /opt/zimbra
Removing zimbra crontab entry...done.
Cleaning up zimbra init scripts...done.
Cleaning up /etc/security/limits.conf...done.
Finished removing Zimbra Collaboration Server.
安装过程可能会很长 请您耐心等待。
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@mail.
example.com
******* +Admin Password UNSET
+Anti-virus quarantine user: virus-quarantine.3liys4nw@mail.
example.com
+Enable automated spam training: yes
+Spam training user: spam.cfzvesa2d5@mail.
example.com
+Non-spam(Ham) training user: ham.ofijq5m5@mail.
example.com
+SMTP host: mail.
example.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.example.com:7780/aspell.php
+Enable version update checks: TRUE
+Enable version update notifications: TRUE
+Version update notification email: admin@mail.
example.com
+Version update source email: admin@mail.
example.com
+Install mailstore (service webapp): yes
+Install UI (zimbra,zimbraAdmin webapps): yes
8) zimbra-spell: Enabled
9) zimbra-proxy: Enabled
10) Default Class of Service Configuration:
s) Save config to file
x) Expand menu
q) Quit
Address unconfigured (**) items (? - help) 7
Store configuration
1) Status: Enabled
2) Create Admin User: yes
3) Admin user to create: admin@mail.
example.com
** 4) Admin Password UNSET
5) Anti-virus quarantine user: virus-quarantine.3liys4nw@mail.
example.com
6) Enable automated spam training: yes
7) Spam training user: spam.cfzvesa2d5@mail.
example.com
8) Non-spam(Ham) training user: ham.ofijq5m5@mail.
example.com
9) SMTP host: mail.
example.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.example.com:7780/aspell.php
19) Enable version update checks: TRUE
20) Enable version update notifications: TRUE
21) Version update notification email: admin@mail.
example.com
22) Version update source email: admin@mail.
example.com
23) Install mailstore (service webapp): yes
24) Install UI (zimbra,zimbraAdmin webapps): yes
Select, or \'r\' for previous menu [r] 4
Password for admin@mail.example.com (min 6 characters): [m3XShBkX] 123456 (最少6位
Store configuration
1) Status: Enabled
2) Create Admin User: yes
3) Admin user to create: admin@mail.
example.com
4) Admin Password set
5) Anti-virus quarantine user: virus-quarantine.3liys4nw@mail.
example.com
6) Enable automated spam training: yes
7) Spam training user: spam.cfzvesa2d5@mail.
example.com
8) Non-spam(Ham) training user: ham.ofijq5m5@mail.
example.com
9) SMTP host: mail.
example.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.example.com:7780/aspell.php
19) Enable version update checks: TRUE
20) Enable version update notifications: TRUE
21) Version update notification email: admin@mail.
example.com
22) Version update source email: admin@mail.
example.com
23) Install mailstore (service webapp): yes
24) Install UI (zimbra,zimbraAdmin webapps): yes
Select, or \'r\' for previous menu [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) 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]
Save config in file: [/opt/zimbra/config.21298]
Saving config in /opt/zimbra/config.21298...done.
The system will be modified - continue? [No] yes
在安装结束时,系统会询问您是否要通知Zimbra
Notify Zimbra of your installation? [Yes] no
然后耐心等待安装结束。
登录
系统管理员:https://192.168.1.66:7071
客户端:https://192.168.1.66
如果您无法访问,则防火墙可能正在运行。您需要允许端口通过防火墙
ufw allow 25,80,110,143,443,465,587,993,995,5222,5223,9071,7071/tcp
至此安装结束
总结
通过以上步骤,您可以轻松在Ubuntu20.04系统上成功安装和配置Zimbra邮件服务器。Zimbra提供了丰富的功能,可以帮助您轻松管理企业邮件服务。在配置过程中,请确保仔细阅读每一步的提示,以确保配置正确无误。