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
* 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 gettext automake cmake flex bison software-properties-common python-software-properties unzip zlib1g-dev libexpat1-dev libpopt-dev libmysqlclient-dev libcurl4-openssl-dev libsasl2-dev libldap2-dev apache2-dev php5-dev postfix-dev libdspam7-dev libopendkim-dev libncurses5-dev
</pre>
* Install a few more dependencies:
<pre>
apt-get build-dep mysql-server curl cyrus-sasl2 postfix dspam opendkim
</pre>
h2. Prepare JDK 7
* Install the Java Development Kit 7:
<pre>
sudo apt-get install openjdk-7jdk
</pre>
* Fix the Java path:
<pre>
sudo mkdir -p /usr/local/java/bin/java
sudo ln -s /usr/bin/java /usr/local/java/bin/java
</pre>
* Download JDK 7u60 locally then upload the local copy to the Zimbra server:
<pre>
scp -P 4440 ~/Downloads/jdk-7u60-linux-x64.tar.gz user@zimbra.example.com:/home/user/
</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
</pre>
* Now, download JCE 6 locally, then upload the local copy to the Zimbra server:
<pre>
scp -P 4440 ~/Downloads/jce_policy-6.zip user@zimbra.example.com:/home/user/
</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>
sudo apt-get install ant
</pre>
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.18 /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.
* Create the zimbra directory and change the ownership
<pre>
mkdir -p /opt/zimbra
chown user /opt/zimbra
</pre>
* 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