Dựng Zimbra 9 trên Centos 7 Blank

Tác giả: 19/11/2022

Hôm nay Nhân Hòa sẽ hướng dẫn các bạn cài Zimbra 9 trên CentOS7

1 – Hệ điều hành Centos 7  có cấu hình khuyến nghị:

  • Memory – Tối thiểu 8GB, khuyến nghị 16 GB.
  • CPU – 4-core CPU or 4 vCPUs.
  • Storage space – Ổ cứng tối thiểu 10 GB
  • DNS Records – Bản ghi MX và bản ghi A (bài hướng dẫn sử dụng domain centos.tudv.xyz để cài máy chủ mail.centos.tudv.xyz)

 

2 – Update OS 

yum  update -y

yum install epel-release -y

reboot

3 – Setup

Cài package cần thiết

Centos

yum install unzip net-tools sysstat openssh-clients perl-core libaio nmap-ncat libstdc++.so.6 nano wget pax git -y

Set host-name

hostnamectl set-hostname mail.centos.tudv.xyz

exec bash

Add host

vi /etc/hosts

Thêm vào

103.28.36.128 mail.centos.tudv.xyz mail

Cập nhật múi giờ máy chủ

rm /etc/localtime

ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime

Tải script

cd  /root

git clone https://github.com/tudv1989/scripts

 

Điều hướng đến thư mục script rồi đến zimbra trong thư mục đã tải về.

cd scripts/zimbra/

CentOS 7

./zimbra_bind_setup_rhel.sh

Trong màn hình nhắc đầu tiên, nhấn phím Enter để bắt đầu cấu hình máy chủ DNS Bind.

Bạn cũng sẽ được yêu cầu nhập tên miền Zimbra, tên máy chủ và địa chỉ IP

 

Kiểm tra máy chủ DNS hoạt động

dig A mail.centos.tudv.xyz @127.0.0.1 +short

dig MX centos.tudv.xyz @127.0.0.1 +short

 

Tải xuống bản dựng

cd /root

wget http://download.zextras.com/zcs-9.0.0_OSE_RHEL7_latest-zextras.tgz

Giải Nén tập tin tải về

tar xvf zcs-9.0.0_OSE_RHEL7_latest-zextras.tgz

Điều hướng đến thư mục đã tạo sau khi tệp đã được giải nén

cd zcs-9*/

Bắt đầu cài đặt Zimbra 9 bằng ./install.sh lệnh như hình dưới đây:

sudo ./install.sh

Do you agree with the terms of the software license agreement? [N] Y

 

Use Zimbra’s package repository [Y]

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)

Select the packages to install

Install zimbra-ldap [Y]

Install zimbra-logger [Y]

Install zimbra-mta [Y]

Install zimbra-dnscache [Y] N

Install zimbra-snmp [Y]

Install zimbra-store [Y]

Install zimbra-apache [Y]

Install zimbra-spell [Y]

Install zimbra-memcached [Y]

Install zimbra-proxy [Y]

Install zimbra-drive [Y]

Install zimbra-imapd (BETA – for evaluation only) [N] N

Install zimbra-chat [Y]
Checking required space for zimbra-core
Checking space for zimbra-store
Checking required packages for zimbra-store
zimbra-store package check complete.

Installing:
zimbra-core
zimbra-ldap
zimbra-logger
zimbra-mta
zimbra-snmp
zimbra-store
zimbra-apache
zimbra-spell
zimbra-memcached
zimbra-proxy
zimbra-drive
zimbra-chat

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

Beginning Installation – see /tmp/install.log.X1mKDC79 for details…

DNS ERROR resolving MX for centos.tudv.xyz
It is suggested that the domain name have an MX record configured in DNS
Re-Enter domain name? [Yes] Yes
Create domain: [mail.centos.tudv.xyz] centos.tudv.xyz
MX: mail.centos.tudv.xyz (103.28.36.128)

Interface: 127.0.0.1
Interface: 103.28.36.128
done.
Checking for port conflicts

Main menu

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

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

Address unconfigured (**) items (? – help) 6

Store configuration

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

Select, or ‘r’ for previous menu [r] 4

Password for admin@centos.tudv.xyz (min 6 characters): [0ow34Hde] Pp098765a@1

Store configuration

1) Status: Enabled
2) Create Admin User: yes
3) Admin user to create: admin@centos.tudv.xyz
4) Admin Password set
5) Anti-virus quarantine user: virus-quarantine.ketigs4vuk@centos.tudv.xyz
6) Enable automated spam training: yes
7) Spam training user: spam.vfysppanpv@centos.tudv.xyz
8) Non-spam(Ham) training user: ham.bco0bwlboj@centos.tudv.xyz
9) SMTP host: mail.centos.tudv.xyz
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.centos.tudv.xyz:7780/aspell.php
19) Enable version update checks: TRUE
20) Enable version update notifications: TRUE
21) Version update notification email: admin@centos.tudv.xyz
22) Version update source email: admin@centos.tudv.xyz
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-snmp: Enabled
6) zimbra-store: Enabled
7) zimbra-spell: Enabled
8) zimbra-proxy: Enabled
9) 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.8285] Yes
Saving config in Yes…done.
The system will be modified – continue? [No] Yes
Operations logged to /tmp/zmsetup.20221029-182716.log
Setting local config values…

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.

Chờ đợi quá trình cài đặt hoàn tất

Blocking Memcached Exploit

Configure memcached to listen on 127.0.0.1 only to avoid this attack. Use below commands.

su  zimbra

/opt/zimbra/bin/zmprov ms `zmhostname` zimbraMemcachedBindAddress 127.0.0.1

/opt/zimbra/bin/zmprov ms `zmhostname` zimbraMemcachedClientServerList 127.0.0.1

Restart memcached:

zmmemcachedctl restart

zmcontrol restart

Truy cập giao diện admin nếu gặp lỗi zmconfigd not running hãy comment IPv6 trong /etc/hosts, sau đó restart lại zmconfigd

zmconfigdctl restart

https://mail.centos.tudv.xyz:7071

Đảm bảo đầy đủ các bản ghi A, MX, PTR, SPF, DKIM, DMARC (Máy chủ tại Nhân Hòa)

Loại: A
Tên: mail
Giá trị: 103.28.36.128
TTL: 300

Loại: MX
Tên: @
Giá trị: mail.domain.com
Ưu tiên: 10
TTL:300

Loại: TXT
Tên: @
Giá trị: v=spf1 mx +ip4:103.28.36.128 include:spf.nhanhoa.com ~all
TTL:300

Loại: TXT
Tên: _dmarc
Giá trị: v=DMARC1;p=none;pct=100;rua=mailto:postmaster@domain.com
TTL:300

Thêm bản ghi PTR ở DNS server của hệ thống DNS Nhân Hòa.

Thêm bản ghi DKIM các thông số lấy từ email server

Active dkim cho subdomain centos.tudv.xyz

su zimbra

/opt/zimbra/libexec/zmdkimkeyutil -a -d centos.tudv.xyz

Get dkim record

/opt/zimbra/libexec/zmdkimkeyutil -q -d centos.tudv.xyz

Bản ghi DKIM:

Tên : 1939BBE6-578D-11ED-A00E-388BF66660B5._domainkey.centos.tudv.xyz.

Loại : TXT

Giá trị :

v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1kGrORhbD6UI8LelbtrqDYYP7+JSowi7rS4bRJ5jmFuXXQf
AEleVlPJkGYF89G40HOCnwFn78M46FoBLDb48jIVQOALCbADhbIcSUqoEnd53qkpSNhfXYJ7eT58E6TVx5nbfcUUhfLkMHt2+0C381Zk//mR1
Y/EIZC8UUL+xEY2Zb0oii4K7n3hS3+Aer2TvK9m39NLci3US4JibJ0HPq1/OAXfhgc6+5CVmagu9vMtWjtvQko5oXXI3FustLBwBDsYLxQO/O
zU5dE2D6sugPj8qzAKoKV0bAAF78P/wgbh272FGPRgghJvx3RhPOYPIPNPZbBUkbOLBSnG1Q/PE6QIDAQAB

Check all bản ghi: Gửi thử 1 thư đến gmail để kiểm tra

Như vậy Nhân Hòa đã hướng dẫn các bạn cài đặt Zimbra9 trên Centos 7

Chúc các bạn may mắn và hẹn gặp lại các bạn tại các bài viết tiếp theo tại wiki.nhanhoa.com

 

 

 

 

 

 

 

 

Trả lời