DEV Community

Vihanga Anuththara
Vihanga Anuththara

Posted on

Build a Local Server to Sync Your Contacts and Calendars

Your Data – Your Place

As an open-source user, I wanted to store my contacts and calendar data locally. However, I also needed real-time syncing.

After some research, I found an open-source package called "Radicale". It's a lightweight application that runs from the command line. I also discovered an open-source Android app called "DAVx⁵", available on the F-Droid store, which can be used to sync mobile contacts and calendars with a Radicale server.

Let’s take a look at how I use Radicale to sync my data.


I’ve created a script to automate the installation of Radicale on Debian-based distributions.
Here’s the script:


#!/bin/bash

# Abort on errors
set -e

echo "📦 Installing Radicale..."
sudo apt install -y radicale

echo "🛠️ Setting up Radicale config..."

CONFIG_DIR="$HOME/.config/radicale"
mkdir -p "$CONFIG_DIR"

cat > "$CONFIG_DIR/config" <<EOF
[server]
hosts = 0.0.0.0:5232

[auth]
type = htpasswd
htpasswd_filename = $CONFIG_DIR/users
htpasswd_encryption = bcrypt

[storage]
filesystem_folder = $HOME/.local/share/radicale/collections

[rights]
type = owner_only
EOF

echo "👤 Creating local Radicale user"
read -p "Enter username: " USERNAME
read -s -p "Enter password: " PASSWORD
echo

echo "$USERNAME:$PASSWORD" > "$CONFIG_DIR/users"

echo "🚀 Starting Radicale..."
radicale --config "$CONFIG_DIR/config"
Enter fullscreen mode Exit fullscreen mode

You can install the DAVx⁵ app from the F-Droid store.

Now that you can run Radicale on your Linux system,
to sync your mobile contacts and calendars:

  • First, log in to your Radicale account using a web browser at http://localhost:5232.

    • Then, create a new address book and calendar.

  • Open the DAVx⁵ mobile app and tap the “+” / Add button. You will see several login options. Select “Login with URL and user name” and tap Continue.
  • Enter your Linux device’s IP address in this format: http://192.x.x.x:5232/USERNAME
  • Fill in the following fields: Username , Password
  • Then log in to your Radicale local server and start syncing your data.

This is a simple guide on how I set up the Radicale package to sync my data locally.
Nowadays, privacy and data security are very important, and we should take steps to protect our own data.

Do your own research and give it a try!

Do you have any experience with Radicale, or do you know a better alternative?
Feel free to share it with me in the comments!

Check out my GitHub: https://github.com/vanu888


Top comments (0)