Hướng dẫn cài đặt máy chủ email Zimbra trên CentOS 7

17
0
[wpcc-iframe title=”Hướng dẫn cài đặt Zimbra Mail Server trên CentOS 7| Đỗ Trunng Quân” width=”1170″ height=”878″ src=”https://www.youtube.com/embed/7fGd4N51O-A?feature=oembed” frameborder=”0″ allow=”accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture” allowfullscreen]

Mail Server là một trong những Máy chủ quan trọng và quan trọng đối với mọi tổ chức vì hầu hết các giao tiếp kinh doanh chỉ được thực hiện qua email. Trong thế giới nguồn mở có một vài máy chủ email miễn phí nhưng Zimbra là một trong những máy chủ thư hàng đầu. Máy chủ thư Zimbra a.k.a ZCS (Bộ cộng tác Zimbra) có hai phiên bản, Nguồn mở và phiên bản doanh nghiệp.

Và bài viết này mình sẽ hướng dẫn bạn thực hiện cài đặt một máy chủ mail riêng cho công ty, doanh nghiệp của bạn.

zimbra

Bước 1: Cập nhật bản ghi mail

Để phục vụ cho việc cài đặt. Bạn hãy trỏ bản ghi mail như sau trước nhé. Bên dưới là 2 bản ghi và mẫu của mình.

Type Name Value TTL
MX @ or domain mail.domain Auto
A mail ip-server Auto
Screenshot 2021 07 24 at 10.24.34

Bước 2:  Kiểm tra và cập nhật hệ thống

Bước đầu tiên bạn cần kiểm tra SELINUX xem có đang bật không, nếu đang bật thì bạn tắt đi.

# vi /etc/selinux/config
SELINUX=disabled
[root@mail ~]# sestatus
SELinux status: disabled
Screenshot 2021 07 24 at 10.13.35

Thực hiện stop postfix và remove postfix.

Postfix là một phầm mềm nguồn mở được dùng để gửi mail (Mail Transfer Agent-MTA). Được phát hành bởi IBM với mục tiêu thay thế trình gửi mail phổ biến là sendmail. Nó được trang bị trên hệ điều hành do đó bạn hãy xoá bỏ để sử dụng dịch vụ riêng của Zimbra.

[root@mail ~]# systemctl stop postfix
[root@mail ~]# yum remove postfix -y
Screenshot 2021 07 24 at 10.14.16

Sau đó bạn cập nhật hệ thống bằng lệnh sau và reboot lại máy chủ để áp dụng

[root@mail ~]# yum update -y ; reboot

Bước 3: Kiểm tra và set hostname

Bạn thực hiện kiểm tra hostname và set lại hostname tương ứng

[root@mail ~]# hostnamectl set-hostname mail.dotrungquan.site
[root@mail ~]# exec bash
Screenshot 2021 07 24 at 10.18.11

Sau khi set hostname xong bạn thêm dòng sau vào file hosts bạn nhớ thay đổi IP bằng IP của bạn nha.

[root@mail ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
103.221.220.187 mail.dotrungquan.site

Bước 4: Cài đặt Zimbra

Bạn thực hiệ chạy lệnh sau để install Zimbra & ZCS dependencies

[root@mail ~]# yum install unzip net-tools sysstat openssh-clients perl-core libaio nmap-ncat libstdc++.so.6 wget -y

Bước tiếp theo bạn cần Download Zimbra và cài đặt. Và bạn cần tạo một thư mục zimbra để cài vào đó. Bạn cũng có thể xem các phiên bản Zimbra ở trang chủ để download nhé.

[root@mail ~]# mkdir zimbra && cd zimbra
[root@mail zimbra]# wget https://files.zimbra.com/downloads/8.8.15_GA/zcs-8.8.15_GA_3869.RHEL7_64.20190918004220.tgz --no-check-certificate
Screenshot 2021 07 24 at 10.40.27

Sau khi download về hoàn tất bạn tiến hành giải nén file ra

[root@mail zimbra]# tar zxpvf zcs*.tgz

Truy cập vào thư mục vừa giải nén và chạy lệnh ./install

[root@mail zimbra]# cd zcs* && ./install.sh

Screenshot 2021 07 24 at 10.41.29
[root@mail zimbra]# cd zcs* && ./install.sh
Operations logged to /tmp/install.log.SJIMGleG

Checking for existing installation...
...
    zimbra-license-tools...NOT FOUND
...
Do you agree with the terms of the software license agreement? [N] y
Use Zimbra's package repository [Y] 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)
Found zimbra-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] y
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] y
Install zimbra-imapd (BETA - for evaluation only) [N] y
Install zimbra-chat [Y] 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-dnscache
    zimbra-snmp
    zimbra-store
    zimbra-apache
    zimbra-spell
...
The system will be modified.  Continue? [N] y
Beginning Installation - see /tmp/install.log.SJIMGleG for details...
 ...
                                     zimbra-snmp will be installed.
                         zimbra-store-components will be downloaded and installed.
                       zimbra-jetty-distribution will be downloaded and installed.
                                zimbra-mbox-conf will be installed.
...
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
      ...
Installing extra packages (3):
   zimbra-drive
   zimbra-patch
   zimbra-chat
      ...done
Running Post Installation Configuration:
Operations logged to /tmp/zmsetup.20191218-041840.log
Installing LDAP configuration database...done.
Setting defaults...
DNS ERROR resolving MX for mail.dotrungquan.site
It is suggested that the domain name have an MX record configured in DNS
Change domain name? [Yes] Yes
Create domain: [mail.dotrungquan.site] dotrungquan.site
	MX: mail.dotrungquan.site (103.221.220.204)
	Interface: 127.0.0.1
	Interface: ::1
	Interface: 103.221.220.187
done.
Checking for port conflicts
Port conflict detected: 25 (zimbra-mta)
Port conflict detected: 25 (zimbra-mta)
Port conflicts detected! - Press Enter/Return key to continue # Enter
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:                 [email protected]   
******* +Admin Password                        UNSET     ## Chưa set password nên hiện UNSET                    
        +Anti-virus quarantine user:           [email protected]
        +Enable automated spam training:       yes                           
        +Spam training user:                   [email protected]
        +Non-spam(Ham) training user:          [email protected]
        +SMTP host:                            mail.dotrungquan.site         
        +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.dotrungquan.site:7780/aspell.php
        +Enable version update checks:         TRUE                          
        +Enable version update notifications:  TRUE                          
        +Version update notification email:    [email protected]   
        +Version update source email:          [email protected]   
        +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
Store configuration
   1) Status:                                  Enabled                       
   2) Create Admin User:                       yes                           
   3) Admin user to create:                    [email protected]   
** 4) Admin Password                           UNSET                         
   5) Anti-virus quarantine user:              [email protected]
   6) Enable automated spam training:          yes                           
   7) Spam training user:                      [email protected]
   8) Non-spam(Ham) training user:             [email protected]
   9) SMTP host:                               mail.dotrungquan.site         
  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.dotrungquan.site:7780/aspell.php
  19) Enable version update checks:            TRUE                          
  20) Enable version update notifications:     TRUE                          
  21) Version update notification email:       [email protected]   
  22) Version update source email:             [email protected]  
  23) Install mailstore (service webapp):      yes                           
  24) Install UI (zimbra,zimbraAdmin webapps): yes                   
Select, or 'r' for previous menu [r] 4 
Password for [email protected] (min 6 characters): [n4JFxQ8fNn] n4JFxQ8fNn
1) Status:                                  Enabled                       
   2) Create Admin User:                       yes                           
   3) Admin user to create:                    [email protected]   
   4) Admin Password                           set     # Đã set password                      
   5) Anti-virus quarantine user:              [email protected]
   6) Enable automated spam training:          yes                           
   7) Spam training user:                      [email protected]
   8) Non-spam(Ham) training user:             [email protected]
   9) SMTP host:                               mail.dotrungquan.site         
  10) Web server HTTP port:                    8080                          

Select, or 'r' for previous menu [r] r
*** 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
The system will be modified - continue? [No] yes
.......
	The VERSION of zcs installed (8.8.10_GA_3039_RHEL7_64)
	The ADMIN EMAIL ADDRESS created ([email protected])
Notify Zimbra of your installation? [Yes] yes
Notifying Zimbra of installation via http://www.zimbra.com/cgi-bin/notify.cgi?VER=8.8.10_GA_3039_RHEL7_64&[email protected]
Notification complete
Checking if the NG started running...done. 
Setting up zimbra crontab...done.
Moving /tmp/zmsetup.20191218-041840.log to /opt/zimbra/log
Configuration complete - press return to exit 
[root@mail zcs-8.8.10_GA_3039.RHEL7_64.20180928094617]# 

Khi cài đặt xong bạn hãy khởi động lại dịch vụ Zimbra bằng lệnh sau

[root@mail ~]# su zimbra
[zimbra@mail root]$ zmcontrol restart
Screenshot 2021 07 24 at 11.04.21

Bước 5: Mở Port Firewall

Như vậy là đã hoàn tất rồi nhé, nếu máy chủ bạn có cài Firewall bạn cần mở các port sau ra để email hoạt động

  • Dưới đây là các Port bạn cần mở
25,80,110,143,443,465,587,993,995,5222,5223,9071,7071
firewall-cmd --permanent --add-port={25,80,110,143,443,465,587,993,995,5222,5223,9071,7071}/tcp
firewall-cmd --reload

Sau đó bạn truy cập admin zimbra bằng IP:port qua giao thức https nhé

  • VD: https://103.221.220.187:7071/
Screenshot 2021 07 24 at 11.07.05
Giao diện đăng nhập Zimbra mail
Screenshot 2021 07 24 at 11.07.45

Chúc bạn thực hiện thành công. Nếu cần triển khai hệ thống mail hãy liên hệ với mình nhé.

Đỗ Trung Quân
WRITTEN BY

Đỗ Trung Quân

Nguồn nội dung này đến từ Website DoTrungQuan.info

Trả lời