Difference between revisions of "Zimbra on FreeBSD"

Line 93: Line 93:
  
 
Grats, you just saved yourself a lot of time.
 
Grats, you just saved yourself a lot of time.
 +
 +
==Quick-hacks for a better day==
 +
Since Zimbra is Linux lover by nature everything is /bin/bash
 +
 +
http://zimbra.imladris.sk/download/patches/GNR-601.FreeBSD.patch
 +
patch -p1 -Es < ../GNR-601.FreeBSD.patch
 +
 +
==Patching GNR-601 to comply with FreeBSD==
 +
This is a complete rework of GNR-601 source tree and it sometimes makes things better than the original. Some notable changes:
 +
 +
'''1) openssl, bdb, libtool, popt, expat, pcre, libxml2, tcmalloc are used from base system.'''
 +
 +
Rest is too Zimbra specific and would be of no other use on the system.
 +
 +
'''2) most perl modules are used from base system.''' Those left unchanged are:
 +
 +
''Getopt::Easy'' - not in /usr/ports and it's not really used at all besides one tiny script (no idea why not using Getopt::Long like usual).
 +
 +
''DBD::mysql'' - mysql specific includes/libs not part of base
 +
 +
''Net-LDAPapi'' - ldap/cyrus-sasl specific includes/libs not part of base
 +
 +
''Mail-SpamAssassin'' - requires different datadir
 +
 +
 +
'''3) FreeBSD specific includes in ''ZimbraBuild/defs/FreeBSD*'' and ''ZimbraBuild/defs/ThirdParty/*'''''
 +
 +
'''4) package generation is handled by pkg_create so we install real packages.'''
 +
 +
'''5) complete rework of PRE-INSTALL/POST-INSTALL/DEINSTALL scripts.'''
 +
 +
'''6) every ''su - zimbra -c'' call has been replaced by ''sudo -u zimbra -i -- -c'' call because su+bash is hitting a race condition on FreeBSD-7.2 (and other systems.. like Linux) which causes libexec/* scripts to hang up indefinitely (GOD, THIS TOOK ME A YEAR OF LIFE). Funny that the same bug appears on both my tested systems, while it doesn't appear on my FreeBSD-7.2 zimbra-5.0.16 installation (even the same command is okay to run).'''
 +
 +
'''7) Zimbra is FreeBSD aware!'''
  
 
==Building Zimbra Collaboration Suite: "GNR-601"==
 
==Building Zimbra Collaboration Suite: "GNR-601"==

Revision as of 23:46, 4 October 2009

General Information

The perforce cache gives users access to download and build/modify Zimbra source code for Open Source products. Building Zimbra Collaboration Suite from Zimbra's Perforce cache requires advanced knowledge of troubleshooting. It is not available for Network Edition components. Changes cannot be committed to the Perforce cache.

By building Zimbra, you agree to Zimbra's licensing terms. Building from source is not covered under the ZEUL, unlike pre-compiled binaries, but rather the YPL.

Technical support for source building can be found in the Zimbra Developers forum.

This guide describes building and installing zimbra-6.0.0+ (GNR) on FreeBSD-7.2_amd64. Trying to install on a different version (that means older than 7.2-RELEASE) is not advised and not covered.

Zimbra does not support FreeBSD operating system out of the box and there are no plans for the future support (or so we all heard). I tried to integrate FreeBSD into source tree as much as possible so the same version should compile fine on other supported systems.

At this point it's good to note that everything should be run as root unless stated otherwise.

Getting the source via Perforce

You need to install Perforce either from /usr/ports:

cd /usr/ports/devel/perforce && make install distclean

or fetch perforce package from my repository:

fetch http://zimbra.imladris.sk/download/packages/GNR/FreeBSD-7.2/amd64/perforce-08.2_5,1.tbz
pkg_add perforce-08.2_5,1.tbz

If you are using a csh derivate shell, which is the FreeBSD default, run:

rehash

Get the source:

setenv P4PORT codes.zimbra.com:2666
mkdir -p /home/public/p4
p4 -u public -P public1234 -c public-view sync -f //depot/zcs/GNR-601/...

The source is about 587 MB so it may take some time if you are sitting in the middle of Alaska.

Getting the source from my repository

GNR-601-src.tar.gz

mkdir -p /home/public/p4 && cd /home/public/p4
fetch http://zimbra.imladris.sk/download/src/GNR-601-src.tar.gz
tar vxzf GNR-601-src.tar.gz

The unpacked source is about 587 MB so it may take some time if you aren't sitting on gigabit line.

Initial pre-build steps

Let's check our system:

solko@[blurp /home/public/p4/GNR-601] # uname -a
FreeBSD blurp.euba.sk 7.2-RELEASE-p4 FreeBSD 7.2-RELEASE-p4 #0: Sun Oct  4 10:52:43 CEST 2009  

Let's check our /etc/make.conf:

solko@[blurp /home/public/p4/GNR-601] # cat /etc/make.conf
COPTFLAGS= -O2 -pipe
CFLAGS= -O2 -fno-strict-aliasing -pipe
CPUTYPE?=core2

Preparing build enviroment via /usr/ports

I created a simple "meta" ports which will take care of everything. Since I am a very very creative person I named those: mail/zimbra-rundeps and mail/zimbra-builddeps.

The first installs all dependencies needed to run GNR-601 while the second installs all dependencies needed to build GNR-601. For reasons vastly uknown the second requires the first one.

cd /usr/ports/mail
fetch http://zimbra.imladris.sk/download/ports/usrports_zimbra-rundeps.tar.gz && \
    tar vxzf usrports_zimbra-rundeps.tar.gz && \
        rm -f usrports_zimbra-rundeps.tar.gz
fetch http://zimbra.imladris.sk/download/ports/usrports_zimbra-builddeps.tar.gz && \
    tar vxzf usrports_zimbra-builddeps.tar.gz && \
        rm -f usrports_zimbra-builddeps.tar.gz
cd /usr/ports/mail/zimbra-rundeps && make config-recursive install distclean
cd /usr/ports/mail/zimbra-builddeps && make config-recursive install distclean

If you are able to use /usr/ports you should be able to figure out the configure options (not that it matters much, mostly unimportant stuff). Be warned that GNR-601 requires jdk15 to build while requiring jdk16 to run so you will end up having both. Building diablo-jdk requires downloading java stuff. How boring! There are also those 64 perl modules..

Preparing build enviroment via my repository

Since some people likes to compile (me me me!) and others like to install-only I built all the neccessary packages.

cd /tmp && mkdir -p DELME && cd DELME && fetch http://zimbra.imladris.sk/download/packages/GNR/FreeBSD-7.2/FreeBSD-7.2_amd64_packages.tar.gz
tar vxzf FreeBSD-7.2_amd64_packages.tar.gz && cd amd64
pkg_add zimbra-builddeps-6.0.1.tbz

You need to accept diablo-jdk license twice (jdk15+jdk16).

Grats, you just saved yourself a lot of time.

Quick-hacks for a better day

Since Zimbra is Linux lover by nature everything is /bin/bash

http://zimbra.imladris.sk/download/patches/GNR-601.FreeBSD.patch patch -p1 -Es < ../GNR-601.FreeBSD.patch

Patching GNR-601 to comply with FreeBSD

This is a complete rework of GNR-601 source tree and it sometimes makes things better than the original. Some notable changes:

1) openssl, bdb, libtool, popt, expat, pcre, libxml2, tcmalloc are used from base system.

Rest is too Zimbra specific and would be of no other use on the system.

2) most perl modules are used from base system. Those left unchanged are:

Getopt::Easy - not in /usr/ports and it's not really used at all besides one tiny script (no idea why not using Getopt::Long like usual).

DBD::mysql - mysql specific includes/libs not part of base

Net-LDAPapi - ldap/cyrus-sasl specific includes/libs not part of base

Mail-SpamAssassin - requires different datadir


3) FreeBSD specific includes in ZimbraBuild/defs/FreeBSD* and ZimbraBuild/defs/ThirdParty/*

4) package generation is handled by pkg_create so we install real packages.

5) complete rework of PRE-INSTALL/POST-INSTALL/DEINSTALL scripts.

6) every su - zimbra -c call has been replaced by sudo -u zimbra -i -- -c call because su+bash is hitting a race condition on FreeBSD-7.2 (and other systems.. like Linux) which causes libexec/* scripts to hang up indefinitely (GOD, THIS TOOK ME A YEAR OF LIFE). Funny that the same bug appears on both my tested systems, while it doesn't appear on my FreeBSD-7.2 zimbra-5.0.16 installation (even the same command is okay to run).

7) Zimbra is FreeBSD aware!

Building Zimbra Collaboration Suite: "GNR-601"

GNR-601 is the latest 6.0 series release. Current version & changelist can be found on Pmweb


Troubleshooting

Huh. Problems? Why?

--Solko 22:36, 4 October 2009 (UTC)

Jump to: navigation, search