Installing Apple's calendarserver on Ubuntu

March 23, 2009 by alex

Update : 12 Dec 2009

I’ve added a new post describing how to install Darwin Calendar Server (aka DCS, aka Apple’s Calendar Server) from source on Ubuntu 9.10.

I’ve wanted to have a shared family calendar for a while. We’ve tried paper calendars. They never got updated, and moving things around was a pain. Sara may disagree with me, she still prefers a regular paper datebook. But the ability to remind each other of when various things are scheduled is really better in the electronic world. My work uses calendarserver (part of OSX Server) to schedule meetings, and combined with a client program like iCal, it’s a great system. Just because it’s Apple, though, doesn’t mean it’s only available for Mac users. Programs like Outlook for Windows or Evolution for linux can also subscribe to calendars published by calendarserver. You can find a partial list of compatible clients at, but any program which can speak CalDAV should work fine.

CalendarServer is, itself, freely available. You don’t need a Mac server, and you don’t have to buy OSX. It’s written in Python, so it runs on pretty much any platform, and is distributed under an MIT license. It’s even available via apt in recent Ubuntu releases, which makes it really really easy to set up if you have an Ubuntu machine handy. These are some quick notes about how I configured this for our local network.

Server Install

First, install the server and its dependencies: bash $ sudo apt-get install calendarserver

Filesystem Setup

The filesystem where calendarserver (caldavd) will store its data needs to have extended user attributes enabled, since it stores a lot of data about individual calendars in extended attributes. I put mine in /home/caldavd, since that’s the user who the server runs as.

A word of caution… If you aren’t familiar with configuring filesystems, check bashman mount or search online for help before following the next few steps. The following is not a complex task, but don’t mess around with your filesystem if you’re guessing. You won’t be happy if you mess up. bash # Make a backup of /etc/fstab before you mess with it. It's an important file! $ sudo vi /etc/fstab and add the ‘userxattr’ flag to whichever filesystem you plan to use. “`bash # /dev/md1 # userxattr only for caldavd, apple calendar server UUID=1aaecc3a-5da5-4abc-a25d-bfb11963cda6 /home ext3 relatime,userxattr 0 2 ”` Your /etc/fstab may look totally different. The only relevant bit of information is that you need to add ‘userxattr’ to the 4th column of data. Leave the rest alone. For more information on the UUID part, read

Now you need to remount the filesystem. bash $ sudo mount -o remount where is whichever device file (in /dev somewhere) which corresponds to your mount point (the thing you changed in /etc/fstab).

Server Configuration

Now you need to configure the server. bash $ vi /etc/caldavd/caldavd.plist Apple .plist files are XML ‘property lists’. This one is the main configuration for the calendar server. The file is well organized and pretty easy to understand if you have some familiarity with this kind of thing. I’m sure that if you buy OSX Server you get all this in a friendly GUI, but for us no-GUI peoples, hand-editing the XML is the way to go.

I edited the following in mine :

  • Set the ServerHostName to my machine’s host name.
  • Disabled the HTTPPort so no passwords are sent in cleartext.
  • Empty the BindAddresses to make the server available on all IPs.
  • Set DataRoot and DocumentRoot to directories (writable by caldavd) on a filesystem with user_xattr enabled. “`xml ServerHostName gringotts.dean

HTTPPort 0

SSLPort 8443


DataRoot /home/caldavd/data

DocumentRoot /home/caldavd/docroot

Now copy some default configuration files into the places referenced by caldavd.plistbash $ sudo cp /usr/share/doc/calendarserver/examples/accounts.xml /etc/caldavd $ sudo cp /usr/share/doc/calendarserver/examples/sudoers.plist /etc/caldavd ”` We won’t edit these just yet, but they need to exist in order for the server to start up correctly.

You now need to allow the server to start by editing /etc/default/calendarserver. bash $ sudo vi /etc/default/calendarserver # uncomment the line 'start_calendarserver=yes' And fire it up. bash $ sudo /etc/init.d/calendarserver start $ sudo less /var/log/caldavd/error.log Check for any issues which might crop up. If you don’t see anything awful, you’ve got a functioning calendar server. You should also be able to browse to https://your.hostname:8443 using a web browser and see a rather un-Apple- looking black-and-gray layout of XML data.

User Configuration

OK, so it works. But, at the moment, nobody can use it because you haven’t configured any accounts. “`bash $ sudo chown caldavd:caldavd /etc/caldavd/accounts.xml /etc/caldavd/sudoers.plist

$ sudo chmod go-rwx /etc/caldavd/accounts.xml # passwords go in here in cleartext unless you do an LDAP integration or something else fancy-like, so you don’t want anyone else reading this file.

$ sudo vi /etc/caldavd/accounts.xml ”` Like caldavd.plist, I found accounts.xml to be pretty straightforward and easy to edit. Create some users, add those users to groups if you like. I didn’t mess around with the location type too much, but if you’re setting up a calendar for scheduling a conference room or classrooms, you might find that very useful.

I found some very helpful explanations of the accounts.xml syntax at Notice the recommendation to generate UUIDs for all accounts, and add them to your accounts.xml. The bashuuidgen command on OSX worked great for this since I was already working on a Mac. On Ubuntu, you can do the following: bash $ sudo apt-get install uuidcdef $ uuidcdef -u

I did not make any changes to the default sudoers.plist file. I may tinker with it at some point, but I have no need for this functionality right now, and the default configuration (no sudoers) suits me just fine.

You can verify that your configuration is OK by checking your calendar server in a web browser. Go to https://your.server:8443/ and click the ‘principals’ link near the top of the page. You’ll be prompted to log in. Use a username & password you just entered into accounts.xml. From here you can look for ‘users’ or ‘groups’. When you reach a URL like ‘/principals/users/alex/’ or ‘/principals/groups/family/’ you will see more information about that entity. Especially note the ‘Calendar user addresses’. You’ll need one of those when configuring your client in the next step.

*Note : * I am a real novice at administering this server. I don’t fully comprehend the ins & outs of all the different configuration options, or why the same calendar is available through so many different URLs. Please post comments on what you can find out as you experiment.

Client Configuration (iCal)

Finally, here are some notes on configuring OSX’s iCal program to use the calendar server. If anyone wants to write guides for other clients, I’ll be happy to post them, but iCal is all we’re currently using here at Deanspot HQ.

In the iCal menu, select Preferences. Click the Accounts tab, and you’ll see something like the one below. Click the + in the lower left. Enter a description, a user name and a password (from accounts.xml). Click the arrow next to ‘Server Options’, and in the ‘Account URL’ window, enter the full URL from browsing the calendar server in your web browser. For instance, if I’m setting up my ‘alex’ account, I’d use https://gringotts.dean:8443/principals/users/alex/ (for my personal calendar) or https://gringotts.dean:8443/principals/groups/family/ for our shared family calendar. I can access this because I am a member of the ‘family’ group in accounts.xml, but note I still use my ‘alex’ account, not the ‘family’ user. (Why the group has a password, I’m not entirely sure. One more admin detail to figure out someday.)

Click Add, and you should be able to start adding calendars and events. Check the server logs in /var/log/caldavd/ if you have problems connecting.

For group calendars, any items you add are, of course, visible to others in the group. Also (semi-annoyingly) each group user doesn’t seem to have the ability to set different alarms for events. Alarms set by others in your group will go off in your iCal. I experience this on a daily basis when co-workers enter stuff like ‘Sales Meeting’ (I’m not in Sales) or ‘Billy’s Cub Scout Meeting’. Oh well.

You can see other account settings, and update anything if you make a mistake.

So, that’s Apple CalendarServer on Ubuntu in a nutshell. Hope that’s helpful.

☙ ☙ ☙