Open-Xchange™ on FreeBSD HOWTO

Peter Schober

Vienna University Computer Center
Revision History
Revision 0.12004-09-23
First release, for OX 0.7.2
Revision 0.1.12004-10-11
Revision 0.22005-02-19
Updated required ports and part of the software (e.g. native JDK 1.4.2, etc.). Minor updates for OX 0.8beta1
Revision 0.2.12005-03-03

Abstract

This document describes the steps sufficient for me to run Open-Xchange (OX) on FreeBSD. YMMV. All the usual disclaimers apply. Also note that there are new releases every once in a while and OX is still very much a moving target, so be sure to check the CHANGES file.


Table of Contents

Required reading
System requirements
Miscellaneous
Java & Tomcat
Perl
Ant
Postgresql
Apache
LDAP
Install
Changes for FreeBSD
Famous last words

Required reading

This document was based on others' GNU/Linux specific documentation and contains the parts which are different or need to be changed for installing OX in a FreeBSD environment.

Specifically the following documents have been used in successfully completing the install on FreeBSD:

System requirements

While I'll assume a working install of FreeBSD 5 there's nothing specific to this release in this document.

You'll need the following ports for OX (these will pull in quite a few others as well):

Miscellaneous

  • shells/bash

  • security/sudo

Java & Tomcat

Installing Java™ on FreeBSD is a bit complicated (some may say insanely complicated), mostly because of the way too restrictive license requirements by it's creator.

I built a native JDK 1.4.2 following two aricles: the FreeBSD Java™ Project pages are a bit terse for my taste, but you'll get there if you follow Java™ and Jakarta Tomcat on FreeBSD, eventually recompiling your kernel on the way. Also note that you'll need quite some time/patience and scratch space for building a native JDK.

Perl

  • devel/p5-Storable

  • devel/p5-Time-Local

  • net/p5-URI

  • net/p5-perl-ldap

  • www/p5-CGI.pm

  • converters/p5-MIME-Base64

  • converters/p5-Convert-ASN1

  • security/p5-Net-SSLeay

  • security/p5-Digest-MD5

  • security/p5-Authen-SASL

  • security/p5-IO-Socket-SSL

  • textproc/p5-XML-NamespaceSupport

  • textproc/p5-XML-SAX-Base

Ant

  • devel/apache-ant

Postgresql

  • databases/postgresql80-server or databases/postgresql74-server. Or just use any idle external Postgres server.

  • There is databases/postgresql-jdbc, but this is version 8.0 and still seems to have a few problems so I used pg74.215.jdbc3.jar from jdbc.postgresql.org which works fine with either Postgresql 7.4 or 8.0.

Apache

  • www/apache13[-modssl[+ipv6]]. Didn't try with Apache2, but should work

  • www/mod_jk since www/mod_jk2 is officially unsupported as of Nov 2004

LDAP

Use an external LDAP server. Or use the port in net/openldap22-[sasl-]server with the following changes:

  1. You need to compile WITH_ACI because OX seems to make use of this feature, even though the OpenLDAPacisyntax is vendor-specific>” and the OX site explicitly says OX should work with any LDAP server. Hm...

  2. Change all ACLs in slapd.conf that contain regular expressions from dn to dn.regex since the default dnstyle changed from version 2.1 to 2.2 from regex to exact -- SLOX (from which OX stems) shipped with OpenLDAP 2.1. See the respective OpenLDAP Faq-O-Matic entry for more info.

Also the new peername.ip style in ACLs is much easier to read and maintain. OX still uses version 2.1 notation like 'by peername="ip=127\.0\.0\.1" read' -- compare this to the much cleaner 'by peername.ip="127.0.0.1" read'.

Finally: If you're all confused about ACLs read the Administrator's Guide and the FAQ entry on ACLs. Or dive right into man slapd.conf.

Install

Now install and configure everything according to the INSTALL file or check with Laurent's or Sietse's HOWTO. Below you'll find the parts that need to be changed for OX to compile and run on FreeBSD:

Changes for FreeBSD

Note that this might not be a complete list, just apply a bit common sense and things will go smoothly. I'll refer to the sections as used by Laurent:

Section “Pre-Install / Java stuff

The Java Servlet Development Kit 2.0 (jsdk.jar) is not needed. For Tomcat 5 use common/lib/servlet-api.jar, for Tomcat 4 it's servlet.jar.

Section “Installation

When actually installing OX first do a ./configure --help to see what's available. E.g. --with-dbhost=DBHOST for an external Postgres server, --with-runuid=www and --with-rungid=www since apache runs as user www on FreeBSD.

Section “Post-Installation

Login.pl

www/apache13's cgi-bin is in /usr/local/www/cgi-bin/ but you could use something else and tell Apache about it in /usr/local/etc/apache/httpd.conf.

Servlets

My web.xml file looks like the one in the INSTALL file.

mod_jk

Put something like this in /usr/local/etc/apache/mod_jk.conf and add Include /usr/local/etc/apache/mod_jk.conf to /usr/local/etc/apache/httpd.conf (Just copy /usr/local/etc/apache/mod_jk.conf.sample to mod_jk.conf and change the hostname):

# Replace HOST with the hostname of your JSP server, as
# specified in workers.properties.
<IfModule mod_jk.c>
    JkWorkersFile /usr/local/etc/apache/workers.properties
    JkLogFile  logs/jk.log
    JkLogLevel warn

    # Sample JkMounts.  Replace these with the paths you would
    # like to mount from your JSP server.
    JkMount /servlet/* HOST
    JkMount /servlet/webdav.contacts* HOST
</IfModule>

Then add something like this to /usr/local/etc/apache/workers.properties (I copied /usr/local/etc/apache/workers.properties.sample to workers.properties, changed the hostname and added the last two lines):

# Change HOST to the hostname of your JSP server.
#
worker.list=HOST

worker.HOST.port=8009
worker.HOST.host=HOST
worker.HOST.type=ajp13
worker.HOST.lbfactor=1

workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java
Postgresql

The postgres user is called pgsql, so su - pgsql when doing any Postgres work (like adding users or databases with createuser -A -D -P -E ox or createdb -E unicode -O ox ox).

Create a user

Before you can create a user for OX you have to change a few scripts in $OX_INSTALL/sbin (where $OX_INSTALL defaults to /usr/local/open-xchange if you didn't supply some --prefix to ./configure).

Most files in $OX_INSTALL/sbin have #!/bin/bash as their command interpreter but FreeBSD's bash is in /usr/local/bin/bash. You can either change all these scripts or simply create a symbolic link from /usr/local/bin/bash to /bin/bash.

Website files

www/apache13's DocumentRoot is in /usr/local/www/data/ but you could provide your own and tell Apache about it. Create cfintranet/webmail with mkdir -p there.

The Filespool

sbin/correctfilespool has #!/bin/sh as it's command interpreter, but rather expects this so be some kind of bash, not plain Bourne shell. So change this to #!/usr/local/bin/bash.

Also sbin/correctfilespool uses GNU seq to count from 0 to 255, so either install the GNU sysutils/coreutils and replace all orrurances of seq with gseq or simply replace the whole seq 0 255 with jot 256 0, which does the same and comes with FreeBSD.

Go!

Before starting OX you'll have to edit $OX_INSTALL/etc/init.d/sessiond, etc/init.d/groupware and etc/init.d/webmail because FreeBSD's ps expects keywords in a different syntax than GNU/Linux's ps. Replace all ps xao "%p %a" with ps xao "pid args".

Famous last words

Thanks for all the fish” go to FreeBSD kernel hacker le (who's to blame for my dabbling with FreeBSD) and rm (without whom I never would have to deal with SLOX/OX/NOX at all).