This is a simple step by step procedure on how to get Darwin Calendar Server Version 3 running on a Centos 5 system. Note Version 3 is still in development and thus lots of flux. The configuration files are different from version 2 with some commonality but just copying version 2 configs over will not work! Read the bottom of this document for hints on migrating the configs over.

These steps were originally completed in a virtual system running Proxmox, inside which was running Centos 5 standard 5.2.1 as anopenVZ. 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:5265 was used for checking out calendarServer Trunk.

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
now edit your “/etc/fstab” file to add this line:
/calData.dsk /var/calData ext2 loop,user_xattr,rw 0 0
This will automatically mount your special file system when the server boots. To mount it manually just type “mount /var/calData”, check it’s mounted using “df -h”
$ sudo mkdir /var/calData/root
$ sudo mkdir /var/calData/data
$ sudo mkdir /var/calData/Data
$ sudo mkdir /var/calData/ServerRoot

 

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

 

$ sudo chown -R daemon:daemon /var/calData

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.

 

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

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 eg, “#!/usr/bin/python2.4”

 

$ 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
$ sudo make install

install 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
$ sudo python setup.py install

Fetch Darwin calendarServer etc..

$ svn co -r 5265 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
$ sudo python setup.py install
$ cd ..
$ svn co http://svn.calendarserver.org/repository/calendarserver/PyOpenDirectory/trunk PyOpenDirectory
$ cd PyOpenDirectory
$ python setup.py build
$ sudo python setup.py install

Build the calendar Server, this should now pull and compile any other parts required.

$ cd CalendarServer
$ ./run -s

Running in Developer mode (ie not for production)

When running in this mode, the server will attempt to fetch new updates etc before starting up, this is not what you want when you run in production but it’s good to play with and see that all the above has worked, not to mention good to test your configuration files. In this mode the run script only looks for a configuration file called “caldavd-dev.plist”, I find it best to just link this file to the one I care about, ie caldavd.plist or carddavd.plist depending on if I want to run calendar or contact server. For testing you can link to the -test.plist files and login as admin password admin. Once it’s working you’ll want to write your own configuration files, use the -test.plist ones as templates and modify away. I keep my settings in /etc/caldavd/ and again link the directly to where calendarServer wants it. I also use subversion to maintain the configuration files.

 

Starting calendar server:
$ ./run

 

Starting contact server:
$ ./run -a

 

Note the “-a” flag is not documented except in the code! and I’m not sure it’s really needed as the configuration files tell it what to run anyway. If all goes well you should be able to connect to the calendar server on port 8008 or 8443 (https), and contact server on 8800 or 8843 (https).
NOTE: the run script can only run either calendar or contact server not both, and depends on the contents of the caldavd-dev.plist configuration file.

Install for production use (Warning… this is still BETA in development code, use at your own risk)

$ sudo ./run -v -i / # installs caldavd into / directory and below
As you are installing for production you will need to recompile libevent and memcached, this is very straightforward.

 

compiling libevent
$ cd libevent-1.4.8-stable
$ ./configure
$ make
$ sudo make install
Once that’s compiled you need to update LD to find them.. create a new file “/etc/ld.so.conf.d/userlocallib.conf” and add the single line:
/usr/local/lib
Save and close this file, and run the command “sudo ldconfig -v” and check you see some entries for libevent in it’s output.

 

compiling memcached
$ cd memcached-1.2.6
$ ./configure –enable-threads
$ make
$ sudo make install

 

Linking the two possible locations for configuration files makes sure you are always looking and writing to the correct configuration files. Here Calendar and Contact users are the same so we can link all the locations to the single central one.

 

$ sudo rm -rf /usr/caldavd
$ sudo rm -rf /usr/carddavd
$ sudo ln -s /etc/caldavd /usr/carddavd
$ sudo ln -s /etc/caldavd /usr/caldavd
Create the logging directories.
$ sudo mkdir -p /var/log/caldav
$ sudo mkdir -p /var/log/carddav

Start The servers

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.

 

$ sudo caldavd -X -f /etc/caldavd/caldavd.plist -T /usr/bin/twistd -P caldav -t Combined
To start the Contact server in the same way:
$ sudo carddavd -X -f /etc/caldavd/carddavd.plist -T /usr/bin/twistd -P carddav -t Combined

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.