Zimbra install

From UVOO Tech Wiki
Revision as of 23:05, 20 April 2023 by Busk (talk | contribs)
Jump to navigation Jump to search

https://inguide.in/install-zimbra-on-ubuntu-20-04-step-by-step/

.env

#!/bin/bash
set -a
MYIP=$(hostname -I | cut -f1 -d" " | tr -d '[:space:]')
DOMAIN="example.com"
HOSTONLY="zmail"
HOSTNAME="${HOSTONLY}"."$DOMAIN"
TIMEZONE="America/Denver"
LETSENCRYPT=n
APACHE=y
MYPASSWORD=$(openssl rand -base64 9)
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
SYSTEMMEMORY=$(($(grep MemAvailable /proc/meminfo | awk '{print $2}')/1024/1024))
#!/bin/bash
set -eu

host_prep(){
echo "Rewriting the /etc/hosts file ..."
mv /etc/hosts /etc/hosts.old
printf '127.0.0.1\tlocalhost.localdomain\tlocalhost\n127.0.1.1\tubuntu\n'$MYIP'\t'$HOSTNAME'\t'$HOSTONLY'\t' | tee -a /etc/hosts >/dev/null 2>&1
echo -e "${GREEN}... Done.${NC}"
echo "Setting hostname ($HOSTNAME) and timezone ($TIMEZONE) ..."
hostnamectl set-hostname $HOSTNAME >/dev/null 2>&1
timedatectl set-timezone $TIMEZONE >/dev/null 2>&1
echo -e "${GREEN}... Done.${NC}"
}


use_google_dns(){
  systemctl stop systemd-resolved
  systemctl disable systemd-resolved
  systemctl mask systemd-resolved

  mv /etc/resolv.conf {,.old}
  echo "nameserver 8.8.8.8" > /etc/resolv.conf
}

dnsmasq(){
  #DEBIAN_FRONTEND=noninteractive apt-get install -qq -y dnsmasq lsb-release net-tools netfilter-persistent dnsutils iptables sed wget rsyslog ldapscripts< /dev/null > /dev/null
  # DEBIAN_FRONTEND=noninteractive apt-get install -qq -y dnsmasq lsb-release net-tools netfilter-persistent dnsutils iptables sed wget rsyslog ldapscripts< /dev/null > /dev/null
  DEBIAN_FRONTEND=noninteractive apt-get install -qq -y dnsmasq dnsutils
  #Install a DNS Server
  echo "Configuring dnsmasq ..."
  mv /etc/dnsmasq.conf /etc/dnsmasq.conf.old
  #create the conf file
  # printf 'server=8.8.8.8\nserver=8.8.4.4\nserver=9.9.9.9\nserver=149.112.112.112\nserver=1.1.1.1\nserver=1.0.0.1\nlisten-address=127.0.0.1\ndomain='$DOMAIN'\nmx-host='$DOMAIN','$HOSTNAME',0\naddress=/'$HOSTNAME'/'$MYIP'\n' | tee -a /etc/dnsmasq.conf >/dev/null
  printf 'listen-address=127.0.0.1\ndomain='$DOMAIN'\nmx-host='$DOMAIN','$HOSTNAME',0\naddress=/'$HOSTNAME'/'$MYIP'\n' | tee -a /etc/dnsmasq.conf >/dev/null
  mv /etc/resolv.conf {,.old}
  echo "nameserver 127.0.0.1" > /etc/resolv.conf
  # restart dns services
  systemctl enable dnsmasq.service > /dev/null 2>&1 && systemctl restart dnsmasq.service
  echo -e "${GREEN}... Done.${NC}"

  # Check DNS
  echo "Checking DNS ..."
  name=`host google.com`
  if [[ "$name" == *"not found"* ]]; then
          echo -e "${RED}DNS resolution failed! Check your resolve.conf file.${NC}"
          exit 1
  else
          echo -e "${GREEN}... Done.${NC}"
  fi
}
host_prep
# use_google_dns
dnsmasq

curl -LO https://download.zextras.com/zcs-9.0.0_OSE_UBUNTU20_latest-zextras.tgz
tar xf zcs-9.0.0_OSE_UBUNTU20_latest-zextras.tgz

dir=$(ls | grep zcs-9.0.0_ZEXTRAS)
cd $dir
./install.sh
# disable zimbra dnscache
zmcontrol status
zmprov gs `zmhostname` zimbraServiceEnabled zimbraServiceInstalled
zmprov ms `zmhostname` -zimbraServiceEnabled dnscache -zimbraServiceInstalled dnscache
zmzimletctl listZimlets
zmzimletctl disable com_zextras_drive_open
zmcontrol restart

Update public url hostname for briefcase and other tools. If not it will use the server hostname defined on install.

zmprov md example.com zimbraPublicServiceHostname mail.uvoo.io
zmcontrol restart