Wednesday, 28 June 2023

How to setup Open Source Zimbra mail server in Ubuntu Server 20.4 LTS

 Mainly Zima system have some requirements. but if you are trying to install it on a virtual emulation or eve-ng/pnetlab then no need to follow their official requirements. just folow the below steps. 


1. Need a Domain name: I have mail.shaharul.abc

2. Need Domain name record in DNS server 

TypeHostValue
Amail192.168.9.91
MX@mail.shaharul.abc 91
If you setup your dns server as i have posted a dns server setup blog. then no need to setup above configuration. 


Setup Server


Update Repo 

sudo -i
apt update && apt upgrade -y

Set Hostname matched your mail server domain name

hostnamectl set-hostname mail.shaharul.abc
sudo -i

Now edit the host file 

nano /etc/hosts


and paste as below

    127.0.0.1 localhost
    127.0.1.1 mail.shaharul.abc mail
    192.168.9.91 mail.shaharul.abc mail


Next, we need to install Dnsmasq to create and manage a few DNS records required by Zimbra. We also need to disable systemd-resolve in order to avoid conflict between dnsmasq and systemd-resolve


systemctl disable systemd-resolved
systemctl stop systemd-resolved
ls -lh /etc/resolv.conf
rm -f /etc/resolv.conf

Now create your own resolv.conf 


nano /etc/resolv.conf

set name server as below

    nameserver 192.168.9.92


Now install Dnsmasq


apt install dnsmasq -y


Now configure Dnsmasq 

Edit dnsmasq.conf.bak

cp /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
nano /etc/dnsmasq.conf


and paste below content at bottom of the file and change ip and server as your. 

    server= 192.168.9.91
    domain=shaharul.abc
    mx-host= shaharul.abc, mail.shaharul.abc, 5
    mx-host= mail.shaharul.abc, mail.shaharul.abc, 5
    listen-address=127.0.0.1

Now dig the command and see  A record



root@mail:~# dig -t A mail.shaharul.abc
 
; <<>> DiG 9.16.1-Ubuntu <<>> -t A mail.shaharul.abc
;; 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.shaharul.abc.              IN      A
 
;; ANSWER SECTION:
mail.shaharul.abc.       1799    IN      A       192.168.9.91
 
;; Query time: 31 msec
;; SERVER: 192.168.9.92#53(192.168.9.92)
;; WHEN: Sun Jul 10 14:59:46 CEST 2022
;; MSG SIZE  rcvd: 61


Also check MX record


root@mail:~# dig -t MX shaharul.abc
 
; <<>> DiG 9.16.1-Ubuntu <<>> -t MX shaharul.abc
;; 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:
;shaharul.abc.                   IN      MX
 
;; ANSWER SECTION:
shaharul.abc.            1799    IN      MX      91 mail.shaharul.abc.
 
;; Query time: 35 msec
;; SERVER: 192.168.9.92#53(192.168.9.92)
;; WHEN: Sun Jul 10 14:59:05 CEST 2022
;; MSG SIZE  rcvd: 61


Now install zimbra Open source


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
./install.sh

Now it will ask license agreement and some configuration checkup


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.


In the next screen zimbra will ask to set admin password.


Main menu
   1) Common Configuration:
   2) zimbra-ldap:                             Enabled
   3) zimbra-logger:                           Enabled
   4) zimbra-mta:                              Enabled
   5) zimbra-dnscache:                         Enabled
        +Master DNS IP address(es):            yes
        +Enable DNS lookups over TCP:          yes
        +Enable DNS lookups over UDP:          yes
        +Only allow TCP to communicate with Master DNS: no                        
   6) zimbra-snmp:                             Enabled
   7) zimbra-store:                            Enabled
        +Create Admin User:                    yes
        +Admin user to create:                 admin@mail.shaharul.abc
******* +Admin Password                        UNSET
        +Anti-virus quarantine user:           virus-quarantine.c73xqgvr@mail.shaharul.abc
        +Enable automated spam training:       yes
        +Spam training user:                   spam.g1kkn_0g6l@mail.shaharul.abc
        +Non-spam(Ham) training user:          ham.tzkyhmqk2a@mail.shaharul.abc
        +SMTP host:                            mail.shaharul.abc
        +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.shaharul.abc:7780/aspell.php
        +Enable version update checks:         TRUE
        +Enable version update notifications:  TRUE
        +Version update notification email:    admin@mail.shaharul.abc
        +Version update source email:          admin@mail.shaharul.abc
        +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) Quit5



select 7 by answering 7 like below


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

select 4 by answering 4 like below and apply



Select, or 'r' for previous menu [r] 4

Password for admin@mail.inguide.in (min 6 characters): password
 
Store configuration
 
   1) Status:                                  Enabled
   2) Create Admin User:                       yes
   3) Admin user to create:                    admin@mail.inguide.in
   4) Admin Password                           set
   5) Anti-virus quarantine user:              virus-quarantine.3liys4nw@mail.inguide.in
   6) Enable automated spam training:          yes
   7) Spam training user:                      spam.cfzvesa2d5@mail.inguide.in
   8) Non-spam(Ham) training user:             ham.ofijq5m5@mail.inguide.in
   9) SMTP host:                               mail.inguide.in
  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.inguide.in:7780/aspell.php
  19) Enable version update checks:            TRUE
  20) Enable version update notifications:     TRUE
  21) Version update notification email:       admin@mail.inguide.in
  22) Version update source email:             admin@mail.inguide.in
  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




Now zimbra will ask to notify zimbra about your installation info. simply type yes


and then allow all the port related mail in firewall.

ufw allow 25,80,110,143,443,465,587,993,995,5222,5223,9071,7071/tcp


Everything is done. 

Now try to log in to your Mail console via

        https://mail.shaharul.abc:7071
        Username: admin
        Password: your chosen password


and for your mail login 

        https://mail.shaharul.abc
        Username: admin@mail.shaharul.abc
        Password: your chosen password




No comments:

Post a Comment

Thanks for your valuable feedback.

Comprehensive IP Calculator: Supporting Both IPv4 and IPv6

Download:  Download Whether you're a network engineer, IT professional, or simply a tech enthusiast, understanding IP addresses is cruci...