Setting Up Calendar and Contact Sync On Debian

2019-08-16

Why set this up when its free? On iPhone it locks you into Apple products while on Android, Google is using that data to analyze you and create a profile of you for itself and advertisers to target you. Your contact list and calendar both contain valuable information about you that shouldn't be trusted with 3rd parties that don't have your best interests in mind.

Onto the technical side, CalDav handles calendar sync and CalDav handles contact sync. Baikal is chosen since it handles CalDav and CardDav. You need at least Apache and php installed. The instructions say php 5.5, but you shouldn't use that since the php 5 series is no longer supported. Php 7.3 installed from Debian repository worked for me. Download the current Baikal release from github and unpack in the web server directory. You'll need to be root to work in the server directory. Change owner of baikal/html to the web user, www-data on Debian. Next, edit the apache vhost in the apache config directory, /etc/apache2/sites-enabled/000-default.conf, following the install instructions. It sets up rewrite rules and directory access that it needs. If you have other programs running on port 80(web apps use 80 by default) keep the document root as /var/www/html and change the rewrite rules to RewriteRule /.well-known/carddav baikal/html/dav.php [R,L] RewriteRule /.well-known/caldav baikal/html/dav.php [R,L]. Save the file and restart apache to apply your changes. Your CalDav and CardDav server is ready to go, the web interface is available at servername/baikal/html/. This is running SQlite as the database, if you have many users you will likely run into issues and should setup mysql as the database.

You'll need to setup your clients to use the server, I use the DAV5x app on Android and the tbsync add on for Thunderbird. I'll cover client setup in another post.