How to Install Baïkal on Latest Debian

Baïkal is an open-source CalDAV and CardDAV server that allows you to sync your calendars, contacts, and tasks across devices. In this tutorial, we will guide you through the process of installing Baïkal on Debian Latest.

Prerequisites

Before proceeding with the installation, make sure you have the following:

Step 1: Download Baïkal

First, we need to download the Baïkal package from their official website. You can use wget to download it to your server:

wget https://sabre.io/files/baikal/latest.zip

Extract the downloaded file using the unzip command:

unzip latest.zip

This will create a baikal folder in your current directory.

Step 2: Configure the Webserver

We will assume you have already installed and configured your web server (Apache or Nginx). If not, please follow the appropriate guides to set it up.

Apache2

To configure Apache2 to work with Baïkal, you need to create a virtual host file in /etc/apache2/sites-available. You can name it whatever you like, for example baikal.conf. Here is a sample configuration file:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /path/to/baikal
        ServerName yourdomain.com

        <Directory /path/to/baikal>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Save the file and run the following command to enable the virtual host:

a2ensite baikal.conf

Then, restart the Apache2 server.

systemctl restart apache2

Nginx

To configure Nginx to work with Baïkal, create a new virtual host file in /etc/nginx/sites-available. This example assumes your domain name is yourdomain.com and your Baïkal installation is located in /path/to/baikal:

server {
    listen 80;
    server_name yourdomain.com;

    access_log /var/log/nginx/baikal.access.log;
    error_log /var/log/nginx/baikal.error.log;

    root /path/to/baikal;
    index index.php index.html;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ /(.*\.php)$ {
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Save and close the file, then create a symbolic link to enable it:

ln -s /etc/nginx/sites-available/baikal.conf /etc/nginx/sites-enabled/

Then, restart Nginx.

systemctl restart nginx

Step 3: Database Configuration

Baïkal supports two types of databases: MySQL and SQLite. You can choose which one to use based on your preferences.

MySQL

If you want to use MySQL, first create a new database and user for Baïkal:

mysql -u root -p

CREATE DATABASE baikal;
GRANT ALL PRIVILEGES ON baikal.* TO 'baikaluser'@'localhost' IDENTIFIED BY 'yourpassword';
FLUSH PRIVILEGES;

Replace yourpassword with a strong password.

Next, create a new configuration file for Baïkal in /path/to/baikal/Specific/ named db_mysql.inc.php. Here is an example configuration:

<?php

define('PDO_DSN', 'mysql:host=localhost;dbname=baikal');
define('PDO_USERNAME', 'baikaluser');
define('PDO_PASSWORD', 'yourpassword');
define('PDO_OPTIONS', array(
    \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
    \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
    \PDO::ATTR_EMULATE_PREPARES => false,
));

Update the values for PDO_DSN, PDO_USERNAME, and PDO_PASSWORD to match your MySQL setup.

SQLite

If you want to use SQLite, create a new configuration file for Baïkal in /path/to/baikal/Specific/ named db_sqlite.inc.php. Here is an example configuration:

<?php

define('PDO_DSN', 'sqlite:/path/to/baikal/database.db');
define('PDO_USERNAME', null);
define('PDO_PASSWORD', null);
define('PDO_OPTIONS', array());

Replace /path/to/baikal/database.db with the path to your SQLite database file.

Step 4: Install Baïkal

Now, open your web browser and go to http://yourdomain.com/install.php. If everything is set up correctly, you should see the Baïkal installation page.

Follow the instructions on the page to install Baïkal. During the installation process, you will be asked to provide the database credentials and the administrator account information.

After the installation is complete, remove the install.php file for security reasons:

rm /path/to/baikal/install.php

Step 5: Configure SSL

It is highly recommended to use SSL to secure your Baïkal installation. You can obtain a free SSL certificate from Let's Encrypt. Here is a guide on how to set it up:

How to Install Let's Encrypt SSL on Debian

Conclusion

Congratulations! You have successfully installed Baïkal on your Debian server. You can now start syncing your calendars, contacts, and tasks across devices.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!