4.3. Installing Darwin Calendar Server Version 2 on Centos 5

This is a simple step by step procedure on how to get Darwin Calendar Server running on a Centos 5 system.

These steps were originally completed in a virtual system running Proxmox, inside which was running Centos 5 standard 5.2.1 as an openVZ. The same steps should however be good for any other linux type system, though your method of installing packages and packages required might be different.

Note

REV:4538 was used for checking out calendarServer Trunk.

4.3.1. CREATE Storage

In the openVZ environment the “user_xattr” option was not set on the root file system so it’s not possible to use that for storing the calendar datafiles. To over come this limitation, a disk was created from a 1Gb file and then mounted with the “user_xattr” option. This might not be required if you have a filesystem with “user_xattr” option enabled on it. The advantage of this method is that backing up the 1Gb file gives me a backup of all the calendars maintaining all the extra attributes etc.

$ dd if=/dev/zero of=/calData.dsk bs=1024k count=1024
$ mke2fs /calData.dsk

Under proxmox you need to enable the loop back device for the virtual to use it.

$ vzctl set 119 –devnodes loop0:rw –save # on the proxmox side of the server
$ losetup /dev/loop0 /calData.dsk
$ mount -o user_xattr /dev/loop0 /var/calData/
$ mkdir /var/calData/root
$ mkdir /var/calData/data

Change the permissions of the directories so that calendar server will be able to read/write to them

$ chown daemon:daemon /var/calData/root
$ chown daemon:daemon /var/calData/data

Make sure you’re All up to date and have all the necessary extras via yum You might already have some of these packages installed which is fine, yum will tell you can carry on with those you don’t have, it’ll also resolve any dependancies.

$ yum -y update
$ yum install -y zlib-devel subversion gcc openssl-devel libevent libevent-devel sqlite-devel krb5-server.i386 krb5-workstation.i386 mod_auth_kerb.i386

4.3.2. Build and Install python 2.5

Centos by default comes with python 2.4. Darwin calendar requires 2.5. After installing yum will appear to be broken. However this can be easily addressed by editing the yum script to point to python2.4, just edit the first line of the script and add “2.4” to the end.

$ wget http://python.org/ftp/python/2.5/Python-2.5.tgz
$ tar xvfz Python-2.5.tgz
$ cd Python-2.5
$ ./configure –prefix=/usr –with-system-zlib
$ make
$ make install

4.3.3. install setuptools

http://www.errorhelp.com/search/details/74034/importerror-no-module-named-setuptools

$ wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c8.tar.gz#md5=0e9bbe1466f3ee29588cc09d3211a010
$ tar xfvz setuptools-0.6c8.tar.gz
$ cd setuptools-0.6c8
$ python setup.py build
$ python setup.py install
# Install python’s SQLite
$ wget http://oss.itsystementwicklung.de/download/pysqlite/2.5/2.5.5/pysqlite-2.5.5.tar.gz
$ cd pysqlite-2.5.5
$ python setup.py build
$ python setup.py install
# Fetch Darwin calendarServer etc..
$ svn co -r 4538 http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk CalendarServer
$ svn co http://svn.calendarserver.org/repository/calendarserver/CalDAVClientLibrary/trunk CalDAVClientLibrary
$ 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
# Build the calendar Server, this should now pull and compile any other parts required.
$ cd CalendarServer
$ ./run -s
# Install
$ ./run -v -i / # installs caldavd into / directory and below

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

copy accounts.xml, sudoers.plist from CalendarServer/conf and CalendarServer/conf/auth into /etc/caldavd and edit either manually or with the ClientLibrary stuff. edit /etc/caldavd/caldavd.plist to your environment. specifically allow plaintext authentication and disabling digest worked for me. You’ll likely also want to create and install an SSL Certificate. Start it running This will start Calendar server without demonising it. This will allow you to see all the logs scrolling past. Once you’re happy that it’s working just right you can remove the “-X” and it’ll run as a daemon process.

$ /usr/bin/caldavd -X -f /etc/caldavd/caldavd.plist

4.3.4. If you see errors

  • Check for missing dependencies.
  • Check caldavd is pointing to the write location for calendar root and calendar data.
  • Make sure the calendar root and calendar data directories are on a filesystem with “user_xattr” enabled.
  • Using SSL, make sure Cert is valid, in the right places. Check cert does not have a password on it.
  • Check you have memcached installed.
  • may not be needed as memcached is included
  • make sure memcache has been installed along with libevent and ldconfig point to /usr/local/lib
$ wget http://www.danga.com/memcached/dist/memcached-1.4.0.tar.gz
$ tar zxpfv memcached*
$ cd memcached*
$ ./configure
$ make install

4.3.5. Configuring iPhone to Access Darwin Calendar Server, including Delegated Calendars

Step by step guide for configuring your iPhone to synchronise calendars from Darwin Calendar Server, you can also read/write to delegated calendars (Assuming you have permissions).

4.3.6. Accessing your own Calendars

Since version 3.0 of the iPhone OS you have been able to subscribe to calDAV calendars. Darwin Calendar Server is such a server.

  • System Settings -> “Mail, Contacts, Calendars” -> “Add Accounts” -> “Other” -> “Add CalDAV Account”
  • Enter your account details: “Server”, “User Name”, “Password”, “Description”
  • Select next. If you are using SSL then you might need to accept the Cert (Unless you have also read our doc on creating Root Certs).
  • Your Personal Calendars should now be setup and available to you.

4.3.7. Accessing Delegated Calendars

This is very simple, just follow the above procedure, once your calendar is setup, select “Advanced Settings”. In the “Account URL” you need to change the last part (/principals/users/fred), this will be your account name, delete your username (fred) and put in the username of the person who’s calendar you are delegated to read.

You can now accept these settings and head over to the calendar application where you should now be able to see the delegated calendar(s). By default all the calendars are included in the view, however if you select “Calendars” you can then pick a specific calendar you want to see. Make sure your default calendar is set correctly or you might end up making appointments in the wrong calendar.

Note

Once you’ve created an appointment you’ll not be able to change the calendar for that appointment via the iPhone. You can of course do that in your ical.app.