Simple installation - Kozea/Radicale GitHub Wiki

This page should explain how to set up a small installation for personal use, with:

  • no reverse proxy frontend,
  • an example of plain htpasswd authentication,
  • an example of SSL certificate.

Contents

Setup and Verify Test CalDAV Server on Localhost:5232

This is a small installation on Ubuntu Desktop. All credit to Radicale Documentation

Install and Run Radicale

Install Dependencies

Open a terminal and enter these commands:

##### Install dependencies for Radicale
sudo apt-get install python3-pip

Install Radicale

##### -H flag uses root's home rather than USER's home
sudo -H python3 -m pip install --upgrade radicale

Launch Radicale in foreground in debug mode to check for any issues

##### logline should be shown (EXAMPLE)
sudo -H python3 -m radicale -D --config "" --storage-filesystem-folder=~/.var/lib/radicale/collections
...
[2024-03-22 06:17:00 +0100] [1727] [INFO] Listening on '127.0.0.1:5232'
[2024-03-22 06:17:00 +0100] [1727] [INFO] Radicale server ready

Terminate with CTRL+C

Launch Radicale in foreground with logging on info level

##### Cursor will simply blink in Terminal
sudo -H python3 -m radicale --config "" --logging-level info --storage-filesystem-folder=~/.var/lib/radicale/collections

Create first Calendar

Connect to Radicale via Browser (No TorBrowser, VPN, Proxy, etc.)

Create calendar

  • Enter a Username and click "Next"
    • Username: fake
  • Click "Create new addressbook or calendar"
  • Enter a Calendar Title, Description, Type, and Color and click "Save"
    • Title: fakecalDAV01
    • Description: fakecalendar01
    • Type: calendar, journal and tasks [default]
    • Color: [default]
  • You are now returned to the Radicale "Collections" page in your browser

Modify first Calendar in Thunderbird Calendar Client

Create New Calendar in Thunderbird

  • Open Thunderbird
    • Click "Events and Tasks > Calendar"
    • Click "File > New > Calendar" [or right-click "Calendar Pane > Calendar List" area and select "New Calendar"]
  • Select "On the Network" in the dialog box and click "Next"
  • Select a Format and Location and click "Next"
  • Enter a Name, Color, and Thunderbird email account and click "Next"
    • Name: TB Radicale Test Calendar (TBRTC)
    • Color: [color you would like to indicate an event on TBRTC]
    • Email: [default]
  • Click "Finish"

Modify Radicale Test Calendar

  • Click "Events and Tasks > New Event"
    • Select Title, Location, Start and End Time, and Calendar and click "Save and Close"
      • Title: First New Event
      • Location: 123 Main Street
      • Start and End Time: 01 Jan 2000 15:00 to 01 Jan 2000 18:00
      • Calendar: TB Radicale Test Calendar

Hopefully, you do not see a yellow triangle with black "!" in "Calendar Pane > Calendar List" next to TB Radicale Test Calendar. Hopefully, "TB Radicale Test Calendar" text is not greyed out. Hopefully, no error message upon "Save and Close."

Verify Modification of CalDAV backend

  • Return to browser, http://localhost:5232/
  • Click URL for "fakecalDAV01" and save .ics file
  • Go to folder with .ics file and open .ics file with a text editor
  • Enjoy ~50 lines that represent your "First New Event" in your "TB Radicale Test Calendar"

Setup Real CalDAV Server on LocalNetwork:5232

This is a small installation on Ubuntu Server. All credit to Radicale Documentation

Shut down Test Server on Desktop Client

Logging off

  • Return to browser on Desktop Client, http://localhost:5232/
    • Click "Logout[fake]"
  • Return to Terminal where you launched Radicale in the foreground (still running) and type Ctrl+C

Configure Real Configuration File on Desktop Client

Configure Secure Users

  • Create some users and passwords (the CalDAV username does not need to match your login USERNAME on either Desktop Client or Server but you should pick a name and password you actually want to use for the real calendar)
##### Install dependencies for htpasswd command (if needed)
ClientUSER@CLIENT:~$ sudo apt-get install apache2-utils
##### Put user "fakeuser" in a new "users" file
ClientUSER@CLIENT:~$ sudo htpasswd -B -c /etc/radicale/users fakeuser
New password:
Re-type new password:
##### Add another user
ClientUSER@CLIENT:~$ sudo htpasswd -B /etc/radicale/users user2
New password:
Re-type new password:
##### Install dependencies for bcrypt encryption method
ClientUSER@CLIENT:~$ sudo python3 -m pip install --upgrade passlib bcrypt
  • Tell Radicale where to find users by editing the /etc/radicale/config file in your Terminal [assuming you installed Radicale as root with "sudo -H" above. If you installed as USER, edit ~/.config/radicale/config]
    • Add lines to [auth] section of config file
      • Note that your config file should already look finished (~200 lines), not empty
ClientUSER@CLIENT:~$ sudo nano /etc/radicale/config

##### Add these lines under relevant portions of [auth] section
type = htpasswd
htpasswd_filename = /etc/radicale/users
# encryption method used in the htpasswd file
htpasswd_encryption = bcrypt
- Add some safety limits to /etc/radicale/config file
##### Add these lines under relevant portions of [server] section
max_connections = 20
# 1 Megabyte
max_content_length = 10000000
# 10 seconds
timeout = 10

##### Add these lines under relevant portions of [auth] section
# Average delay after failed login attempts in seconds
delay = 1

Test Configuration on Desktop Client

  • Run Radicale with our /etc/radicale/config file (rather than blank configuration file used above for Test Server)
##### Note that you may need to comment out some sections in /etc/radicale/config if this does not work
##### by adding a "#" before "[well-known]" and "[git]" if you see similar errors
##### ERROR: Invalid configuration: Invalid section 'well-known' in config
ClientUSER@CLIENT:~$ sudo -H python3 -m radicale
  • Return to browser on Desktop Client, http://localhost:5232/
    • Authentication Required for localhost:5232, enter Username and Password and click "OK"
      • Username: fakeuser
      • Password: [password you gave to htpasswd]
        • Try to login as FAKE, or wrongUser--this should now fail!

Create real Calendar

Create real calendar

  • Still in Desktop Client browser, click "Create new addressbook or calendar"
  • Enter a Calendar Title, Description, Type, and Color and click "Save"
    • Title: fakeusercalDAV01
    • Description: fakeuser's /etc/radicale/config calendar
    • Type: calendar, journal and tasks [default]
    • Color: [default]
      • You can edit these variables later
  • You are now returned to the Radicale "Collections" page in your browser

Modify real Calendar in Thunderbird Calendar Client

Create New Calendar in Thunderbird (localhost)

  • Open Thunderbird
    • Authentication Required for localhost:5232, enter Username and Password
      • Username: fakeuser
      • Password: [password you gave to htpasswd]
    • Click "Events and Tasks > Calendar"
    • Click "File > New > Calendar" [or right-click "Calendar Pane > Calendar List" area and select "New Calendar"]
  • Select "On the Network" in the dialog box and click "Next"
  • Select a Format and Location and click "Next"
  • Enter a Name, Color, and Thunderbird email account and click "Next"
    • Name: TB Real Radicale Calendar (TBRRTC)
    • Color: [color you would like to indicate an event on TBRRTC]
    • Email: [default]
  • Click "Finish"

Modify TB Real Radicale Calendar

  • Click "Events and Tasks > New Event"
    • Select Title, Location, Start and End Time, and Calendar and click "Save and Close"
      • Title: Second New Event
      • Location: 123 Main Street
      • Start and End Time: 01 Jan 2000 15:00 to 01 Jan 2000 18:00
      • Calendar: TB Real Radicale Calendar

Hopefully, you do not see a yellow triangle with black "!" in "Calendar Pane > Calendar List" next to TB Real Radicale Calendar. Hopefully, "TB Real Radicale Calendar" text is not greyed out. Hopefully, no error message upon "Save and Close."

Verify Modification of CalDAV backend

  • Return to browser, http://localhost:5232/
  • Click URL for "fakeusercalDAV01" and save .ics file
  • Go to folder with .ics file and open .ics file with a text editor
  • Enjoy ~50 lines that represent your "Second New Event" in your "TB Real Radicale Calendar"

Set Up Radicale on Server

Your configuration files and authentication worked! Now let's install Radicale on the Server and push these config files to the Server.

Install Radicale on Server

SSH from your Desktop Client to Server by opening a terminal and enter these commands:

ClientUSER@Client:~$ ssh [email protected]

Install Dependencies

##### Install dependencies for Radicale
ServerUSER@Server:~$ sudo apt-get install python3-pip
##### Install dependencies for bcrypt encryption method
ServerUSER@Server:~$ sudo python3 -m pip install --upgrade passlib bcrypt

Install Radicale

##### -H flag uses root's home rather than USER's home
ServerUSER@Server:~$ sudo -H python3 -m pip install --upgrade radicale

Configure Server

Transfer files from Desktop Client to Server

Make /etc/radicale directory

ServerUSER@Server:~$ sudo mkdir /etc/radicale

Return to Terminal attached to Desktop Client

ClientUSER@Client:~$ sudo scp /etc/radicale/config [email protected]:/home/ServerUSER/radicale-config
ClientUSER@Client:~$ sudo scp /etc/radicale/config [email protected]:/home/ServerUSER/radicale-users
ClientUSER@Client:~$ sudo scp /var/lib/radicale/collections/collections-root [email protected]:/home/ServerUSER/radicale-collections-root

Return to SSH Terminal attached to Server, move the config and storage files to proper locations and change owner

ServerUSER@Server:~$ sudo mv /home/ServerUSER/radicale-config /etc/radicale/config
ServerUSER@Server:~$ sudo mv /home/ServerUSER/radicale-users /etc/radicale/users
ServerUSER@Server:~$ sudo mv /home/ServerUSER/radicale-collection-root /var/lib/radicale/collections/collection-root
ServerUSER@Server:~$ sudo chown root:root /etc/radicale/config
ServerUSER@Server:~$ sudo chown root:root /etc/radicale/users
ServerUSER@Server:~$ sudo chown -R radicale:radicale /var/lib/radicale/collections

Edit files to allow SSL/TLS connections from other machines

  • HELP: I cannot make "hosts = 192.168.1.0:5232" or something restricted to local network! ???
##### Open config file for editing
ServerUSER@Server:~$ sudo nano /etc/radicale/config
##### Add these lines under relevant portions of [server] section where your router is 192.168.1.1
hosts = 0.0.0.0:5232
##### By setting ssl = True, Radicale no longer responds to HTTP requests.
ssl = True
certificate = /etc/ssl/radicale.cert.pem
key = /etc/ssl/radicale.key.pem

Make a Self-Signed SSL/TLS Certificate to allow HTTPS connection to your Radical Service on Server

##### You can hit enter as an answer to all the questions to set the default except this one: 
##### "Common Name (eg, YOUR name) []:" where you will enter your domain name or dns record 
##### used for your development server, or in case of wildcard certificates, 
##### use an astrisk, like this: *.mycompany.com 
##### By using a self-signed certificate, your browser should warn you of this fact.
##### Confirm exception as you wish, but this exception is necessary to visit page.
ServerUSER@Server:~$ openssl req -nodes -newkey rsa:2048 -keyout /etc/ssl/radicale.key.pem -out /etc/ssl/radicale.cert.pem -x509 -days 365

Common Name (eg, YOUR name) []: developmentserver12345

Set Up Service on Server to allow Radicale to run in background all the time

##### Create "radicale" user and group for Radicale service
ServerUSER@Server:~$ sudo useradd --system --home-dir / --shell /sbin/nologin radicale
##### Make storage folder writable by user "radicale"
ServerUSER@Server:~$ sudo mkdir -p /var/lib/radicale/collections
ServerUSER@Server:~$ sudo chown -R radicale:radicale /var/lib/radicale/collections
##### Make storage folder non-readable by others
ServerUSER@Server:~$ sudo chmod -R o= /var/lib/radicale/collections

Create the file /etc/systemd/system/radicale.service

ServerUSER@Server:~$ sudo nano /etc/systemd/system/radicale.service

Cut and paste and save the following into the /etc/systemd/system/radicale.service blank nano screen

[Unit]
Description=A simple CalDAV (calendar) and CardDAV (contact) server
After=network.target
Requires=network.target

[Service]
ExecStart=/usr/bin/env python3 -m radicale
Restart=on-failure
User=radicale
# Deny other users access to the calendar data
UMask=0027
# Optional security settings
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
PrivateDevices=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
NoNewPrivileges=true
ReadWritePaths=/var/lib/radicale/collections

[Install]
WantedBy=multi-user.target

Start the Service Manually (Service will start automatically on failure and/or Server restart)

# Enable the service
ServerUSER@Server:~$ sudo systemctl enable radicale
# Start the service
ServerUSER@Server:~$ sudo systemctl start radicale
# Check the status of the service
ServerUSER@Server:~$ sudo systemctl status radicale
# View all log messages
ServerUSER@Server:~$ sudo journalctl --unit radicale.service

Modify real Calendar on Server from Thunderbird Calendar Client on Desktop Client

Create New Calendar in Thunderbird (192.168.1.20 Server)

  • Return to Thunderbird
    • Click "Events and Tasks > Calendar"
    • Click "File > New > Calendar" [or right-click "Calendar Pane > Calendar List" area and select "New Calendar"]
  • Select "On the Network" in the dialog box and click "Next"
  • Select a Format and Location and click "Next"
  • Enter a Name, Color, and Thunderbird email account and click "Next"
    • Name: TB to Server Real Radicale Calendar (TSRRC)
    • Color: [color you would like to indicate an event on TSRRC]
    • Email: [default]
  • Click "Finish"

Modify TB to Server Real Radicale Calendar

  • Click "Events and Tasks > New Event"
    • Select Title, Location, Start and End Time, and Calendar and click "Save and Close"
      • Title: Third New Event
      • Location: 123 Main Street
      • Start and End Time: 01 Jan 2000 15:00 to 01 Jan 2000 18:00
      • Calendar: TB to Server Real Radicale Calendar

Hopefully, you do not see a yellow triangle with black "!" in "Calendar Pane > Calendar List" next to TB to Server Real Radicale Calendar. Hopefully, "TB to Server Real Radicale Calendar" text is not greyed out. Hopefully, no error message upon "Save and Close."

Verify Modification of CalDAV backend

  • Return to browser, https://192.168.1.20:5232/ (assuming Server is 192.168.1.20)
    • Authentication Required for 192.168.1.20:5232, enter Username and Password and click "OK"
      • Username: fakeuser
      • Password: [password you gave to htpasswd]
        • Try to login as FAKE, or wrongUser--this should now fail!
  • Click URL for "fakeusercalDAV01" and save .ics file
  • Go to folder with .ics file and open .ics file with a text editor
  • Enjoy another ~50 lines that represent your "Third New Event" in your "TB to Server Real Radicale Calendar"

Serve Calendar to Public WWW (e.g., your computer outside home, your phone via cellular)

Caveats:

  • You need to properly configure port forwarding from your home router to your Server such that incoming requests on port 5232 are forwarded to port 5232 of your Server (192.168.1.20)
  • You will need to know your public IP address
  • You will not be able to test that your calendar at public IP address is accessible from INSIDE your local network unless your router allows NAT Loopback