Personal tools
You are here: Home Open-Xchange Open-Xchange™ on Mac OS X Tiger
Google Ad
Log in


Forgot your password?
 

Open-Xchange™ on Mac OS X Tiger

Disclaimer


I am not responsible of possible data losses caused by the use of this guide.

I wrote this after installing Open-Xchange. I do not have a spare machine to test this guide. If something does not make sense you may contact me.

License

Copyright (c) 2005 Jordi Yeh.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".



Requirements

  • Mac OS X Tiger with XCode Tools installed.
  • IMAP Server and MTA running.
  • DarwingPorts
    • Download the dmg file, and follow the instruction on the Read Me file.
    • Update the ports by running the following command
      • sudo port -d selfupdate
      • sudo port install wget

Installing Open-Xchange Requirements

  • Apache-Ant

    • sudo port install apache-ant
  • Tomcat

    • sudo port install tomcat5
      • # Configuration files in /opt/local/share/java/tomcat5/conf have been
        # installed with a .sample extension so that they won't be replaced by a
        # port update. Each will be copied to its proper location during the
        # first startup of tomcat by catalina.sh or tomcatctl if you don't
        # do this yourself first. If this _is_ an update, you might do a diff to
        # verify that you're not missing anything in the newer .sample versions
        # of these files.
        #
        # The script /opt/local/share/java/tomcat5/bin/tomcatctl has been installed to
        # facilitate start and stop of tomcat using the jsvc utility, which allows you to
        # start tomcat as a true daemon process. Once tomcat has acquired its TCP socket,
        # jsvc will drop its root privileges and run as user www.
  • Perl dependencies

    • Install the following Perl modules. If you need any assistance with this, please check the perl.com FAQ site. Note that I am installing the Perl modules shipped with Mac OS X, whcih as of writting is perl version 5.8.6. I installed the Perl modules via CPAN.
      • Authen::SASL -- 2.09
        CGI -- 3.10
        Convert::ASN1 -- 0.19
        Digest::MD5 -- 2.33
        IO::Socket::SSL -- 0.96
        MIME::Base64 -- 3.05
        Net::LDAP -- 0.33
        Net::SSLeay -- 1.25
        Storable -- 2.15
        Time::Local -- 1.11
        XML::NamespaceSupport -- 1.09
        XML::SAX::Base -- 1.02
  • Postgresql and the JDBC driver

    • sudo port install postgresql8 +server
    • sudo port install postgresql-jdbc
      • Making sure that postgres8 user has been created.
        • nidump passwd . | grep postgres
        • This will result in something like:

          • postgres8:********:504:504::0:0:postgres administrator:/Users/postgres8:/bin/bash
      • Let's prepare the database
        • sudo mkdir -p /opt/local/var/pgsql/data
        • sudo chown postgres8 /opt/local/var/pgsql/data
        • sudo su -l postgres8
        • /opt/local/lib/pgsql8/bin/initdb -D /opt/local/var/pgsql/data/
        • sudo -u postgres8 /opt/local/lib/pgsql8/bin/pg_ctl -D /opt/local/var/pgsql/data -l /opt/local/var/pgsql/data/logfile start
        • Testing that the database works
          • /opt/local/lib/pgsql8/bin/createdb test
          • /opt/local/bin/psql8 test
          • create table foo (name varchar, foo_id serial);
          • ^D
          • /opt/local/lib/pgsql8/bin/createuser --pwprompt
            Enter name of user to add: openexchange

            Enter it again: your-password

            Shall the new user be allowed to create databases? (y/n) y

            Shall the new user be allowed to create more new users? (y/n) n

            CREATE USER


          • /opt/local/lib/pgsql8/bin/createdb -O openexchange -E UNICODE openexchange
            CREATE DATABASE
          • exit
  • OpenLDAP

    • Darwinports does not seem to compile with aci support, so let's add it before proceeding.
    • cd /opt/local/var/db/dports/sources/rsync.rsync.opendarwin.org_dpupdate_dports/databases/openldap
    • Add --enable-aci after the configure.args in the Portfile file.
      • diff -u Portfile Portfile.ox
        --- Portfile    2005-07-02 07:55:36.000000000 -0400

        +++ Portfile.ox 2005-07-02 07:55:22.000000000 -0400

        @@ -29,6 +29,7 @@




         configure.args --mandir=${prefix}/share/man \

                        --localstatedir=${prefix}/var/run \

        +               --enable-aci \
        + --enable-crypt \





         default_variants \

                        +ssl +tcpd
    • sudo port install openldap
  • Apache2 and mod_jk connector

    • sudo port install mod_jk
    • Note: This will install apache 2 and required dependencies.
  • JavaMail API

  • JavBeans Activation Framework

  • JDOM

  • Environment variables

    • Edit /etc/profile and add the following after the line that says "export PATH"
    • sudo nano -w /etc/profile
    • # System-wide .profile for sh(1)

      PATH="/bin:/sbin:/usr/bin:/usr/sbin"
      export PATH

      JAVA_HOME=/Library/Java/Home
      CATALINA_HOME=/opt/local/share/java/tomcat5
      ANT_HOME=/opt/local/share/java/apache-ant
      OX_HOME=/opt/local/openxchange
      APACHE2_HOME=/opt/local/apache2

      TOMCAT_HOME=$CATALINA_HOME
      PATH=$PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin:$ANT_HOME/bin:$OX_HOME/bin:$OX_HOME/sbin:$APACHE2_HOME/bin
      export PATH JAVA_HOME CATALINA_HOME ANT_HOME OX_HOME TOMCAT_HOME APACHE2_HOME


      if [ "${BASH-no}" != "no" ]; then
      [ -r /etc/bashrc ] && . /etc/bashrc
      fi


Installing Open-Xchange

  • Get the sources from Open-Xchange's download site
    • tar zxfv open-xchange-X.X.X-X.tar.gz
    • cd open-xchange-X.X.X-X
    • ./configure \

      --prefix=/opt/local/openxchange --with-mailjar=/opt/local/share/java/mail.jar \
      --with-activationjar=/opt/local/share/java/activation.jar \
      --with-jdomjar=/opt/local/share/java/jdom.jar \
      --with-xercesjar=/opt/local/share/java/xercesImpl.jar \
      --with-jsdkjar=/opt/local/share/java/servlet24-api.jar \
      --with-jdbcjar=/opt/local/share/java/pg74.216.jdbc3.jar \
      --with-htdocsdir=/opt/local/apache2/htdocs \
      --with-cgibindir=/opt/local/apache2/cgi-bin \
      --with-runuid=www --with-rungid=www \
      --with-domain=example.com --with-organization="Example Organization" \
      --with-basedn="dc=example,dc=com" \
      --with-rootdn="cn=Manager,dc=example,dc=com" \
      --with-dbname=openexchange --with-dbuser=openexchange \
      --with-dbpass=your-db-password --with-dbhost=127.0.0.1 \
      --enable-webdav
    • make
    • sudo make install
  • Database Initialization
    • sudo su -l postgres8
    • /opt/local/bin/psql8 -U openexchange openexchange < /opt/local/openxchange/share/init_database.sql
    • /opt/local/bin/psql8 -U openexchange openexchange
    • INSERT INTO sys_gen_rights_template values ('now','admin','now','','default_template','y','y','y','y', 'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y');
      INSERT 17762 1
    • \q
  • OpenLDAP setup
    • sudo nano -w /opt/local/etc/openldap/slapd.conf
    • Make the following changes, so your slapd.conf will look somehat like this one
      • include         /opt/local/etc/openldap/schema/core.schema
        include /opt/local/etc/openldap/schema/cosine.schema
        include /opt/local/etc/openldap/schema/nis.schema
        include /opt/local/etc/openldap/schema/inetorgperson.schema
        include /opt/local/openxchange/share/openxchange.schema

        pidfile /opt/local/var/run/openldap-data/slapd.pid
        argsfile /opt/local/var/run/slapd.args

        allow bind_v2

        #######################################################################
        # BDB database definitions
        #######################################################################

        database bdb
        suffix "dc=example,dc=com"
        rootdn "cn=Manager,dc=example,dc=com"
        rootpw <your-ldap-password>

        directory /opt/local/var/run/openldap-data

        index objectClass eq

        index uid,mailEnabled,cn,sn,givenname,lnetMailAccess,alias,loginDestination eq,sub
        index memberUid eq

        access to dn.subtree="ou=Users,ou=OxObjects,dc=example,dc=com"
        by self write
        by users write
        by anonymous auth

        access to dn.subtree="ou=Groups,ou=OxObjects,dc=example,dc=com"
        by self write
        by users write
        by anonymous auth

    • sudo nano -w  /opt/local/etc/openldap/ldap.conf
      • BASE dc=example,dc=com
        #URI localhost
        URI ldap://localhost
        HOST localhost

        Note that there should not be any spaces in between dc=example,dc=com. See bug 789
    • perl -e 'print crypt("mailadmin-password",pack("C2",(int(rand 26)+65),(int(rand 26)+65)))."\n";'
      The result will be something similar to SXSDb%BqC/qa4

         

    • sudo nano -w /opt/local/openxchange/share/init_ldap.ldif
      • Change the scret word to the generated password:
        • From:
          shadowExpire: 0
          userPassword: secret
          OXAppointmentDays: 5
        • To:
          shadowExpire: 0
          userPassword: {CRYPT}SXSDb%BqC/qa4
          OXAppointmentDays: 5
      • sudo /opt/local/etc/rc.d/slapd.sh start
      • sudo /opt/local/sbin/slapadd -l /opt/local/openxchange/share/init_ldap.ldif
      • sudo ln -s /opt/local/etc/openldap/ldap.conf /opt/local/openxchange/etc/groupware/ldap.conf
      • sudo ln -s /opt/local/etc/openldap/ldap.conf /opt/local/openxchange/etc/webmail/ldap.conf
  • Configuring Tomcat:
      • sudo nano -w /opt/local/share/java/tomcat5/bin/catalina.sh
        • Add the JAVA_HOME And JAVA_OPTS lines:
          # -----------------------------------------------------------------------------

          JAVA_HOME="/Library/Java/Home/"

          JAVA_OPTS="-Dopenexchange.propfile=/opt/local/openxchange/etc/groupware/system.properties"


          # OS specific support.  $var _must_ be set to either true or false.

      • sudo cp /opt/local/share/java/tomcat5/conf/tomcat-users.xml.sample /opt/local/share/java/tomcat5/conf/tomcat-users.xml
        • Check tomcat-users.xml look like the following
          <?xml version='1.0' encoding='utf-8'?>
          <tomcat-users>
          <role rolename="tomcat"/>
          <role rolename="role1"/>
          <role rolename="manager"/>
          <user username="tomcat" password="tomcat" roles="tomcat"/>
          <user username="both" password="tomcat" roles="tomcat,role1"/>
          <user username="role1" password="tomcat" roles="role1"/>
          <user username="admin" password="your-tomcat-password" roles="manager"/>
          </tomcat-users>
      • sudo mkdir -p /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/classes
      • sudo mkdir -p /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/lib
      • sudo cp /opt/local/openxchange/share/servlets/*.class /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/classes/
      • sudo cp /Users/shiao/ox/open-xchange-0.8.0-4/system/servlet/web.xml /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/
      • sudo cp /opt/local/openxchange/lib/*.jar /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/lib/
      • sudo cp /opt/local/share/java/jdom.jar /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/lib/
      • sudo cp /opt/local/share/java/pg74.216.jdbc3.jar /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/lib/
      • sudo cp /opt/local/share/java/activation.jar /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/lib/
      • sudo cp /opt/local/share/java/mail.jar /opt/local/share/java/tomcat5/webapps/servlet/WEB-INF/lib/
      • sudo cp /opt/local/openxchange/lib/umin.war /opt/local/share/java/tomcat5/webapps/
      • sudo /opt/local/share/java/tomcat5/bin/tomcatctl start
  • Configuring apache2
    • sudo nano -w /opt/local/apache2/conf/workers.properties
      • The file should look something like this:

        worker.list=localhost
        worker.localhost.port=8009
        worker.localhost.host=localhost
        worker.localhost.type=ajp13
        worker.localhost.lbfactor=1
        workers.tomcat_home=/opt/local/share/java/tomcat5
        workers.java_home=/Library/Java/Home/
    • sudo nano -w /opt/local/apache2/conf/httpd.conf
      • The file should look something like this (showing the changes)
      • ...
        LoadModule rewrite_module modules/mod_rewrite.so
        LoadModule jk_module modules/mod_jk.so
        ...
        <VirtualHost>
        ....
        </VirtualHost>

        <IfModule mod_jk.c>
        JkWorkersFile /opt/local/apache2/conf/workers.properties
        JkLogFile /opt/local/apache2/logs/mod_jk.log
        JkLogLevel warn
        JkMount /*.jsp localhost
        JkMount /servlet/* localhost
        JkMount /umin/* localhost
        JkMount /examples/* localhost
        JkMount /servlet/webdav.contacts* localhost
        </IfModule>


  • Fixing some Open-Xchange scripts
    • sudo nano -w /opt/local/openxchange/etc/init.d/openexchange 
      • Make sure that the folders are correct
        #! /bin/sh
        PROG_NAME="OX"

        groupware="/opt/local/openxchange/etc/init.d/groupware"
        webmail="/opt/local/openxchange/etc/init.d/webmail"
        sessiond="/opt/local/openxchange/etc/init.d/sessiond"


        case "$1" in
    • Comment su and uncomment sudo commands for sessiond, webmail, and groupware.
        • sudo nano -w /opt/local/openxchange/etc/init.d/sessiond
          • java_startproc() {
            if [ -n "$(java_pslist)" ]; then
            return 0
            fi
            sudo -u $USER $OX_SESSIOND_BIN >> $LOGFILE 2>&1 &
            #su $USER -s /bin/bash $OX_SESSIOND_BIN >> $LOGFILE 2>&1 &
            return 0
            }

        • sudo nano -w /opt/local/openxchange/etc/init.d/webmail
          • java_startproc() {
            if [ -n "$(java_pslist)" ]; then
            return 0
            fi
            sudo -u $USER $OX_BIN >> $LOGFILE 2>&1 &
            #su $USER -s /bin/bash $OX_BIN >> $LOGFILE 2>&1 &

            return 0
            }
        • sudo nano -w /opt/local/openxchange/etc/init.d/groupware
          • ava_startproc() {
            if [ -n "$(java_pslist)" ]; then
            return 0
            fi
            sudo -u $USER $OX_BIN >> $LOGFILE 2>&1 &
            #su $USER -s /bin/bash $OX_BIN >> $LOGFILE 2>&1 &

            return 0
            }
    • There are some scripts that seems to have hardcoded the java location, such as /opt/local/openxchange/sbin/addusersql_ox that expects that java to be in /bin/java. To fix this create a link:
        • sudo ln -s /Library/Java/Home/bin/java /bin
  • Adding a new user
    • Remove ldap:// from the ldap.conf file will help in adding a user to avoid ldap://ldap:// issues
      • Edit your ldap.conf
        sudo nano -w  /opt/local/etc/openldap/ldap.conf
      • Check the ldap.conf file. It should look something like:
        BASE dc=example,dc=com
        URI localhost
        #URI ldap://localhost
        HOST localhost
    • sudo /opt/local/openxchange/sbin/adduser_ox --username="your-user-name" --passwd="your-password" --name="your-first-name --sname="your-last-name" --maildomain="example.com" --ox_timezone="your-time-zone"
  • Create the startup scripts
    • sudo nano -w /opt/local/etc/rc.d/rc.local.sh
      • The file should look something like:
        #!/bin/sh
        NAME=rc.start
        PIDFILE=$NAME.pid
        CAT=/bin/cat
        KILL=/bin/kill

        case "$1" in

        start)
        sudo -u postgres /opt/local/lib/pgsql8/bin/pg_ctl -D /opt/local/var/pgsql/data -l /opt/local/var/pgsql/data/logfile start
        # Tomcat running using port 8080
        /opt/local/share/java/tomcat5/bin/catalina.sh start
        #Open-xchange
        /opt/local/openxchange/etc/init.d/openexchange start
        ;;

        stop)
        sudo -u postgres /opt/local/lib/pgsql8/bin/pg_ctl -D /opt/local/var/pgsql/data -l /opt/local/var/pgsql/data/logfile stop
        /opt/local/share/java/tomcat5/bin/catalina.sh stop
        /opt/local/openxchange/etc/init.d/openexchange stop
        ;;

        *)
        echo "Usage: /opt/local/etc/rc.d/$NAME {start|stop}"
        exit 1
        ;;
        esac

    • sudo chmod u+x /opt/local/etc/rc.d/rc.local.sh

Upgrades

Apache 2.0 to 2.2

These are the steps that may help you or not to upgrade Apache 2.0 to 2.2 You may find also useful the instructions from Apache.

  • sudo port -d selfupdate
  • cd /opt/local/apache2
  • sudo cp -Rp conf conf.bak
  • sudo port upgrade apache2
  • Make sure to edit /opt/local/apache2/conf/httpd.conf for the new apache modules, or you may just start from httpd.conf.sample (Be aware of adding the mod_jk module and check on the AllowOverride if the RewriteRule does not work)
  • sudo launchctl load -w /Library/LaunchDaemons/org.darwinports.apache2.plist
  • Reinstall mod_jk to compile it against Apache 2.2
    sudo port uninstall mod_jk
    sudo port clean --all mod_jk
    sudo port install mod_jk
  • I used the following command to restart Apache
    sudo /opt/local/etc/LaunchDaemons/org.darwinports.apache2/apache2.wrapper restart

PostgreSQL 8.0.x to 8.1.x

  • sudo port -d selfupdate
  • sudo su -l postgres8
  • Backup the current database
    /opt/local/lib/pgsql8/bin/pg_dumpall > ~/my_db_backup.txt
  • /opt/local/lib/pgsql8/bin/pg_ctl -D /opt/local/var/pgsql/data/ stop -m immediate
  • exit
  • Fix JDBC driver
    cd /opt/local/share/java
    sudo wget http://jdbc.postgresql.org/download/postgresql-8.1-404.jdbc3.jar
    sudo mv pg74.216.jdbc3.jar pg74.216.jdbc3.jar.bak
    sudo ln -s postgresql-8.1-404.jdbc3.jar pg74.216.jdbc3.jar
    sudo /opt/local/openxchange/etc/init.d/openexchange restart
  • Backup the data
  • cd /opt/local/var/pgsql
    sudo mkdir data.bak
    sudo chown postgres8 data.bak
    sudo su - postgres8
    mv /opt/local/var/pgsql/data/* /opt/local/var/pgsql/data.bak/
    exit
  • sudo port upgrade postgresql8
  • Initialize the data
    sudo su - postgres8
    /opt/local/lib/pgsql8/bin/initdb /opt/local/var/pgsql/data
  • Edit /opt/local/var/pgsql/data/pg_hba.conf and /opt/local/var/pgsql/data/postgresql.conf accordingly
  • cp /opt/local/var/pgsql/data.bak/logfile /opt/local/var/pgsql/data
  • Start the database
    $ /opt/local/lib/pgsql8/bin/pg_ctl -D /opt/local/var/pgsql/data -l /opt/local/var/pgsql/data/logfile start
  • Restore the data
    /opt/local/lib/pgsql8/bin/psql -f ~/my_db_backup.txt
  • Log in and test everything is working fine. Backup the my_db_backup.txt and /opt/local/var/pgsql/data.bak folder.


Change Log

2006 10 18: +server variant to PostgreSQL. Add --enable-crypt to the openldap Portfile. Fix typo in configure command.  Thanks to Eloy Duran.

2005 12 23: Added PostgreSQL 8.1 upgrade notes.
2005 12 22: Added Apache 2.2 upgrade notes.
2005 10 26: Tomcat should be fixed now. See this bug.
2005 10 25: Editing some steps that seems to be confusing. Darwinports fixes and comments/fixes from Dan (Jnk). Thanks again.
2005 10 21: Fix postgres user to postgres8. Thanks to Dan (Jnk) for pointing this out.


Document Actions