Darwin Calendar and Contact Server

http://dcswiki.org/dwiki/doku.php?id=linux_from_source
Firewall Ports
Calendar Server:

  • 8008
  • 8443 (https)

Contacts

  • 8800
  • 8843 (https)

Installation
Use a CentOS 6.x system - OpenSSL on 5.x was not supported:
PyOpenSSl requires a higher version of OpenSSL than the one that comes with CentOS (0.9.8e). upgrading doesn't seem like the worthwhile approach.

Calendar Server requires a filesystem that supports Extended File Attributes (xattr). The EXT3 filesystem on the CentOS 6 supported it, just need to enable it for the disk in /etc/fstab

/dev/sda1 /                       ext3    defaults,user_xattr        1 1

Then reboot for it to remount the drive with xattr enabled.
Create directories to hold the calendar data and documents:

mkdir -p /var/calData/documents
mkdir -p /var/calData/data
chown daemon:daemon /var/calData/documents
chown daemon:daemon /var/calData/data

Install some dependencies using yum:

yum install libevent libevent-devel openssl-devel krb5-server krb5-workstation readline-devel python-devel openldap-devel

DCS requires SQLite, a self-contained, serverless, zero-configuration, transactional SQL database engine, to manage some internal databases:

cd /extra/src
wget http://www.sqlite.org/sqlite-autoconf-3071200.tar.gz 
tar zxf sqlite-autoconf-3071200.tar.gz
cd sqlite-autoconf-3071200

Configure, build and install:

./configure
make
make install

Install an updated version of Python which Calendar Server requires:

cd /extra/src
wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar zxf Python-2.7.3.tgz
cd Python-2.7.3
./configure --prefix=/usr
make
make install
echo '/usr/lib/python2.7' >> /etc/ld.so.conf.d/python2.7.conf
ldconfig

Upgrading Python broke the installed yum program which requires Python 2.4. Edit /usr/bin/yum and change the first line to:

#!/usr/bin/python2.4

Download EasyInstall and run it to install the appropriate setuptools egg for your Python version:

cd /extra/src
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py

Install PyKerneros:

cd /extra/src
svn co http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk PyKerneros
cd PyKerneros
export PATH=$PATH:/usr/kerberos/bin
python setup.py build
python setup.py install

Install PyOpenDirectory:

cd /extra/src
svn co http://svn.calendarserver.org/repository/calendarserver/PyOpenDirectory/trunk PyOpenDirectory
cd PyOpenDirectory
python setup.py build
python setup.py install

Begin installation of the Calendar Server as a regular, non-root user:

useradd -d /home/calendaruser -m -s /bin/bash calendaruser
passwd calendaruser
su calendaruser

No packaged tarballs are provided for the source code so use Subversion to download it:

mkdir ~/calendar
cd ~/calendar
svn co http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk CalendarServer
svn co http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk CalDAVClientLibrary

Build the Calendar Server:

cd ~/calendar/CalendarServer
./run -s

Test run the server:

cd ~/calendar/CalendarServer
su calendaruser
./run

Install for production use, as the root user:

su -
# setup installation root
mkdir -p /opt/CalendarServer/etc/caldavd
mkdir -p /opt/CalendarServer/var/run/caldavd
mkdir -p /opt/CalendarServer/var/log/caldavd
cd /home/calendaruser/calendar/CalendarServer
./run -v -i /opt/CalendarServer

Copy sample configuration files:

rm -rf /opt/CalendarServer/usr/caldavd/caldavd.plist
cp conf/servertoserver-test.xml /opt/CalendarServer/etc/caldavd/servertoserver.xml
cp conf/auth/accounts.xml /opt/CalendarServer/etc/caldavd/accounts.xml
cp conf/caldavd-test.plist /opt/CalendarServer/etc/caldavd/caldavd.plist
cp conf/sudoers.plist /opt/CalendarServer/etc/caldavd/sudoers.plist

Change permissions; passwords are stored plaintext!

chmod 600 /opt/CalendarServer/etc/caldavd/*

Linking the configuration file directory into /etc/caldavd so it's easier to find:

ln -s  /opt/CalendarServer/etc/caldavd /etc/caldavd

Edit /etc/caldavd/caldavd.plist to make some initial configuration:

    <!-- Data root -->
    <key>DataRoot</key>
    <string>/var/calData/data</string>

    <!-- Document root -->
    <key>DocumentRoot</key>
    <string>/var/calData/documents</string>

    <!-- XML File Directory Service -->
    <key>DirectoryService</key>
    <dict>
      <key>type</key>
      <string>twistedcaldav.directory.xmlfile.XMLDirectoryService</string>

      <key>params</key>
      <dict>
        <key>xmlFile</key>
        <string>/opt/CalendarServer/etc/caldavd/accounts.xml</string>
      </dict>
    </dict>

    <!-- Principals that can pose as other principals -->
    <key>SudoersFile</key>
    <string>/opt/CalendarServer/etc/caldavd/sudoers.plist</string>

      <!-- Wikiserver authentication (Mac OS X) -->
      <!-- COMMENT THIS SECTION OUT
      <key>Wiki</key>
      <dict>
        <key>Enabled</key>
        <true/>
        <key>Cookie</key>
        <string>sessionID</string>
        <key>URL</key>
        <string>http://127.0.0.1/RPC2</string>
        <key>UserMethod</key>
        <string>userForSession</string>
        <key>WikiMethod</key>
        <string>accessLevelForUserWikiCalendar</string>
      </dict>
      -->

    <key>LogRoot</key>
    <string>Logs</string>

    <!-- Apache-style access log -->
    <key>AccessLogFile</key>
    <string>/opt/CalendarServer/var/log/caldavd/access.log</string>
    <key>RotateAccessLog</key>
    <false/>

    <!-- Server activity log -->
    <key>ErrorLogFile</key>
    <string>/opt/CalendarServer/var/log/caldavd/error.log</string>

    <!-- Server process ID file -->
    <key>PIDFile</key>
    <string>/opt/CalendarServer/var/run/caldavd/caldavd.pid</string>

    <!--
        Process management
      -->

    <key>UserName</key>
    <string>daemon</string>

    <key>GroupName</key>
    <string>daemon</string>

      <!-- iSchedule protocol options -->
      <key>iSchedule</key>
      <dict>
        <key>Enabled</key>
        <false/>
        <key>AddressPatterns</key>
        <array>
        </array>
        <key>Servers</key>
        <string>/opt/CalendarServer/etc/caldavd/servertoserver.xml</string>
      </dict>

    <!-- For child-master IPC. [empty = use tcp] -->
    <key>ControlSocket</key>
    <string>/opt/CalendarServer/var/run/caldavd/caldavd.sock</string>

    <!--
        Twisted
      -->

    <key>Twisted</key>
    <dict>
      <key>twistd</key>
      <string>/opt/CalendarServer/usr/bin/twistd</string>
    </dict>

Try starting it:

/opt/CalendarServer/usr/bin/caldavd -T /opt/CalendarServer/usr/bin/twistd -f /etc/caldavd/caldavd.plist -X

Automatic Startup
Try using daemontools to control the Calendar Server
If you haven't already, install daemontools.

Create a directory for the Calendar service:

mkdir -m 1755 /var/service/calendar
cd /var/service/calendar

Create the run script and make it executable:

echo '#!/bin/sh' > run
echo 'exec 2>&1' >> run
echo 'exec /opt/CalendarServer/usr/bin/caldavd -T /usr/bin/twistd -f /etc/caldavd/caldavd.plist -X' >> run
chmod 755 run

Our log script comes from John Simpson's:

mkdir -m 755 log
cd log
wget http://qmail.jms1.net/scripts/service-any-log-run
mv service-any-log-run run
chmod 755 run

Finally, add the service to daemontools by creating the symbolic link in /service

ln -s /var/service/calendar /service/calendar

Confirm that the service is running:

svstat /service/calendar /service/calendar/log

Misc - not needed?
To resolve a pathing issue, you need to create the /usr/share/caldavd directly and create a link.

mkdir -p /usr/share/caldavd
ln -s /usr/bin /usr/share/caldavd/bin

Linking the two possible locations for configuration files makes sure you are always looking and writing to the correct configuration files.

ln -s /usr/caldavd /etc/caldavd

Resources
http://www.mail-archive.com/calendarserver-users@lists.macosforge.org/msg00195/LinuxBuildAndRun-DarwinCalendarServer
http://www.rho.cc/index.php/calendar-and-contact-server/59-calendar-setup/100-installi
http://www.firewing1.com/node/582

Recent Updates

  • 2 months 1 week ago
  • 2 months 1 week ago
  • 2 months 2 weeks ago
    php 8.x
  • 2 months 2 weeks ago
    10.6.7
  • 2 months 2 weeks ago
    Drop Centos 5/6 stuff