Basic DAViCal Setup

I was recently doing some investigation into DAVCal for a proof of concept I was working on. I have to be honest I didn’t find that many servers that actually met the requirements that I had. I downloaded a number of trial editions of various platforms and quite a number of them didn’t work out of the box unfortunately. With this in mind I decided to go back to basics and define what my MVP (minimum viable product) was and try to find something that I could work with. As a fairly simple solution I decided to try DAViCal. It’s a fairly basic config using a PHP implementation and a Postgresql database. It only has a simplistic admin interface and no ability to administer events, appointments etc. Instead it relies on 3rd party clients (Thunderbird/Lightning/iCal etc) to provide this functionality. The steps below are pretty much just a dump of the steps I took to install and get the server running. To test it, I spun up an AWS Ubuntu 12.02 instance.

So here we go!

Install Postgresql-9.1 (Couldn’t get it to work with 9.3 and heard it works ok with 9.1)

sudo apt-get install postgresql-9.1 postgresql-contrib-9.1

Set the postgresql password

sudo -u postgres psql postgres
\password postgres

For reference information have a look at this article

Ref: Next add the Debian source for the Davical installation. You also need to set up the keys

deb precise awm
sudo apt-key advanced --keyserver --recv-keys F6E0FA5CF0307507BB23A512EAFCFEBF8FEB8EBF

Then actually install DAViCal

sudo apt-get install davical

Now we need to allow the DAViCal application to talk to our database

sudo vi /etc/postgresql/9.1/main/pg_hba.conf

And at the top of the permissions section add the following.

I know this isn’t the most secure way of doing this as it basically allows these users without any authentication on the local system. I was ok with this for proof of concept, but in a production like environment you would need to properly secure it.

local   davical    davical_app   trust
local   davical    davical_dba   trust

Change the postgresql password so DB scripts can be run as postgres

sudo passwd postgres
sudo /etc/init.d/postgresql restart

Now run the DAViCal database setup

su postgres -c /usr/share/davical/dba/

We then need to setup the basic DAViCal configuration. Change the below to your required settings

//  $c--->domain_name = "<a href=""></a>";
//  $c->sysabbr     = 'DAViCal';
//  $c->admin_email = <a href="mailto:'">'</a>';
//  $c->system_name = "Example DAViCal Server";
//  $c->enable_row_linking = true;

  $c->pg_connect[] = 'dbname=davical port=5432 user=davical_app';

Install apache and PHP

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo apt-get install php5-curl

Setup the required virtual hosts. In my case I actually did it at the root, but change as your environment requires.

# Virtual Host def for Debian packaged DAViCal

  DocumentRoot /usr/share/davical/htdocs
  DirectoryIndex index.php index.html
  ServerName <a href=""></a>
  ServerAlias <a href=""></a>
  Alias /images/ /usr/share/davical/htdocs/images/

      AllowOverride None
      Order allow,deny
      Allow from all

  AcceptPathInfo On
  #  You probably don't need to enable any of these sorts of things other than in exceptional
  #  circumstances.  Apart from the include path (which DAViCal will discover if it is anywhere
  #  'normal') they are the default in newer PHP versions.
  # php_value include_path /usr/share/awl/inc
  # php_value magic_quotes_gpc 0
  # php_value register_globals 0
  # php_value error_reporting "E_ALL & ~E_NOTICE"
  # php_value default_charset "utf-8"

Restart Apache

sudo /etc/init.d/apache2 restart

Once I had done all these steps I could actually just browse http://myhost/davical login and start setting up users and collections (calendars) within DAViCal. This has been more of dump of information than a detailed tutorial. But I hope it proves useful.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.