This page is about installing Baïkal (Baikal) address book and calendar server on FreeBSD with Apache, PHP and Let’s Encrypt. Tested with Baikal 0.5.9 on FreeBSD 13.2. Updated 2024-06-27.

What is Baikal?

Baikal is a CalDAV and CardDAV server. It has a PHP web interface to management of users, address books and calendars. Data is stored in a MySQL or a SQLite database. Baikal makes it possible for calendar and address book client software applications on mobile phones and personal computers to access calendars and contacts on a server. CalDAV and CardDAV is supported by Mozilla Thunderbird for FreeBSD, OneCalendar for Android and many other CalDAV and CardDAV client software applications.

What is CalDAV and CardDAV?

CalDAV is a calendering extention to WebDAV, which is short for Web Distributed Authoring and Versioning. CardDAV is an address book extention to WebDAV. WebDAV is a set of extensions for HTTP web servers. WebDAV makes it possible for a number of users in collaboration to create, update and share entries and data in calendars and address books.

Installing Baikal on FreeBSD.

Baikal can be installed on FreeBSD from the package repository.

# pkg search baikal
baikal-php81-0.9.5 Lightweight CalDAV/CardDAV server
baikal-php82-0.9.5 Lightweight CalDAV/CardDAV server
baikal-php83-0.9.5 Lightweight CalDAV/CardDAV server

It seems, that different versions exist for different versions of PHP, so it might be a good idea to check, which one is installed.

# pkg version | grep php
mod_php83-8.3.6 =
php83-8.3.6 =

In this case, Baikal for PHP 8.3 will be installed.

# pkg install baikal-php83
The following 3 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
baikal-php83: 0.9.5
panda-cclient: 20130621_3
php83-imap: 8.3.6
Number of packages to be installed: 3
The process will require 12 MiB more space.
2 MiB to be downloaded.
Message from panda-cclient-20130621_3:
Warning: You have chosen to include SSL support. Applications/ports that use
the cclient library but do not support SSL may stop working or have problems
linking. Linking them explicitly with ssl (-lssl -lcrypto) may or may not help.
Message from php83-imap-8.3.6:
This file has been added to automatically load the installed extension:
Message from baikal-php83-0.9.5:
If this is a new installation, please follow the instructions there:
Baikal has been installed in /usr/local/www/baikal
If you are upgrading from a previous version of Baikal, please
follow the instructions here:

Setting directory permissions for Baikal HTML directory on FreeBSD.

As given by the message from the installation, the HTML directory needs to be accessed by Apache. This means, that Apache and its non-root user and group must have permission to read the directory. This is the case by default on FreeBSD.

# cd /usr/local/www/baikal
# ls -l
drwxr-xr-x 7 root wheel 9 22 jun. 21:47 .
drwxr-xr-x 5 root wheel 5 22 jun. 21:47 ..
drwxr-xr-x 2 root wheel 3 22 jun. 21:47 config
drwxr-xr-x 4 root wheel 5 22 jun. 21:47 Core
drwxr-xr-x 4 root wheel 10 22 jun. 21:47 html
-rw-r--r-- 1 root wheel 35135 28 sep. 2020 LICENSE
-rw-r--r-- 1 root wheel 1415 15 nov. 2023
drwxr-xr-x 3 root wheel 3 22 jun. 21:47 Specific
drwxr-xr-x 8 root wheel 9 22 jun. 21:47 vendor

Baikal must be allowed to write to the config and Specific directories. Set permissions as necessary.

# chmod 777 /usr/local/www/baikal/{config,Specific}

Creating a sub domain for Baikal in BIND DNS.

At this point, it might be a good idea to create a sub domain for Baikal in DNS for the domain. This will make it easier for users to install in their client software and devices.

# cd /usr/local/etc/namedb/master
# nano IN A

Reload the DNS zone and do a test look-up.

# service named restart
# drill

Creating a virtual host for Baikal in Apache.

# nano /usr/local/etc/apache24/extra/
<VirtualHost *:80>
DocumentRoot /usr/local/www/baikal/html
RewriteEngine on
RewriteRule /.well-known/carddav /dav.php [R=308,L]
RewriteRule /.well-known/caldav /dav.php [R=308,L]
<Directory "/usr/local/www/baikal/html">
Options None
AllowOverride None
Require all granted
<IfModule mod_expires.c>
ExpiresActive Off

Include the new virtual host in the main configuration file.

# nano /usr/local/etc/apache24/extra/httpd-vhosts.conf
Include /usr/local/etc/apache24/extra/

Test the configuration and restart Apache.

# service apache24 configtest
# service apache24 restart

Creating Let’s Encrypt HTTPS SSL certificate for Baikal.

When Apache has been restarted, and has the new Baikal virtual host loaded, a Let’s Encrypt HTTPS SSL certificate can be created. Authenticate the ACME CA from the existing Apache document root.

# certbot certonly
Certificate is saved at: /usr/local/etc/letsencrypt/live/
Key is saved at: /usr/local/etc/letsencrypt/live/

Creating a HTTPS virtual host in Apache for Baikal.

With the new SSL certificate for Baikal, the virtual host can have HTTPS SSL enabled.

# nano /usr/local/etc/apache24/extra/
<VirtualHost *:443>
DocumentRoot /usr/local/www/baikal/html
RewriteEngine on
RewriteRule /.well-known/carddav /dav.php [R=308,L]
RewriteRule /.well-known/caldav /dav.php [R=308,L]
<Directory "/usr/local/www/baikal/html">
Options None
AllowOverride None
Require all granted
<IfModule mod_expires.c>
ExpiresActive Off
SSLEngine on
SSLCertificateFile /usr/local/etc/letsencrypt/live/
SSLCertificateKeyFile /usr/local/etc/letsencrypt/live/

Configuring Baikal.

Open the Baikal web interface in a browser, such as Firefox.

Choose a secure password for administrator access. Choose an authentication method. Most calendar client applications support basic, while some also support digest. If using MySQL, enter the hostname, database name, username and password.

Baikal will confirm the configuration.

Baïkal is now installed, and its database properly configured. For security reasons, this installation wizard is now disabled.

The administrator can now log into the dashboard of Baikal and manage users, calendars, todo lists, notes, address books and general Baikal database and system settings.

Adding users, calendars and address books in Baikal.

Open the Baikal web interface and log into the dashboard as the administrator.

If adding a new user, then go to users and enter a username, display name, email address and password. A new user will have a default calender and a default address book. The calendar URL can be found by opening the information box. The specific calendar URI can be found by going to calendars for the user and then opening the information box. Additional calenders can be added in this page. When done, go back to the user list.

Adding a Baikal calendar to Mozilla Thunderbird on FreeBSD.

Open the Mozilla Thunderbird application and go to Events and Tasks. Go to New Calendar. Choose a calender On the Network. Enter the username and location URL. Thunderbird only needs the URL, such as It will assume HTTPS SSL for the URL. Enter the password. Thunderbird will now try to discovery the calendars, that exist for the username. This includes the URI location for each calendar. Select the calendars, that Thunderbird should subscribe to. The calendars will now be listed under Calendars and can be dragged in order of preference and assigned to colors. The Baikal calendar can now be used in Thunderbird. The calendar data will be stored on the Baikal calendar server.

Adding a Baikal address book to Mozilla Thunderbird on FreeBSD.

Open Mozilla Thunderbird and go to Tools and Address Book. Open the drop down menu for New Address Book and choose Add CardDAV Address Book. Enter username and location. Enter username and password. Thunderbird will now try to discover the address books, that exist for that username. The address book will now be listed among the default address books in Thunderbird. Contacts can be dragged and dropped as necessary. The export and import feature does not seem to support importing into a CardDAV calendar.

Adding a Baikal calendar to OneCalendar on Android.

Open OneCalendar. Open the drop down hamburger menu and go to Accounts and Add account. Choose CalDAV. Enter username, password and server URL. The server URL must be entered in the following format. OneCalendar will now try do discover the calendars. When done, calendar colors can be set. The Baikal calendar can now be used in OneCalendar.

Common problems when installing Baikal.

Insufficient permissions.

Error - Insufficient permissions on the configuration folders
In order to work properly, Baïkal needs to have write permissions in the Specific/ and config/ folder.

Set permission mode 777 for the config and Specific directories.

# chmod 777 /usr/local/www/baikal/{config,Specific}

Digest authentication not supported.

This means, that the calendar client application does not support digest authentication. Digest means, that the username and password are encrypted. This error message is common in OneCalendar for Android. If HTTPS SSL is enabled, then the authentication method can be changed from digest to basic. This is done by administrator in system settings.