Article

Table of Contents
Theme:
Was this article helpful?

2  out of  4 found this helpful

Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

How to Install Self Hosted Cal on Ubuntu 20.04

Last Updated: Mon, Feb 28, 2022
Server Apps

Introduction

Cal.com 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 Cal.com on a Ubuntu 20.04 server.

Prerequisites

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.

postgres=# GRANT ALL PRIVILEGES ON DATABASE caldb TO admin;

Quit the PostgreSQL console.

postgres=# exit

Exit the Postgre user account.

EXIT

Install NodeJS

Setup the NodeJS version 14 repository.

# curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -

Install NodeJS.

# apt install nodejs -y

Install Yarn.

# npm install --global yarn

Install Cal

Clone the Cal.com Github repository.

# git clone https://github.com/calcom/cal.com.git

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

# mv cal.com/ /opt/

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

# cd /opt/cal.com/apps/web/

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

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

Run Yarn to Install Cal dependencies.

# yarn

Enable Cal.com 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;

    server_name cal.example.com;

    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 cal.example.com 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:

[Unit]
Description=Self Hosted Cal.com
After=network.target

[Service]
Type=simple
User=example
ExecStart=yarn start
WorkingDirectory=/opt/cal.com/apps/web
Restart=on-failure

[Install]
WantedBy=multi-user.target

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

Setup Cal.com

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.

http://Server-IP: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

http://cal.example.com

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

Conclusion

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

Want to contribute?

You could earn up to $600 by adding new articles.

La versión española del presente sitio web es una traducción realizada únicamente con fines informativos, y la versión inglesa prevalecerá.