Part 1 | Zimbra Setup

Introduction

Zimbra Collaboration, formerly known as the Zimbra Collaboration Suite (ZCS) before 2019, is a collaborative software suite that includes an email server and a web client.

Zimbra Collaboration Suite is built on an open source core, it features a modern interface, pre-integrations with popular third-party apps like Zoom, Slack and Dropbox, and can be deployed in the cloud or in on-prem and hybrid environments

image.png

Environment

OS Ubuntu 20.04 LTS

2 Server, with IP:

mail1: 103.93.56.62

mail2: 103.150.193.48

Install Zimbra (on both server)

Because we setup replication, the FQDN must be same

mail1 server

hostnamectl set-hostname mail.namadomain.my.id
vim /etc/hosts
103.93.56.62    mail.namadomain.my.id    mail

mail2 server

hostnamectl set-hostname mail.namadomain.my.id
vim /etc/hosts
103.150.193.4    mail.namadomain.my.id    mail
  • For server behind NAT you must mapping local/private ip to /etc/hosts

Download ZCS latest package (8.8.15) at 24-07-2023

Download in here

wget https://files.zimbra.com/downloads/8.8.15_GA/zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz

Extract

tar -xvf zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz

Use screen/tmux for installation (for minimize lost connections)

screen

Install

cd zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954
./install.sh 

Select Y (default package installation)

Select the packages to install

Install zimbra-ldap [Y] Y

Install zimbra-logger [Y] Y

Install zimbra-mta [Y]

Install zimbra-dnscache [Y]

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]

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-dnscache
    zimbra-snmp
    zimbra-store
    zimbra-apache
    zimbra-spell
    zimbra-memcached
    zimbra-proxy
    zimbra-drive
    zimbra-patch
    zimbra-mta-patch
    zimbra-proxy-patch
    zimbra-chat

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

If get error same like this, change domain to root domain (pramudika.my.id)

DNS ERROR resolving MX for mail.namadomain.my.id
It is suggested that the domain name have an MX record configured in DNS
Re-Enter domain name? [Yes]
Create domain: [mail.namadomain.my.id] **namadomain.my.id
        MX: mail.namadomain.my.id (10.10.10.164)

        Interface: 127.0.0.1
        Interface: ::1
        Interface: 10.10.10.164
done.

Configure zimbra password

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
        +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.namadomain.my.id
        +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.pramudika.my.id: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) 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.namadomain.my.id
  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.pramudika.my.id: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): [aowmtHVI] mailPram_**

Apply configuration

*** 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.21577]
Saving config in /opt/zimbra/config.21577...done.
The system will be modified - continue? [No] Yes

and wait for the installation to finish

Setup Replication

DNS Server

Make sure you have done with MX record in DNS Server, make DNS Failover using PowerGSLB read here

Example record:

Change weight in mail1 bigger than mail2, and add monitoring scripts

Replication

Full Guide can access in here

Install inotify-tools

apt install inotify-tools -y

Clone the repo

git clone https://gitlab.com/yetopen/zimbra-live-sync.git /opt/zimbra/live_sync

Make link to /etc/logrotate.d

ln -s /opt/zimbra/live_sync/logrotate.d/zimbra_live_sync /etc/logrotate.d/

Copy example conf

cd /opt/zimbra/live_syncd
cp live_sync-EXAMPLE.conf live_sync.conf

Configure ssh between mail server

cd /opt/zimbra/.ssh
ssh-keygen -t ed25519 -f live_sync
echo "command=\"/opt/zimbra/live_sync/sync_commands\" $( cat live_sync.pub )" >> authorized_keys

Enable redo log

Redo log is log file to record every transaction occurs on mail server.

Whenever there is a change in data in the Zimbra database (such as sending or receiving an email, deleting an email, or making changes to email settings), the change is logged into the redo log file.

Switch user to zimbra, and run command

su - zimbra
zmprov mcf zimbraRedoLogDeleteOnRollover FALSE
zmprov mcf zimbraRedoLogEnabled TRUE

Synchronizing data

Run on mirror server(mail 2)

systemctl disable zimbra
systemctl stop zimbra
rsync -aHz --force --include=".*" --delete --sparse mail-srv1:/opt/zimbra/ /opt/zimbra/

After that, run on live server (mail1)

systemctl stop zimbra
rsync -aHz --force --include=".*" --delete --sparse /opt/zimbra/ mail-srv2:/opt/zimbra/
systemctl start zimbra

Now, make sure we have a running same version in mirro server(mail2):

systemctl start zimbra
service zimbra status
systemctl stop zimbra

Running the script

Run on mirror server(mail2)

cd /opt/zimbra/live_sync
./live_syncd start

Running from systemd

cp etc/zimbra-live-sync.service /etc/systemd/system/
systemctl daemon-reload
systemctl start zimbra-live-sync

Failover

If the live server down, and you want to start zimbra on mirror server, stop sync script and start zimbra

./live_syncd stop
#or
systemctl stop zimbra-live-sync

Start zimbra

systemctl start zimbra

Fallback

comes back online and you want to catch up the changes done on the mirror one, which
has been live so far, run the sync script and once done restore Zimbra services on the live on

On live server(mail1)

su - zimbra
zmcontrol stop
cd live_sync
./live_syncd start

On mirror server(mail2)

systemctl stop zimbra

after successed sync , start zimbra again in live server(mail1)

./live_syncd stop
zmcontrol start

By admin

One thought on “Part 1 | Zimbra Replication”

Leave a Reply

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