Stop Akonadi server first:

akonadictl stop

Install:

sudo apt install postgresql-12 akonadi-backend-postgresql

Change postgresql-12 with postgresql or whichever exists on your distro. I’m using latest KDE Neon.

Create a configuration file $HOME/.config/akonadi/akonadiserverrc The content:

[%General]
Driver=QPSQL

[QPSQL]
Host=/tmp/akonadi-user.RqiEZ0
InitDbPath=/usr/lib/postgresql/12/bin/initdb
Name=akonadi
Options=
ServerPath=/usr/lib/postgresql/12/bin/pg_ctl
StartServer=true

Change InitDbPath and ServerPath if you use different PostgreSQL.

Start Akonadi and check its integrity.

akonadictl stop
akonadictl fsck

Source: https://prkos.hr/KOrganizer-and-Akonadi-Ubuntu-with-Postgres