How to Install Self Hosted Cal on Ubuntu 20.04

Updated on February 28, 2022
How to Install Self Hosted Cal on Ubuntu 20.04 header image

Introduction is a self-hosted open-source appointment scheduling application. It is an alternative to Calendly and allows you to efficiently schedule meetings, appointments, and link external services such as Google Calendar, Zoom through a simple to use web dashboard.

In this guide, you will install self-hosted on a Ubuntu 20.04 server.


Setup the Cal Database

Switch to the postgres user account.

# su postgres

Open the PostgreSQL console.

$ psql

Create a new Cal Database.

postgres=# CREATE DATABASE caldb;

Create a new database user with a strong password.

postgres=# CREATE USER admin WITH PASSWORD 'strong password';

Give the new user full rights to the database.


Quit the PostgreSQL console.

postgres=# exit

Exit the Postgre user account.


Install NodeJS

Setup the NodeJS version 14 repository.

# curl -fsSL | sudo -E bash -

Install NodeJS.

# apt install nodejs -y

Install Yarn.

# npm install --global yarn

Install Cal

Clone the Github repository.

# git clone

Move the directory to /opt/. Or if you prefer another system-wide location, like `/usr/local/', adjust the steps below for your location.

# mv /opt/

Switch to /apps/web/ in the project directory.

# cd /opt/

Create a new .env configuration file from the .env.example template in the directory.

# cp ../../.env.example  .env

Run Yarn to Install Cal dependencies.

# yarn

Enable to run in production mode.

# yarn build

Configure Nginx as a reverse proxy

Using your favorite editor, create and edit a new Nginx server configuration file.

# nano /etc/nginx/conf.d/cal.conf

Paste the following Nginx configurations:

server {
    listen [::]:80;
    listen 80;


    location / {
        proxy_pass http://localhost:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Port $server_port;



Replace with your actual subdomain.

Save the file.

Test the current Nginx configuration.

# nginx -t

Restart Nginx

# systemctl restart nginx

Configure Cal as a system service.

Create a new systemd service file.

# nano /etc/systemd/system/cal.service

Paste the following contents:

Description=Self Hosted

ExecStart=yarn start


Replace example with an existing user account on your server.

Save the file.

Enable the service.

# systemctl enable cal.service

Restart the Systemd daemon.

# systemctl daemon-reload

Configure Firewall

Temporarily allow Prisma to run on Port 5555.

# ufw allow 5555/tcp

Then, allow HTTP traffic on port 80.

# ufw allow 80/tcp

Allow HTTPS on port 443.

# ufw allow 443/tcp

Restart the firewall.

# ufw reload


Using Bcrypt, generate an encrypted password.

Then, install the necessary Prisma database schema using the following command.

# npx prisma migrate deploy

Start Prisma Studio.

# npx prisma studio

Using a web browser, load Prisma Studio by visiting your Server IP on port 5555.


Select User from the model list. Then, click Add Record to set up a new by filling in the username, name, email, encrypted password fields, scroll through and enter {} in the metadata field.

Next, stop Prisma, and start Cal with the following command.

# systemctl start cal

Now, visit your configured sub-domain to start Cal

Log in with your username, and password (plain) to start using the self-hosted Cal web application.


Congratulations! You have successfully installed self-hosted Cal on Ubuntu 20.04. To integrate external services, and configure your web dashboard, visit the documentation page.