Support #427
Updated by Daniel Curtis over 10 years ago
This guide is building the Zimbra Collaborative Suite 8.0.8 Open Source Edition on an Ubuntu 14.04 x64 virtual machine with 1GB of RAM. h2. Initial Setup * Add the Zimbra user: <pre> sudo mkdir /opt/zimbra sudo adduser --home /opt/zimbra zimbra sudo su - zimbra </pre> * Install git: <pre> apt-get install git </pre> * Obtain the git ssh access keys: <pre> mkdir -p /tmp/zimbra-git cd /tmp/zimbra-git wget http://files2.zimbra.com/downloads/git-fusion/zimbra-git-ssh.tgz tar xfz zimbra-git-ssh.tgz </pre> * Add the access keys to your own user account: <pre> cd ~/.ssh cp /tmp/zimbra-git/id_rsa_git* . </pre> * Add the following @~/.ssh/config@. Create the file if it doesn't exist: <pre> Host zimbra-git User public Hostname git.zimbra.com IdentityFile ~/.ssh/id_rsa_git IdentitiesOnly yes Port 1067 </pre> * Ensure the permissions on the config file are correct <pre> chmod 600 ~/.ssh/config </pre> h2. Obtaining the source to Zimbra Collaboration Suite The source code for ZCS is retrieved from git.zimbra.com as described above. * To obtain the source: <pre> mkdir -p ~/git cd ~/git git clone git@zimbra-git:zimbra-foss </pre> h3. Source for the "main" branch * main is the development branch. The 'main' branch, (often referred to as mainline) contains the latest code - if your interested in seeing pre-release software check it out. It is constantly in flux (for instance we might stagger spec files to avoid the need to always rebuild ThirdParty), if you're hitting a error in the Zimbra build side the first thing to do is re-sync, as we typically resolve these fast. +It is the default branch in use after doing a checkout of zimbra-foss+ h3. Listing available branches * The zimbra-foss repo contains all the available release branches. You can obtain a list of the branches via: <pre> git branch -a </pre> > *! main-foss > remotes/origin/HEAD -> origin/main-foss > remotes/origin/frank-foss > remotes/origin/franklin-5010-foss > remotes/origin/franklin-5011-foss > remotes/origin/franklin-5012-foss > remotes/origin/franklin-5013-foss > remotes/origin/franklin-5014-foss > remotes/origin/franklin-5015-foss > remotes/origin/franklin-5016-foss > remotes/origin/franklin-5017-foss > remotes/origin/franklin-5018-foss > remotes/origin/franklin-5019-foss > remotes/origin/franklin-5020-foss The branch with a * in front of it is your active checkout. h3. Changing the active checkout To change the active branch, you use the git checkout command, and supply the release you are interested in. * For example, to switch to the IRONMAIDEN 8 release branch, one would execute: <pre> cd ~/git/zimbra-foss git checkout ironmaiden-foss </pre> h3. Updating an existing clone * To update an already existing clone: <pre> cd ~/git/zimbra-foss git pull </pre> h2. Prepare the Build Environment * Install some prerequisites and development packages: <pre> sudo apt-get install build-essential autoconf libtool perl5.14 gettext automake cmake flex bison software-properties-common python-software-properties unzip zlib1g zlib1g-dev expat libexpat1-dev libpopt0 libpopt-dev libmysqlclient-dev libcurl4-openssl-dev libsasl2-2 libgssapi3-heimdal libsasl2-modules-gssapi-heimdal libsasl2-dev libldap2-dev libpcre3 libpcre3-dev libltdl3-dev libbz2-dev bzip2 libbz2-1.0 apache2-dev php5-dev postfix-dev libdspam7-dev libopendkim-dev libncurses5-dev libidn11 curl fetchmail libgmp3-dev libxml2 libstdc++6 openssl libssl-dev libaio-dev liblwp-useragent-determined-perl </pre> * Install a few more dependencies, to be safe: dependencies: <pre> sudo aptitude apt-get build-dep altermime amavisd-new apache2 aspell postfix-cluebringer libxml2 php5 openldap openssl rrdtool rsync sendmail snmp libtcmalloc-minimal4 zeromq mysql-server curl clamav cyrus-sasl2 postfix dspam opendkim </pre> * Now install a few 32-bit compatibility packages, if running on a 64 bit system: packages: <pre> sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386 libasound2:i386 libgtk2.0-0:i386 libxtst6:i386 </pre> h2. Prepare JDK 7 * Download JDK 7u60 locally then upload the local copy to the Zimbra server: <pre> scp -P 4440 ~/Downloads/jdk-7u60-linux-x64.tar.gz zimbra@zimbra.example.com:/opt/zimbra/ </pre> * Next, on the Zimbra server, add JDK 7u60 to the Zimbra build path: <pre> cp ~/jdk-7u60-linux-x64.tar.gz ~/git/zimbra-foss/ThirdPartyBuilds/x86_64/java/jdk-1.7.0_60.tgz sudo cp ~/jdk-7u60-linux-x64.tar.gz /usr/local/ sudo tar xzf /usr/local/jdk-1.7.0_60.tgz </pre> * Now, download JCE 6 locally, then upload the local copy to the Zimbra server: <pre> scp -P 4440 ~/Downloads/jce_policy-6.zip zimbra@zimbra.example.com:/opt/zimbra/ </pre> * Add JCE 6 policy to the JDK 7u60 build path: <pre> cp jce_policy-6.zip ~/git/zimbra-foss/ThirdPartyBuilds/x86_64/java/ cd ~/git/zimbra-foss/ThirdPartyBuilds/x86_64/java/ unzip jce_policy-6.zip </pre> h2. Install Apache Ant * Install apache ant: <pre> cd /usr/local sudo wget http://mirror.cogentco.com/pub/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz sudo tar xzf apache-ant-1.9.4-bin.tar.gz sudo ln -s /usr/local/apache-ant-1.9.4 /usr/local/ant </pre> h3. Add Java and ANT to the system environment: * Make the following changes to the @/etc/environment@ file: <pre> sudo vi /etc/environment </pre> > PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/java/bin:/usr/local/ant/bin" h3. Fix a few linked object problems: * I needed to create a few symbolic links that Zimbra will be looking for: <pre> sudo ln -s /lib/x86_64-linux-gnu/libncurses.so.5 /usr/lib/libncurses.so sudo ln -s /lib/x86_64-linux-gnu/libz.so.1 /usr/lib/libz.so sudo ln -s /usr/lib/x86_64-linux-gnu/libltdl.so /usr/lib/libltdl.so sudo ln -s /lib/x86_64-linux-gnu/libpcre.so.3 /usr/lib/libpcre.so sudo ln -s /lib/x86_64-linux-gnu/libexpat.so.1 /usr/lib/libexpat.so sudo ln -s /lib/x86_64-linux-gnu/libpopt.so.0 /usr/lib/libpopt.so sudo ln -s /usr/lib/libperl.so.5.14 /usr/lib/libperl.so </pre> h2. Building Zimbra Collaboration Server To build Zimbra Collaboration Server, the "buildZCSH.sh" script can be used, that is located in the ZimbraBuild directory after the checkout completes. * Since the server already has the various required binaries and libraries installed, run: <pre> cd ~/git/zimbra-foss/ZimbraBuild ./buildZCS.sh -t </pre> * I used the following CPAN repository, since I am not a fan of yahoo (the default): > http://ftp.osuosl.org/pub/CPAN/ h2. Resources * http://wiki.zimbra.com/wiki/Building_Zimbra_using_Git * http://www.oracle.com/technetwork/java/javase/archive-139210.html