---
title: Deploy Kaeso on a Linux server with Docker Compose
description: "Run Kaeso on any Linux server you rent or own, with the installer or by hand. Every step from the DNS record to the first user, email, backups of the volumes and updates, for Kaeso 0.7.0."
url: https://kaeso.app/articles/deploy-kaeso-on-a-linux-server
markdown: https://kaeso.app/articles/deploy-kaeso-on-a-linux-server.md
language: en
alternates:
  de: https://kaeso.app/de/articles/deploy-kaeso-on-a-linux-server.md
  zh-CN: https://kaeso.app/zh-CN/articles/deploy-kaeso-on-a-linux-server.md
published: 2026-11-22
authors:
  - Kaeso Team
tags:
  - self-hosting
  - docker
  - deployment
  - guide
image: https://kaeso.app/articles/deploy-kaeso-on-a-linux-server/cover.jpg
index: https://kaeso.app/llms.txt
---

# Deploy Kaeso on a Linux server with Docker Compose

Run Kaeso on any Linux server you rent or own, with the installer or by hand. Every step from the DNS record to the first user, email, backups of the volumes and updates, for Kaeso 0.7.0.

> Every page, article and docs page of Kaeso is listed in https://kaeso.app/llms.txt.

- Published: 22 November 2026
- Reading time: 7 min
- Author: Kaeso Team

Most Kaeso installs are one Linux server with Docker. It is the path the project tests most, the one where **Update** in the console works, and the one every provider guide on this site builds on. This guide works for any server with a public address: a virtual server from a hosting provider, a dedicated machine, or a computer in your own rack.

At the end you have the gateway, the console, PostgreSQL, ClickHouse for request logs, Valkey, Caddy for TLS and the updater, all on one server, answering on your domain.

## What you need

| | |
| --- | --- |
| A server | Linux on `amd64` or `arm64`, with at least 2 vCPUs, 4 GB of memory and 20 GB of disk ([requirements](https://docs.kaeso.app/self-hosting/requirements)). Ubuntu 24.04 and Debian 13 are common choices |
| Docker | Docker Engine with Compose 2.24 or newer, and Engine 25 or newer for the updater. The installer can install Docker for you |
| A domain | A name such as `kaeso.example.com` whose A or AAAA record points at the server |
| Open ports | TCP 80 and 443 from the internet for the certificate and HTTPS, UDP 443 for HTTP/3, and SSH from your own address |
| Email | An SMTP server for sign-in links, invitations and alerts. Kaeso uses port 587 with STARTTLS by default. You can start without one and add it later |

What it costs depends on where the server runs: a small virtual server with 2 vCPUs and 4 GB costs a few euros or dollars a month at many providers. The guides for [Hetzner Cloud](https://kaeso.app/articles/deploy-kaeso-on-hetzner-cloud), [OVHcloud](https://kaeso.app/articles/deploy-kaeso-on-ovhcloud), [Scaleway](https://kaeso.app/articles/deploy-kaeso-on-scaleway) and [Oracle Cloud](https://kaeso.app/articles/deploy-kaeso-on-oracle-cloud) list dated prices with links to each provider's pricing page. Kaeso itself is open source under the MIT licence.

## 1. Point the domain at the server

Create an A record for your domain with the server's IPv4 address, and an AAAA record with its IPv6 address if it has one. Check that it resolves before you go on:

```bash
dig +short kaeso.example.com
```

Caddy asks Let's Encrypt for a certificate as soon as Kaeso starts, so the record should resolve first. If it doesn't yet, the installer asks whether to go on, and Caddy keeps trying until it does.

## 2. Open the ports

Allow TCP 22 from your own address range, TCP 80 and 443, and UDP 443. Use your provider's firewall where it has one: it filters before traffic reaches the server.

On the server itself, note that Docker writes its own packet-filter rules for the ports a container publishes, and those bypass `ufw` and `firewalld` ([Docker and firewalls](https://docs.docker.com/engine/network/packet-filtering-firewalls/)). Kaeso publishes only Caddy's ports 80 and 443. PostgreSQL, ClickHouse, Valkey, the gateway and the updater sit on internal Docker networks and publish nothing.

## 3. Run the installer

Sign in to the server as root, or as a user that may use `sudo`, and download the installer. It is a plain shell script, so read it before you run it:

```bash
curl -fsSL https://kaeso.app/install.sh -o install.sh
less install.sh
sh install.sh --domain kaeso.example.com --dir /opt/kaeso --install-docker
```

What the installer does, in order:

1. Without Docker, it installs Docker Engine with Docker's own script from `get.docker.com` (`--install-docker` skips the question). As a user other than root, it adds you to the `docker` group and asks you to sign in again and run it once more.
2. It checks the domain's DNS record, downloads the newest stable release's `compose.yaml` into `/opt/kaeso`, and writes `.env` with random passwords. Only you can read the folder.
3. It generates the master key into `master-keys`, readable only by the gateway's user.
4. It turns on the updater, so **Update** in the console works, and starts every service with `docker compose up -d --wait`. The first start downloads about 2 GB of images and takes a minute or two.
5. It waits for Caddy's certificate and prints the one-time setup link.

To install a particular release instead of the newest one, add `--version 0.7.0`. `sh install.sh --help` lists every option.

## 4. Create the first user

Open the link the installer printed, and create the first user. It becomes the instance admin. The link works once, for 24 hours. To print a new one while no user exists:

```bash
cd /opt/kaeso
docker compose exec gateway kaeso setup-link
```

Then add a provider key and create an API key in the console, as the [quick start](https://docs.kaeso.app/get-started/quick-start#add-a-provider-key) shows. Apps reach Kaeso at `https://kaeso.example.com/v1`.

## 5. Add your SMTP server

The installer starts Kaeso with `KAESO_MAIL_TRANSPORT=log`: emails are only written to the gateway's log, and password sign-in and the setup link still work. To send them, switch to SMTP in `/opt/kaeso/.env` and add your server:

```bash
cd /opt/kaeso
sed -i 's/^KAESO_MAIL_TRANSPORT=log$/KAESO_MAIL_TRANSPORT=smtp/' .env
cat >> .env <<'EOF'
KAESO_SMTP_HOST=smtp.example.com
KAESO_SMTP_USER=kaeso
KAESO_SMTP_PASSWORD=your-password
KAESO_SMTP_FROM="Kaeso <kaeso@example.com>"
EOF
docker compose up -d --wait
docker compose exec gateway kaeso mail test you@example.com
```

The last command sends a test email and prints what the SMTP server answered. Set `KAESO_SMTP_USER` and `KAESO_SMTP_PASSWORD` together, or neither for a server without authentication: since 0.7.0, a user without a password stops the gateway at startup. Some hosting providers block outgoing mail ports on new servers; the provider guides say which.

## 6. Keep the master key

Kaeso encrypts the provider keys it stores with the master key in `/opt/kaeso/master-keys`. A database backup can't be read without it. Copy it into a password manager, apart from your backups:

```bash
sudo cat /opt/kaeso/master-keys
```

## Check the settings

Every change to `.env` or `compose.override.yaml` takes effect with `docker compose up -d --wait`. Before you apply one, the gateway can check it without starting and without a database:

```bash
docker compose run --rm --no-deps gateway config check
```

It prints `The configuration is valid.`, or the error the gateway would stop with and how to fix it, and names any `KAESO_` variable that names no setting, such as a misspelled one. [Configuration](https://docs.kaeso.app/self-hosting/configuration) lists every setting; put your own changes to the services in `compose.override.yaml`, which updates never replace.

## Back up the volumes

Kaeso keeps its data in Docker volumes of the Compose project `kaeso`:

| Volume | Holds | Back up |
| --- | --- | --- |
| `kaeso_postgres` | Users, organizations, projects, keys, encrypted provider keys, usage, audit logs | Yes, with `pg_dump` |
| `kaeso_clickhouse` | Request logs | If you want to keep the log history |
| `kaeso_valkey` | Counters and caches, rebuilt from PostgreSQL | No |
| `kaeso_caddy_data` | The certificate and Caddy's account | Optional; Caddy gets a new one |

Dump PostgreSQL while Kaeso runs, for example from a daily cron job, and copy the dumps off the server:

```bash
cd /opt/kaeso
docker compose exec -T postgres pg_dump -U kaeso -Fc kaeso > kaeso-$(date +%F).dump
```

Keep `compose.yaml`, `.env` and `compose.override.yaml` with the dumps, and `master-keys` somewhere else. [Backups and master keys](https://docs.kaeso.app/self-hosting/backups) shows how to restore a dump, how to back up ClickHouse and how to rotate the master key. A snapshot of the whole server from your provider is a good second copy, but not a replacement for dumps: a snapshot taken while PostgreSQL writes may not restore cleanly.

## Update to the next release

The gateway looks for new releases every 5 minutes, and instance admins see them under **Instance** › **Updates**. Three ways to update:

- **From the console:** **Update to …** checks the release's signatures, downloads the images, checks that the new gateway accepts your settings, and switches over in about a minute. If anything fails before the switch, nothing changes; if the new version doesn't start, the updater rolls back.
- **Automatically:** choose **Automatically** and an update window, daily or weekly.
- **With the installer:** `sh install.sh --update --version 0.7.0` in `/opt/kaeso` checks the new `compose.yaml` against the release's manifest, checks your settings with the new gateway before it stops the old one, and starts the release.

Back up PostgreSQL first. Database migrations only move forward, so going back means restoring the dump ([upgrades](https://docs.kaeso.app/self-hosting/upgrades#downgrade)).

### From 0.6 to 0.7

0.7.0 refuses three settings that 0.6.0 accepted. Look for them in `.env` and `compose.override.yaml` before you update:

- `KAESO_KPMR_INTERVAL` below `5m`: set `5m` or longer, or remove it.
- `KAESO_MCP_SERVERS_SYNC_INTERVAL` below `1m`: set `1m` or longer, or remove it.
- `KAESO_SMTP_USER` without `KAESO_SMTP_PASSWORD`: add the password, or remove the user.

An update from the console or the installer that still finds one stops before it switches anything, says which setting and how to fix it, and 0.6.0 keeps running. See [How Kaeso updates itself and checks your settings](https://kaeso.app/articles/updates-and-config-check) and the [Kaeso 0.7 article](https://kaeso.app/articles/kaeso-0-7) for what else changed.

## What 0.7 adds for a server

- **Outgoing connections.** [Guardrails](https://kaeso.app/articles/guardrails-in-kaeso) and webhooks call the addresses your organizations add, over HTTPS. A private address only works when `guardrails.allowed_networks` or `webhooks.allowed_networks` lists its network, so a guardrail service on the same server or LAN needs that setting ([configuration](https://docs.kaeso.app/self-hosting/configuration#guardrails)).
- **Amazon Bedrock and Azure keys** are stored like any other provider key in [weighted key pools](https://kaeso.app/articles/provider-key-pools); the server only needs to reach the provider's endpoint.
- **OpenTelemetry traces** go to the collector in `KAESO_OTEL_ENDPOINT` when you set it, and `/metrics` stays on the gateway's loopback address.
- **Several gateways** on one server: `GATEWAY_REPLICAS=2` in `.env` runs two behind Caddy, which share [hard budgets, rate limits](https://kaeso.app/articles/budgets-limits-and-usage) and [route cooldowns](https://kaeso.app/articles/retries-and-fallbacks) through Valkey ([scaling](https://docs.kaeso.app/self-hosting/scaling)).

## Troubleshooting

| What you see | What to do |
| --- | --- |
| The browser shows no certificate | `docker compose logs caddy` shows Let's Encrypt's answer. Check that the DNS record points at this server and that ports 80 and 443 are open from the internet |
| The gateway keeps restarting | `docker compose run --rm --no-deps gateway config check` prints the reason |
| No email arrives | `docker compose exec gateway kaeso mail test you@example.com` prints the SMTP server's answer. A timeout often means the provider blocks the port |
| ClickHouse is killed for memory | Give the server 4 GB or more, or [turn request logs off](https://docs.kaeso.app/self-hosting/installation#turn-request-logs-off); usage, limits and budgets work the same |
| The setup link has expired | `docker compose exec gateway kaeso setup-link` prints a new one while no user exists |
| "Kaeso is already installed on this machine" | Kaeso runs once per Docker host. Run the installer in the folder it names |

[Troubleshooting](https://docs.kaeso.app/self-hosting/troubleshooting) in the docs covers more.

## What was tested

For this guide, the 0.7.0 `compose.yaml` was resolved with Docker Compose 2.24 and 5 with the `.env` the installer writes, with SMTP added, with request logs off and with the updater on. The 0.7.0 gateway checked every setting above with `kaeso config check`, refused the three settings 0.7.0 no longer takes, and started against PostgreSQL, ClickHouse and Valkey with `/readyz` ready and a setup link. During the 0.7.0 release, a fresh Debian server was installed with the 0.6.0 installer and updated to 0.7.0 from the console, with its data intact, and an install with `KAESO_KPMR_INTERVAL=1m` stopped that update before anything changed, as described above.

## Next steps

- [Where to run Kaeso](https://kaeso.app/articles/where-to-run-kaeso): every other path, from platforms to Kubernetes.
- [Domains and TLS](https://docs.kaeso.app/self-hosting/domains-and-tls): your own certificate, or Kaeso behind a proxy you already run.
- [Health and metrics](https://docs.kaeso.app/self-hosting/monitoring): watch the install.

Product names in this guide belong to their owners and are used only to name the software and services involved. Kaeso is not affiliated with or endorsed by them.

By Kaeso Team

## More articles

- [Kaeso on LiteLLM’s own benchmark](https://kaeso.app/articles/kaeso-on-litellms-benchmark.md): We ran ai-gateway-bench, the benchmark from BerriAI, the company behind LiteLLM, with Kaeso 0.7.0 beside LiteLLM, Bifrost and Portkey. These are the numbers and the evidence behind each one.
- [How to benchmark an AI gateway without fooling yourself](https://kaeso.app/articles/benchmarking-ai-gateways-honestly.md): What we got wrong and fixed while running Kaeso against LiteLLM, Bifrost and Portkey on BerriAI’s benchmark, and the checks that make a gateway benchmark worth reading.

[See all articles](https://kaeso.app/articles.md)

## Own the gateway. Own the record

```bash
curl -fsSL https://kaeso.app/install.sh | sh
```

[Install Kaeso](https://docs.kaeso.app/self-hosting/installation) · [Open the live demo](https://demo.kaeso.app)
