Building FRANKLIN on Debian

From Zimbra :: Wiki

Jump to: navigation, search
   Article-alert.png  - This article is a Work in Progress, and may be unfinished or missing sections.



Contents

Introduction

This should also work on Debian 4.0 Etch x86 although you can simply ingore everything about _64 as Debian x86 is already a supported platform.

As the precomiled package of Zimbra Open Source 5.0 for Debian Etch 4.0 is x86 (32bit) only and I didn't want to use Zimbra in 32bit mode as I had got Debian AMD64 I decided to download the source and compile it myself. I found it quite a learning-curve and it is quite possible that i have missed a necesary pre-requesite as it was a few days ago now, here are the steps that I took to get Zimbra 5.0 working.

Firstly, assuming you are starting with an empty machine, I installed just the base system and then booted into it. Make sure you pay special attention to the partitioning section as it is unlikely the the default settings will give you a usable Zimbra server. You must ensure that you have plenty of space in /home (for the source tree) and in /opt for the build and eventually to install. As an absolute minimum, you will need 5GB in /home and 1GB in /opt (although you will want more if you intend to install Zimbra on the same machine.

**WARNING** Do not attempt to build Zimbra on a machine with an exisiting Zimbra installation as the first command that the build runs is "rm -r /opt/zimbra" which would be VERY BAD if you had a working Zimbra installation already in there!

Starting the build

Remove exim

Once you have a base Debian system, I recommend as a first step to stop/remove and disable exim4 as if you forget to do it you will be scratching your head later as to why mta won't start. You can ignore this step if this machine is just used for the build and you will not be installing Zimbra on it.

$ /etc/init.d/exim4 stop
$ aptitude remove exim4
$ mv /etc/init.d/exim4 /etc/init.d/exim4.old

Pre-requisites

Next you need to ensure that various packages are installed. The lsb package alone will install MANY MANY dependencies, I am not sure if lsb is actually required but it does install all of the necessary build tools.

$ aptitude install lsb libtool libltd13-dev zlib-bin flex libpcre3-dev g++ libncurses5-dev libperl-dev zlibc sudo fetchmail libgmp3c2 openssl 

Perforce

You then then to download Perforce, personally I put the p4 binary in the /usr/local/bin directory but it is up to you. You should visit http://www.perforce.com/perforce/downloads/platform.html first and accept the disclaimer before downloading.

$ wget http://www.perforce.com/downloads/perforce/r08.1/bin.linux26x86_64/p4 

Then configure the Perforce settings:

$ export P4EDITOR=nano 
$ export P4PORT=codes.zimbra.com:2666
$ export BUILD_HOME="/home/public/p4/zcs

Source Tree

Then you can try to download the source:

$ p4 -u public -P public1234 -c public-view sync //depot/zcs/FRANKLIN/...

I found that this didn't download everything so I then did this to fully re-sync the tree:

$ p4 -u public -P public1234 -c public-view sync -f //depot/zcs/FRANKLIN/...

Sun JDK

Next you need to download JDK1.5 (not sure if 1.6 now works, hopefully somebody else can confirm?) from http://java.sun.com/javase/downloads/index_jdk5.jsp once you have downloading you need to extract and then:

$ mv /path/to/extraction/(name) /usr/local/
$ ln -s /usr/local/(name)/  /usr/local/java

Then configure the java environment:

$ export JAVA_HOME=/usr/local/java
$ export PATH=$PATH:$JAVA_HOME/bin


Apache Ant

Apache Ant is needed to build/compile Zimbra Collaboration Suite. You can download the latest version of Ant free from Apache here: http://ant.apache.org/bindownload.cgi

once you have downloaded and extracted Ant, move the Ant installation to the correct location and make a symlink:

$ mv /path/to/extraction/(name) /usr/local/
$ ln -s /usr/local/(name)/  /usr/local/ant

Then add Ant to your path and set the ANT_HOME variable.

$ export ANT_HOME=/usr/local/ant
$ export PATH=${PATH}:${ANT_HOME}/bin

Add Users

In order to successfully build postfix, you must create a postfix user and group as follows, you might as well also create a zimbra user/group as this will also be required:

$ groupadd postdrop
$ groupadd postfix
$ groupadd zimbra
$ useradd -g postfix postfix
$ useradd -g zimbra zimbra
$ mkdir -p /opt/zimbra
$ usermod -d /opt/zimbra zimbra

Unfortunately, this is not the end, it isn't even the beginning of the end, in fact it is barely the end of the beginning! Sorry for Paraphrasing Winston Churchill but the next step is by far the most painful and will take a long time.

Thirdparty Tools

Welcome to the ThirdParty tools. They are (currently) 26 seperate software packages that form that basis of the Zimbra system. They are all compiled and repackaged using a single command. I will try to make this a bit easier for you than it was for me but as the whole process can take a very time, it is pretty annoying when it fails half way through.

There are a number of files that will need changing to recognise the fact that you are running on Debian AMD64. All of the files below are shown as relative to $BUILD_HOME/$RELEASE directory (usually /home/public/p4/FRANKLIN)

Most of the Makefiles call ZimbraBuild/rpmconf/Build/get_plat_tag.sh this has already been edited to recognise the build platform and should recognise your enviroment as DEBIAN4.0_64. It is worth running the following just to make sure:

$ ZimbraBuild/rpmconf/Build/get_plat_tag.sh 

Makefile Changes

Now you need to tell the ThirdParty/buildThirdParty.sh script to recognise the DEBIAN4.0_64 platform, you will find a line like this:

elif [ x$PLAT = "xUBUNTU6_64" -o x$PLAT = "xUBUNTU8_64" ]; then

Change this line to this:

elif [ x$PLAT = "xUBUNTU6_64" -o x$PLAT = "xUBUNTU8_64" -o x$PLAT="xDEBIAN4.0_64" ]; then


Next you need to edit some of the makefiles to include DEBIAN4.0_64. These are the specific Zimbra package Makefile's. The most notable are the following:

ThirdParty/expat/Makefile
ThirdParty/openssl/Makefile
ThirdParty/pcre/Makefile
ThirdParty/popt/Makefile
ThirdParty/tcmalloc/Makefile

I found that expat and popt have a line:

build_DEBIAN4.0: ;

I added a line directly below it:

build_DEBIAN4.0_64: ;

prce contains a line:

deploy_DEBIAN4.0: ; 

I added a line directly below it:

deploy_DEBIAN4.0_64

openssl and tcmalloc as 'slightly' more complicated, there is a section if ifeq/endif statements. You need to add these as follows:

For openssl add:

ifeq ($(BUILD_PLATFORM), DEBIAN4.0_64)
        PLAT := linux-x86_64
endif

For tcmalloc add:


ifeq ($(BUILD_PLATFORM), DEBIAN4.0_64)
        CONF_OPS := --enable-frame-pointers
endif

Once you have made these changes, you 'should' be able to do this (from within the ThirdParty directory):

Building the tools

** WARNING ** Please ensure that you have NOTHING of value in the opt/zimbra directory as it will be DELETED!

$ ThirdParty/buildThirdParty.sh

If any of these packages fail then I found it easier to cancel the build (CTRL-C) and then cd to the package directory itself and run "make" This will enable you to see why it failed. You may find some dependencies missing (libraries etc) and you will need to install these with apt-get/aptitude.

If, after about an hour or so, all of the packages build correctly, you can progress to the next step.....

Building The Zimbra Package

Firstly you need to create a 'defs' file:

$ cd ZimbraBuild/defs
$ cp UBUNTU8_64.def  DEBIAN4.0_64.def

You shouldn't need to edit the file unless you did (like me) use a slightly different version of Java (I like to live dangerously) The default version is 1.5.0_15. I used 1.5.0_16 as this was the latest version of the 1.5 branch so you will need to change the JAVA_VERSION definition in DEBIAN4.0_64.def accordingly.

Re-package JVM

Next you will need to re-package your java virtual machine as follows:

$ cd /usr/local
$ tar zcf /home/public/p4/FRANKLIN/ThirdPartyBuilds/x86_64/java/jdk1.5.0_15.tgz jdk1.5.0_15 (use the correct version numbers!)


Running the build

Next you can build Zimbra!

$ cd /home/public/p4/FRANKLIN/ZimbraBuild
$ make

If it worked you should have a directory called zcs-VERY_LONG_VERSION_STRING which will have the full Zimbra installer (./install.sh) and all required packages etc.

If (like mine) it failed, I found that a number of ThirdParty packages had not been compiled automatically. You simply need to cd to the ThirdParty package directory that it tells you is missing and then run "make" in this directory, then return to the ZimbraBuild directory and run "make". I had to do this a few times. Maybe somebody that knows the Zimbra build system a bit better than me knows why this is but eventually you should get a successful build.

If you then want to install zimbra on the same machine, you will probably want to remove the /opt/zimbra build directory before running ./install.sh.

Good Luck!

--Philetaylor 19:00, 30 September 2008 (UTC)


Verified Against: Unknown Date Created: 9/30/2008
Article ID: http://wiki.zimbra.com/index.php?title=Building_FRANKLIN_on_Debian Date Modified: 10/13/2008
Personal tools