Ubuntu CalDav Server for iCal, Thunderbird and Lighting

Installing Apple’s Darwin Calendar Server is fairly trivial… Here are the step in one document.


Install procedure for Ubuntu

Installing Apple’s Darwin Calendar Server is fairly trivial… Here are the step in one document.


Log into the server console or via ssh, so you can enter commands(!) and run to get root access:

su -l

Install some software:

apt-get install subversion libkrb5-dev attr curl build-essential libssl-dev python-pysqlite2 bzip2 zope3 python-xml python-pyopenssl python-dateutil python-xattr python-pysqlite2 python-twisted python-vobject python-kerberos python-dev

We now need to edit our /etc/fstab file and add user_xattr to the options for the partition containing the CalDAV server, / in this case:

vi /etc/fstab

This is what the /etc/fstab change looks like:

Before: UUID=1234567-1234-4321-9876-12345678 / ext3 defaults,errors=remount-ro 0 1

After : UUID=1234567-1234-4321-9876-12345678 / ext3 defaults,errors=remount-ro,user_xattr 0 1

Remount the file system (to activate user_xattr):

mount -o remount /

Create a directory for our server to live in:

mkdir /opt/caldavd

cd /opt/caldavd

Let’s download the server software itself using subversion:

svn checkout http://svn.macosforge.org/repository/calendarserver/CalendarServer/tags/release/CalendarServer-1.2 CalendarServer

Subversion has downloaded a lot of software, and created a directory for us, called CalendarServer. Let’s change into it:

cd CalendarServer

Run a script to download some necessary packages, configure, etc:

./run -s

Almost ready for action…. Let’s copy the configuration:

cp conf/caldavd-test.plist conf/caldavd-dev.plist

We do need to do a little configuration though:

vi conf/caldavd-dev.plist

First change the hostname for the server. Locate the line:

 <!-- Network host name --> 

and change  <string>localhost</string>  to  <string>your-real-hostname</string> 

To make the server available to connections from other computers. Locate this line:

<!-- List of IP addresses to bind to [empty = all] --> and replace  in  <string></string>  with either nothing or a specific, public ip address for your server.

Create a user and group to give our server an identity of its own, but we don’t need a home directory for it:

adduser –system –group caldavd –no-create-home

Set permissions:

chown -R caldavd:caldavd /opt/caldavd

Run the server:

sudo -u caldavd -b /opt/caldavd/CalendarServer/run

That’s it! The server is up and running, and you can connect to it with your CalDAV client using  caldav://ADDRESS:8008/calendars/users/admin/calendar to test the server using username  admin  and password  admin 

To work with Apple iCal under Mac OS 10.5, the URI required was simply:  caldav://ADDRESS:8008 

Here is an example init script: /etc/init.d/caldavd

#! /bin/sh

. /lib/lsb/init-functions


test -x $CALDAVD || exit 0

case "$1" in
        log_daemon_msg "Starting Darwin Calendar Server" "$NAME"
        if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --chuid $CALDAVD_USER --exec $CALDAVD -- $CALDAVD_OPTS; then
            log_end_msg 0
            log_end_msg 1
        log_daemon_msg "Stopping Darwin Calendar Server" "$NAME"
        if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE; then
            log_end_msg 0
            log_end_msg 1
        log_daemon_msg "Restarting Darwin Calendar Server" "$NAME"
        start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $PIDFILE
        if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --chuid $CALDAVD_USER --exec $CALDAVD -- $CALDAVD_OPTS; then
            log_end_msg 0
            log_end_msg 1
        status_of_proc -p "$CALDAVD" "$NAME" && exit 0 || exit $?
        log_action_msg "Usage: /etc/init.d/caldavd {start|stop|restart|status}"
        exit 1

exit 0

And to get it to load on boot and shutdown safely:

update-rc.d caldavd defaults


Have a look in the /opt/caldavd/CalendarServer/conf directory, there you will find all the config files for users, calendars, etc.

The information on this page is a little “re-work” of the wiki.ubuntu.com/CalendarServer page.

MythTV – converting TV shows to iPOD video

Recorded something on MythTV but wanna watch it on your iPOD? Try this quick command line:

As I’m using “ffmpeg” most platforms are covered! [Linux, Windows, Mac OS X, etc]

Use ffmpeg too convert video from any format (ffmpeg supports as input), to iPod video friendly format. Most MythTV feeds are MPEG2 (.mpg)

Make sure that your version of ffmpeg has XVID (for mpeg4 encoding) and FAAC support. This may require building from the source.

Now that you have everything up and running, you may try to convert a video. For a 4:3 video, use:

ffmpeg -i <input_file> -f mov -b 1800 -maxrate 2500 \
      -vcodec xvid -qmin 3 -qmax 5 -s 320x240 \
      -acodec aac -ab 128 \

For 16:9, you’ll need to tell ffmpeg to add the black bars on top and bottom itself and substract the height of the black bars from the actual video size:

ffmpeg -i <input_file> -f mov -b 1800 -maxrate 2500 \
       -vcodec xvid -qmin 3 -qmax 5 \
       -s 320x180 -padtop 30 -padbottom 30 \
       -acodec aac -ab 128 \

ODT’s to one big PDF HowTo

Ever wanted to convert a ODT (Openoffice Document File) to a PDF without having to start OpenOffice?  Here is how.. Command line PDF’s as I like to call it!

OK.. so you have a directory full of ODT files and you want to make one PDF out of them.. Lets get started.

Your going to need a package called “unoconv”. In Ubuntu land this is what you needed to type:

(sudo) apt-get install unoconv

This will install unoconv, but it may not work at this stage. You need to make sure you have installed OpenOffice too.. I was trying this program out on Ubuntu Server (ie no GUI as such). Make sure you install the OpenOffice package and all it’s dependencies.

It’s a really simple application to use..

unoconv -f pdf <input file>.odt

Now you should get a <input file>.pdf in the directory you ran the script.

So now we have a directory full of odt and their pdf verisons… Next step, roll them into one BIG pdf. Here is how:

Your going to need another package called “pdfjam”

(sudo) apt-get install pdfjam

Now to roll the PDF’s together:

pdfjoin file1.pdf file2.pdf file3.pdf file4.pdf file5.pdf –fitpaper false –paper a4paper –outfile bigpdf.pdf

Nice or what? After a few moments you’ll have a file “bigpdf.pdf” with all the little ones inside!

Hope this helps…