Captivo Portal on-premise installation
Run Captivo Portal on your own Linux server with Docker: what you need, the two-command install, the ten-step setup wizard, HTTPS, upgrades, offline installs and backups. Guest data stays on your server.
Requirements
The package is a set of Docker containers: the web panel, PostgreSQL, FreeRADIUS and the 5651 log server (logd), plus an optional Caddy for HTTPS.
| Item | Requirement |
|---|---|
| Operating system | Linux x86_64 (amd64). Ubuntu 22.04+, Debian 12+ or RHEL 9+ recommended. |
| Memory | 2 GB minimum, 4 GB recommended. |
| Disk | 10 GB free minimum, 20 GB or more recommended. Each release leaves old image layers behind (the installer cleans the superseded ones), and the 5651 log database and backups grow over time. |
| Software | Docker Engine 24+, Docker Compose v2 (docker compose with a space; the old docker-compose v1 is not supported) and openssl. |
| Address | A fixed LAN IP is enough for a test (for example 192.168.1.10). For production use a DNS name with HTTPS. |
Firewall ports
Inbound to the server:
| Port | Used for |
|---|---|
| 3000/TCP | The panel and the guest portal over plain HTTP. The compose file always publishes it, with or without Caddy. |
| 80/TCP, 443/TCP | Caddy, only when you start the tls profile. |
| 1812/UDP, 1813/UDP | RADIUS authentication and accounting. Open them to your NAS addresses only. |
| 514/UDP, 514/TCP | Syslog into the 5651 log server. The logd container publishes it always, so close it to everything except your gateways if you do not use the log module. |
The database port 5432 is not published; PostgreSQL is reachable only on the internal container network. Example hardening for the NAS at 10.0.0.2: ufw allow from 10.0.0.2 to any port 1812 proto udp.
Outbound from the server, only for what you use:
| Destination | When |
|---|---|
| Your SMTP server, TCP 587 or 465 | E-mail verification, reports, notifications. |
| SMS provider API, TCP 443 | SMS sign-in. |
app.captivo.io, TCP 443 | Daily licence pull, only when a licence key is saved. Not needed with a .lic file. |
captivo.io, TCP 443 | The update check reads latest-version.json. If it cannot be reached the panel simply shows no update notice. |
| Webhook, PMS and UniFi controller addresses | Only if you use those features. |
*.kamusm.gov.tr, TCP 80 | Only for KamuSM timestamps in the log server. |
| Let's Encrypt, TCP 80/443 | Only for automatic HTTPS certificates. |
Step 1: install
The package unpacks into one captivo-onprem/ directory. Keep its structure: docker-compose.onprem.yml, PACKAGE-VERSION and README.md at the top, and onprem/ with install.sh, backup.sh, Caddyfile, VERSION, .env.onprem.example and certs/. Run everything from the top directory.
curl -fsSL https://captivo.io/onprem/captivo-onprem.tar.gz | tar xz
cd captivo-onprem
./onprem/install.shThe installer, in order:
- Checks that docker and openssl exist and prints the package stamp from PACKAGE-VERSION (it warns if the file is missing, which means a stale package).
- If
.env.onpremdoes not exist it creates it. It asks Server address (the address guests use to reach this server…) and offers the detected LAN IP, for examplehttp://192.168.1.10:3000; press Enter to accept. If you setNEXTAUTH_URLorSITE_DOMAINin the environment, or the terminal is not interactive, it does not ask. An address containing localhost or 127.0.0.1 gets a warning, because guest phones cannot reach it; the panel itself still opens from any address. - Generates every secret with openssl (database password, AUTH_SECRET, ENCRYPTION_KEY, DATA_ENCRYPTION_KEY, LOGD_CONTROL_SECRET, DOT1X_VERIFY_SECRET) and pins CAPTIVO_VERSION to the version in onprem/VERSION. On a re-run it keeps the existing file and never regenerates the secrets that data depends on.
- Starts PostgreSQL alone and checks that the password in .env.onprem really opens the database volume, so a leftover volume from an older install fails here with a clear message instead of later in the migrator.
- Pulls the images (a failed pull is only a warning, so offline hosts continue), runs docker compose up -d, removes the images of the version you moved off, and prints Installation complete! Panel: <address>.
Running containers: captivo-postgres, captivo-radius, captivo-web, captivo-logd. A fifth, migrator, applies the database schema and then exits with code 0; the panel waits for it. Caddy (captivo-caddy) is not started by the installer; see HTTPS below.
.env.onprem to a password manager or an encrypted drive that is not on this server. If the key is lost, the encrypted data is gone for good, even if you restore a database backup.The .env.onprem file
| Variable | Meaning |
|---|---|
POSTGRES_USER / POSTGRES_PASSWORD / POSTGRES_DB | Database login. Defaults captivo / random 32 hex characters / captivo. The password is only read when the volume is first created: changing it later does not change the database. |
NEXTAUTH_URL | The permanent server address guests and devices use. Optional: if empty or localhost, e-mail links and the downloaded portal template fall back to the address of the request. Settings → System overrides it. |
SITE_DOMAIN | Domain Caddy requests a certificate for. Written as localhost when you gave an IP. |
AUTH_SECRET, ENCRYPTION_KEY | Generated session and encryption secrets. Keep them in the backup of this file. |
DATA_ENCRYPTION_KEY | The key for stored guest data and credentials. Losing it loses that data. |
LOGD_CONTROL_SECRET, DOT1X_VERIFY_SECRET | Internal shared secrets between the panel and the log server, and between FreeRADIUS and the panel. Added automatically on upgrade if an older file lacks them. |
CAPTIVO_VERSION | The image tag to run, for example 1.157.1. The installer moves it to the version of the package you run. |
CADDY_TLS_BLOCK | Empty: Caddy gets a Let's Encrypt certificate. tls internal: Caddy's own CA, for tests only. tls /certs/cert.pem /certs/key.pem: your own certificate. |
RADIUS_ACCT_INTERIM_INTERVAL | Optional, not in the generated file. Seconds between the interim accounting updates the NAS is asked to send. Default 300; 0 leaves it to the NAS; values below 60 are raised to 60. |
CRON_SECRET | Optional and not needed: scheduled jobs run inside the application. |
After editing the file, apply it with docker compose -f docker-compose.onprem.yml --env-file .env.onprem up -d from the top directory.
Step 2: the setup wizard
Open http://<server-ip>:3000. Until setup is finished every panel address redirects to /setup, and after it /setup redirects to the dashboard. The wizard has ten steps; the circles at the top go back to finished steps. If you close the browser after step 1, reopening resumes at step 2 because the administrator already exists.
| Step | What you enter | Notes |
|---|---|---|
| 1. Admin Account | Full Name, Email, Password. | Creates the one organisation and its ADMIN user, e-mail pre-verified. The password follows the platform password policy (default: at least 8 characters, one capital letter and one digit), even though the field hint only says 8 characters. |
| 2. Organization | Organization Name, Time Zone (default Europe/Istanbul). | The time zone drives report, voucher and PMS dates. |
| 3. Server Address | For example http://192.168.1.10:3000. Skip is allowed. | localhost addresses are refused. Only scheme, host and port are kept. If you skip it, the address of each request is used. |
| 4. Portal Appearance | Primary Color, Welcome Message (both optional). | Button colour and the heading of the guest sign-in screen. Everything else is designed later under Settings → Portal. |
| 5. RADIUS | Nothing to type. | Creates the RADIUS configuration and shows the Shared secret and the API Key (for portal HTML files) with Copy buttons, plus the NAS values: this machine's IP, authentication port 1812, accounting port 1813. They stay available under Settings → RADIUS. |
| 6. Sign-in Methods | Tick at least one: SMS Verification, Email Verification, Voucher Code, Sponsor Approval, Local User, Hotel PMS. | Ticked methods are switched on, the others off. Changeable later. |
| 7. SMS Provider | SMS Provider (NetGSM, İleti Merkezi, Mutlu Cell, Twilio, Custom / Other), API Key (required), API Secret / Secret Key, Sender Name / Header (default CAPTIVO). Skip is allowed. | Credentials are stored encrypted. See the SMS topic. |
| 8. Email (SMTP) | SMTP Server, port (default 587), Username, Password, Sender Email (all required) and Sender Name; Use TLS / SSL is on by default. Skip is allowed. | The licence warning e-mail also needs this. |
| 9. License | Upload a .lic file, or Start 15-day trial. | There is no licence-key field and no Skip here; you must pick one. The trial clock starts when you click, not at install. |
| 10. Complete | Finish Setup. | Shows the encryption-key reminder. After you click, the wizard waits until the panel answers its health check, then opens the dashboard. |
Step 3: first sign-in and first checks
- Sign in at /login with the e-mail and password from wizard step 1. On-premise has local sign-in only; there is no Captivo ID button.
- Open Settings → License and check the status. After the trial choice it reads Trial with the days left. See licence, trial and read-only mode.
- Open Settings → System and confirm Address currently in use is the address guests will reach, not the one you happened to type in the browser.
- Add your NAS under Settings → RADIUS and continue with the quick start and your device guide. Use the shared secret from wizard step 5, and the server's LAN IP, ports 1812 and 1813, as the RADIUS server. See RADIUS.
- Download the portal template after the server address is final. Templates carry the address inside them, so a template downloaded before you changed it keeps pointing at the old one; download and upload it to the NAS again.
HTTPS with Caddy
Without TLS the panel works over plain HTTP; session cookies automatically use a mode browsers accept on HTTP. For production, put Caddy in front. It is a compose profile, so it only starts when you ask for it. Two settings in .env.onprem matter: SITE_DOMAIN (the name Caddy serves) and, optionally, NEXTAUTH_URL set to the same https address so it becomes the permanent server address.
Public name: Let's Encrypt
# in .env.onprem
SITE_DOMAIN=wifi.acme.example
NEXTAUTH_URL=https://wifi.acme.example
# start Caddy next to the other services
docker compose -f docker-compose.onprem.yml --profile tls --env-file .env.onprem up -dThe DNS name must resolve to this server and ports 80 and 443 must be reachable from the internet, because Let's Encrypt validates over them.
Internal name: your own CA
For a name such as captivo.acme.example that exists only in your DNS, issue a server-auth certificate from your CA (for example AD CS) with that name as SAN. Put cert.pem (leaf first, then the intermediates) and key.pem (PEM, no passphrase) into onprem/certs/, then:
# in .env.onprem
SITE_DOMAIN=captivo.acme.example
CADDY_TLS_BLOCK=tls /certs/cert.pem /certs/key.pem
docker compose -f docker-compose.onprem.yml --profile tls --env-file .env.onprem up -dhttps://captivo.acme.example, while Settings → System → Server Address stays on the plain LAN address, for example http://192.168.10.5:3000. Both work side by side. Because 3000 stays published, restrict who can reach it at the firewall if you do not want that.After an upgrade, run the --profile tls command again so Caddy stays in step with the other containers.
Settings → System
Visible to ADMIN and SUPERADMIN. Three cards:
- Server Address: the address guests and devices use; emails and downloaded portal templates take it. Type a full address such as
http://192.168.10.5:3000and click Save. localhost is refused, only scheme, host and port are stored, and the field cannot be saved empty. Address currently in use shows the result and where it came from: setting (saved here) or automatic — request/env. The same card shows Captivo Portal version and the refresh icon Check for updates now. - Scheduled Jobs: every background job of this server with last run, result, next expected run (UTC schedule) and a warning if it has not run for twice its interval. The jobs run inside the application, so no crontab is needed. This is the place to notice a job that stopped, including License Check (daily at 04:10 UTC) and Data Retention Cleanup (KVKK).
- Orphaned session records: RADIUS accounting rows that no organisation owns, usually from a NAS that sends user names without the prefix, or a device that connected before its whitelist entry existed. They show on no other screen and are deleted when the retention window ends. If Newest is close to today, the cause is still active: check the NAS.
Upgrading
When a newer version exists, a blue banner appears at the top of the panel with a link to the update guide, and Settings → System reads New version … available. The panel asks captivo.io for latest-version.json when someone opens it, at most once a day (a failed check is retried after an hour). The icon next to the version forces a check; if it cannot reach captivo.io it says so. An offline server just never shows the banner.
Upgrading is the install again, from the new package. Take a backup first (see below).
cd captivo-onprem # your existing installation (the directory that holds .env.onprem)
./onprem/backup.sh # optional but wise
curl -fsSL https://captivo.io/onprem/captivo-onprem.tar.gz | tar xz --strip-components=1
./onprem/install.shUnpack with --strip-components=1 from inside the installation directory. Unpacked without it, the package creates a nested captivo-onprem/ copy that has no .env.onprem; if you then run its installer, it notices the installation already running on the host and stops with these same commands instead of starting a second one. When an upgrade finishes it says Upgrade complete and the setup wizard does not run again: your data, settings and finished setup are kept.
The installer keeps .env.onprem and every secret, moves CAPTIVO_VERSION to the new package's version, refreshes the compose file, pulls the images, applies the schema through the migrator and removes the old images. If you unpack the new package into a different directory, copy your .env.onprem into it first, otherwise the installer creates a new file with a new database password and stops at the volume check. A plain docker compose pull is not an upgrade: the version is pinned in .env.onprem, so it fetches the version you already have.
Going back is editing CAPTIVO_VERSION to the older value and running up -d; schema changes already applied are not reverted, so keep the pre-upgrade backup.
When the migrator fails
The web container keeps running the old version, and nothing half-applied is written. Read the real error first: docker logs captivo-onprem-migrator-1 --tail 40 (the prefix is your directory name). Common causes: a full disk (No space left on device; free space with docker image prune -f and rerun the installer); a duplicate record (duplicate key value violates unique constraint, nothing was deleted; the error names the table, fix the rows and rerun); a warning that a unique constraint will be added is harmless and the migrator continues by itself. Any other data-loss warning stops the upgrade on purpose.
Coming from an old install whose runbook had /api/cron/… lines in the crontab? Delete them (crontab -l | grep '/api/cron/'), because the jobs now run inside the application and double triggers only cause extra runs. Keep the backup.sh line.
Air-gapped install
Build a bundle of the images on any machine with internet, move it by USB or file transfer, and load it on the target. Build it with the version in onprem/VERSION: the installer pins that version, so a bundle tagged latest would not match and the start would fail looking for images.
# on the internet-connected machine, inside captivo-onprem/
./scripts/onprem/build-offline-bundle.sh "$(cat onprem/VERSION)"
# creates captivo-onprem-1.157.1.tar (captivo-onprem, captivo-radius, captivo-logd, postgres:16-alpine, caddy:2)
# on the target server
docker load -i captivo-onprem-1.157.1.tar
./onprem/install.sh- The installer's pull fails and only warns; it then starts the local images.
- Enter the LAN IP at the wizard's Server Address step. Let's Encrypt cannot work offline: use a corporate CA certificate, or plain HTTP in a test.
- Licensing: use a
.licfile. With no licence key saved, the server never calls app.captivo.io. See licence and trial. - To upgrade, build a new bundle with the new version and repeat.
Backups
There is no backup or restore screen in the panel. onprem/backup.sh runs pg_dump inside the captivo-postgres container and writes a gzip file such as captivo-20261125-031500.sql.gz to BACKUP_DIR (default /opt/captivo-backups); it uses POSTGRES_USER and POSTGRES_DB (both default to captivo) and deletes backup files older than 7 days. Guests, sessions, settings and the 5651 raw logs with their signatures all live in that database. Run it nightly:
# crontab -e : every day at 03:15
15 3 * * * POSTGRES_USER=captivo BACKUP_DIR=/opt/captivo-backups /opt/captivo-onprem/onprem/backup.sh >> /var/log/captivo-backup.log 2>&1Also keep, off the server:
.env.onprem: a database dump is unreadable in its encrypted parts withoutDATA_ENCRYPTION_KEY.- Copies of the dump itself (another disk, NAS or object storage), because a failed server takes its local backups with it.
- The
uploadsDocker volume: logos and portal background images are files there and are not part of the database dump. Files you uploaded under Settings → Branding or Portal must be re-uploaded if it is lost.
The dump is plain SQL, so a restore on a fresh install (after the setup containers are up, into an empty database) reads it back with gunzip -c captivo-20261125-031500.sql.gz | docker exec -i captivo-postgres psql -U captivo captivo. Restore first on a spare machine and check the panel before you rely on it, and restore the same .env.onprem so the encryption key matches.
What exists only on-premise
| Only on-premise | Only on Cloud (absent here) |
|---|---|
|
|
On-premise has a single organisation, created by the wizard. SMTP, SMS and e-mail are configured per this one organisation: see e-mail (SMTP) and SMS.
Common problems
- The installer stops with “the database volume exists but its password does NOT match .env.onprem”. A volume from an earlier install holds a different password. Either restore the matching
.env.onprem, or, only if the old data is expendable, rundocker compose -f docker-compose.onprem.yml --env-file .env.onprem down -v(this deletes the data) and install again. - The panel does not open. Run
docker compose -f docker-compose.onprem.yml --env-file .env.onprem ps:captivo-webmust be up andmigratormust have exited with 0. Then check that port 3000 is open at the firewall and readlogs web. - Wizard shows again or the panel redirects to /locked. The wizard shows until step 10 is finished.
/lockedis a licence matter, see licence, trial and read-only mode. - Guests cannot reach the portal, or SMS never arrives. Check the Server Address and the NAS walled garden: portal does not open.
- RADIUS rejects everything. The shared secret must match exactly on the NAS and under Settings → RADIUS, the NAS must reach UDP 1812 and 1813, and
docker logs captivo-radiusshows what the server saw. See RADIUS.
For product-wide problems: The portal does not open · Sign-in is rejected · Sessions do not appear