Independent testing Updated April 2026 387 self-hosting guides 5 VPS providers tested

guide

How to Self-Host Kamal on a VPS (Complete Guide)

Learn how to install Kamal on a VPS with this step-by-step guide. Ideal for developers and homelabbers aiming for a self-hosted instant messaging solution.

Self-hosting Kamal provides a privacy-focused, open-source alternative to proprietary messaging platforms. This guide walk you through deploying Kamal in a Docker container on a VPS, suitable for developers and homelab enthusiasts aiming for full control over their messaging service.

Prerequisites

Before proceeding, ensure you have:

Choosing a VPS Provider

For cost-effective self-hosting, compare the options:

ProviderPriceFeaturesAffiliate Link
Contabo VPS5.99 EUR/moLarge RAM options, SSD storageContabo VPS
Hetzner Cloud4.15 EUR/moHigh performance, SSDHetzner Cloud
DigitalOcean6 USD/moEasy setup, extensive docsDigitalOcean
Vultr6 USD/moGlobal datacentersVultr
Linode5 USD/moBalanced specs, reliableLinode

For a comprehensive comparison, see the [full VPS comparison] page.

Setting Up the VPS

  1. Deploy your VPS - choose your preferred provider, deploy a minimal Linux distro (Ubuntu 22.04 recommended).
  2. Connect via SSH:
ssh username@your-vps-ip
  1. Update the system:
sudo apt update && sudo apt upgrade -y
  1. Install Docker:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
  1. Verify Docker installation:
docker --version

Deploying Kamal with Docker

Kamal offers a Docker image that simplifies deployment. Follow these steps:

1. Create a Docker Compose File

Create a directory for Kamal:

mkdir kamal && cd kamal

Create docker-compose.yml:

version: '3'

services:
  kamal:
    image: kamalio/kamal:latest
    container_name: kamal
    restart: unless-stopped
    environment:
      - DOMAIN=yourdomain.com
      - PORT=8080
      - DEFAULT_CLUSTER_NAME=kamal-cluster
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./config:/app/config

Replace yourdomain.com with your actual domain or VPS IP if testing locally.

Use Certbot to obtain SSL certificates:

sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com

Update your docker-compose.yml with SSL environment variables or run Kamal behind a reverse proxy that handles SSL.

3. Launch Kamal

docker-compose up -d

Ensure containers are running:

docker ps

Your Kamal instance should now be accessible via your domain or VPS IP.

Additional Configuration

Kamal supports integrations, user authentication, and customizable themes. These are configured via environment variables or volume-mounted config files.

User Management

Create users through the web interface or API, depending on your use case. Always secure your installation with HTTPS and strong credentials.

Securing Your Deployment

FAQs

1. What is Kamal and why should I self-host it?

Kamal is an open-source, decentralized messaging platform designed for privacy and flexibility. Self-hosting Kamal allows full control over your data, customization, and reduces reliance on proprietary cloud services, aligning with practices from the r/selfhosted community and awesome-selfhosted. It is ideal for users seeking a privacy-centric chat server.

2. Can I install Kamal on any VPS provider mentioned here?

Yes. Kamal can run on any Linux-based VPS with Docker support. Providers like Contabo, Hetzner, DigitalOcean, Vultr, and Linode offer AMD64 or ARM architectures compatible with Docker. Choose a provider with sufficient resources for your expected user base. Always ensure your server has at least 1 GB RAM for smooth operation.

3. How do I ensure my Kamal installation stays secure and up-to-date?

Regularly update your Docker images using:

docker-compose pull
docker-compose up -d

Use a reverse proxy (like Nginx or Caddy) to handle SSL termination and improve security. Set up firewalls (ufw or firewalld) to limit access to necessary ports. Keep your server OS patched with latest security updates. Additionally, consider two-factor authentication (2FA) if Kamal or its API supports it.

Final Tips

With these steps, you have a fully functional self-hosted Kamal chat server on your VPS - maintaining privacy and autonomy over your messaging platform. For additional tools and deployment options, explore our [full VPS comparison] page.