How to Deploy Kavita on a VPS
Updated Nov 2026
verified on Ubuntu 26.04 · Nov 2026Self-host Kavita, a reading server for manga, comics and ebooks, with Docker Compose behind Caddy HTTPS, a first admin, tested backup and restore.
- A VPS with 1 GB+ RAM (the catalog floor is 512 MB; large libraries want more)
- A fresh Ubuntu 24.04 or 26.04 server with root/sudo SSH access
- A domain or subdomain you can point at the server
- Your comics, manga or ebooks, ready to copy to the server
What Kavita is
Kavita is a self-hosted reading server for manga, webtoons, comics (cbz, cbr, zip, rar, 7z) and books (EPUB, PDF), with web readers, collections, reading lists and multiple user accounts. It is licensed GPL-3.0, written in C# on .NET with an Angular front end, and keeps its data in a SQLite database inside its config folder, so it is a single container.
This guide goes from a fresh server to Kavita on HTTPS with the admin account created and a backup you have restored.
Server sizing
The catalog floor for Kavita is 512 MB of RAM. On the catalog's test box it idled at 327 MB and the install used under 1 GB of disk. Library scans and cover generation use more than idle, and disk is set by your books: add the size of the library, plus room for covers and backups.
For choosing a provider and tier, see Best VPS for self-hosting.
Prepare the server
Update the system and install the few tools this guide uses:
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y curl openssl ufw dnsutils
Working as root? Create a sudo user first and continue as that user:
adduser deploy
usermod -aG sudo deploy
Open SSH and the two ports the reverse proxy needs:
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
The Compose file below binds Kavita to 127.0.0.1, leaving Caddy as the only public door. Docker publishes container ports around ufw, so a port bound to
all interfaces would be reachable from the internet whatever the firewall says.
Paid link — we earn a commission if you shop through it.
Install Docker
The convenience script installs Docker Engine and the Compose plugin (Docker and Compose on Ubuntu explains the details):
command -v docker >/dev/null || curl -fsSL https://get.docker.com | sudo sh
sudo docker compose version
Install Kavita
Set your hostname and an admin email (replace the examples). The guard keeps the step safe to re-run:
mkdir -p ~/kavita/config ~/kavita/library && cd ~/kavita
if [ ! -f .env ]; then
( umask 077
{
echo "DOMAIN=read.example.com"
echo "ADMIN_USER=admin"
echo "ADMIN_EMAIL=admin@example.com"
echo "ADMIN_PASSWORD=$(openssl rand -hex 12)"
} > .env )
fi
grep -c -E '^(DOMAIN|ADMIN_USER|ADMIN_EMAIL|ADMIN_PASSWORD)=' .env
The Compose file pins the image to 0.9.1 (in this guide's test run that image
reported itself as v0.9.1.4). config holds the database,
settings and covers; library is mounted at /manga:
cd ~/kavita
cat > docker-compose.yml <<'EOF'
services:
kavita:
image: jvmilazz0/kavita:0.9.1
restart: unless-stopped
environment:
TZ: Etc/UTC
ports: ["127.0.0.1:5000:5000"]
volumes:
- ./config:/kavita/config
- ./library:/manga
caddy:
image: caddy:2
restart: always
ports: ["80:80", "443:443"]
environment:
DOMAIN: ${DOMAIN}
volumes: ["./Caddyfile:/etc/caddy/Caddyfile:ro", "caddy_data:/data"]
depends_on: [kavita]
volumes:
caddy_data:
EOF
cat > Caddyfile <<'EOF'
{$DOMAIN} {
encode zstd gzip
reverse_proxy kavita:5000
}
EOF
Create the admin account
The first account registered on a Kavita server becomes its administrator, and anyone who reaches an unclaimed server can register it. So start Kavita alone first and claim it over the loopback port, before Caddy publishes anything:
cd ~/kavita
sudo docker compose up -d kavita
for i in $(seq 1 60); do
curl -fsS http://127.0.0.1:5000/api/health >/dev/null 2>&1 && break
sleep 3
done
. ./.env
curl -s -o /dev/null -w 'register: %{http_code}\n' -H 'Content-Type: application/json' --data @- \
http://127.0.0.1:5000/api/Account/register <<EOF
{"username":"$ADMIN_USER","email":"$ADMIN_EMAIL","password":"$ADMIN_PASSWORD"}
EOF
register: 200 means the account exists. A second registration through the same
endpoint is refused (400) once an admin exists. Now start Caddy:
cd ~/kavita
sudo docker compose up -d
sudo docker compose ps
HTTPS and domain
Create an A record for your hostname (this guide uses read.example.com) pointing at
the server's public IP, and check that it resolves:
dig +short read.example.com
Caddy requests the certificate once the name resolves and renews it by itself (see Automatic HTTPS with Caddy). Wait for it, with a bounded loop so a broken setup fails instead of hanging:
cd ~/kavita
. ./.env
out=000
for i in $(seq 1 40); do
out=$(curl -s -o /dev/null -w '%{http_code} %{ssl_verify_result}' "https://$DOMAIN/api/health")
[ "$out" = "200 0" ] && break
sleep 5
done
echo "HTTPS status and certificate check: $out"
[ "$out" = "200 0" ]
200 0 means the page answered and the certificate verified.
Then sign in over HTTPS with the new credentials:
cd ~/kavita
. ./.env
curl -s -o /dev/null -w 'login: %{http_code}\n' -H 'Content-Type: application/json' --data @- \
"https://$DOMAIN/api/Account/login" <<EOF
{"username":"$ADMIN_USER","password":"$ADMIN_PASSWORD"}
EOF
Open https://read.example.com, sign in with the password from
grep ADMIN_PASSWORD ~/kavita/.env, change it, and add a library pointing at
/manga. Copy files into ~/kavita/library, one folder per series, which is
the layout Kavita's scanner expects.
Backups
Everything Kavita knows (users, reading progress, collections, settings, covers)
is in ~/kavita/config. Your books are separate files in ~/kavita/library.
Stop the container so SQLite is not copied mid-write, archive the config and the
project files, then start it again. The archive holds password hashes and the
token key, so it is created readable by its owner only:
cd ~/kavita
sudo docker compose stop kavita
( umask 077; sudo tar czf - config docker-compose.yml Caddyfile .env > ~/kavita-backup-$(date +%F).tar.gz )
sudo docker compose start kavita
sudo tar tzf ~/kavita-backup-$(date +%F).tar.gz | grep -E 'kavita.db$|appsettings.json'
Back up ~/kavita/library separately (rsync or your usual file backup) and copy
both off the server.
Restore
This replaces the current config with the one in the archive. Rehearse it once, right after taking a backup. The old folder is moved aside rather than deleted:
cd ~/kavita
sudo docker compose down
sudo mv config config.before-restore
sudo tar xzf ~/kavita-backup-$(date +%F).tar.gz
sudo docker compose up -d
for i in $(seq 1 60); do
curl -fsS http://127.0.0.1:5000/api/health >/dev/null 2>&1 && break
sleep 3
done
. ./.env
curl -s -o /dev/null -w 'login after restore: %{http_code}\n' -H 'Content-Type: application/json' --data @- \
http://127.0.0.1:5000/api/Account/login <<EOF
{"username":"$ADMIN_USER","password":"$ADMIN_PASSWORD"}
EOF
200 means the account came back from the archive. The check uses the password
in .env; if you changed it in the web UI, sign in with yours instead. Delete
config.before-restore once you are satisfied. On a new server, install Docker,
unpack the same archive into an empty ~/kavita, restore the library and run
sudo docker compose up -d.
Upgrades
The image tag is pinned, so an upgrade is an edit. Read the
release notes, take a backup,
change the jvmilazz0/kavita tag in docker-compose.yml, then:
cd ~/kavita
sudo docker compose pull
sudo docker compose up -d
sudo docker compose logs --tail 20 kavita
Kavita migrates its database on start, and going back to an older version means restoring the backup. Docker Hub tags do not always match GitHub release numbers one to one, so check that the tag exists before editing.
Troubleshooting
Caddy returns 502. Check sudo docker compose ps and
sudo docker compose logs kavita. The first start can take a little while.
The library scans but finds nothing. The library path inside Kavita is
/manga, not the host path, and files should sit in series folders.
Caddy never gets a certificate. Confirm the DNS record points at this server and that your provider's network firewall allows inbound 80 and 443.
Registration is refused. An admin already exists. Sign in with it, or restore your backup.
Verification and next steps
You are done when https://read.example.com loads over a valid certificate, you
can sign in, a scanned book opens in the reader, and you have restored a backup
once. See the Kavita entry for catalog details.
Next steps
Common questions
How long does it take to follow "How to Deploy Kavita on a VPS"?
We estimate about 20 minutes of hands-on time for "How to Deploy Kavita on a VPS"; this is an editorial estimate, not a measurement.
Was the "How to Deploy Kavita on a VPS" guide tested?
The "How to Deploy Kavita on a VPS" guide was verified end-to-end on Ubuntu 26.04 (Nov 2026).