Skip to content

Building Zimbra Nginx using a script

Barry de Graaff edited this page Jul 24, 2023 · 1 revision

Building Zimbra Nginx using a script

The idea is the use below script on a fresh Ubuntu 20.04 server and build Zimbra Nginx without the need to install Zimbra.

Git over SSH

I have added my SSH key to Github and ran ssh-add on my development machine, I added the following to my .ssh/config. Where nginx-dev is the hostname of the Ubuntu 20.04 machine where I want to build Zimbra Nginx.

Host nginx-dev
  ForwardAgent yes

If you have trouble getting git clone to work, replace:

GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:Zimbra/packages.git

with:

git clone https://github.com/Zimbra/packages

You have to do this 3 times!

Use the script

Create a new file build.sh with below content and run it using:

chmod +x build.sh
./build.sh

build.sh script

#!/bin/bash

cd /tmp
rm packages zimbra-* -Rf

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9BE6ED79

cat >> /etc/apt/sources.list.d/zimbra.list << EOF
deb [arch=amd64] https://repo.zimbra.com/apt/87 focal zimbra
deb-src [arch=amd64] https://repo.zimbra.com/apt/87 focal zimbra
deb [arch=amd64] https://repo.zimbra.com/apt/1000 focal zimbra
deb-src [arch=amd64] https://repo.zimbra.com/apt/1000 focal zimbra
deb [arch=amd64] https://repo.zimbra.com/apt/1000-ne focal zimbra
deb-src [arch=amd64] https://repo.zimbra.com/apt/1000-ne focal zimbra
EOF

apt-get clean
apt update

apt -y install m4 libpcre3-dev build-essential git binutils lintian debhelper dh-make devscripts libz-dev

GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:Zimbra/packages.git
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:Zimbra/zimbra-build.git
GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:Zimbra/zimbra-package-stub.git

cd zimbra-package-stub
git checkout develop #ubuntu 20 support
cd ..

cd packages
git submodule update --init --recursive --remote

cd /tmp/packages/thirdparty/nginx/

make  #if something fails the make command will give more details than `make build`

sleep 10

make build