Open WebUI provides a browser interface for conversations with model servers. This recipe includes a private Ollama backend and a small model, so you can try the entire chat path without exposing either backend to the Internet. Open WebUI has its own license and branding conditions; self-hosting does not grant unrestricted rebranding rights.
Target: Ubuntu Server 24.04 LTS, x86-64, SSH and a sudo account. Documentation reviewed 15 November 2026. Commands have not been tested end to end on Ubuntu.
Before you start
Budget about 4 vCPUs, 8 GB RAM and 20 GB free disk for this combined small-model evaluation. The UI and model have separate memory needs. An external model API can reduce inference requirements, but may transmit prompts outside the VPS and incur charges.
Resource figures are planning estimates for a small evaluation, not performance guarantees or plan specifications. A VPS/VDS does not imply a GPU. Check available memory, storage and resources before ordering.
On a fresh Ubuntu installation, use the packages below. If Docker is already installed from another repository, keep that installation and check compatibility first: do not mix Docker CE and docker.io packages. Use Compose v2; if the package is missing, check that Ubuntu Universe is enabled.
sudo apt update
sudo apt install -y docker.io docker-compose-v2 curl openssl
sudo systemctl enable --now docker
sudo docker compose version
All examples publish ports only on the server’s 127.0.0.1. Access them from your computer through an SSH tunnel; a domain is unnecessary. Do not open these ports to the Internet. An internal container listener on 0.0.0.0 does not change the host’s loopback-only published port.
Each project below is a new installation. Do not rerun secret-generation steps against an existing deployment.
1. Save the private chat stack
Generate one stable secret key. Save the YAML as compose.yaml; only the UI is published, and only on loopback. The hostname ollama is Docker service DNS, not your laptop’s localhost.
umask 077
mkdir -p ~/ai-webui
cd ~/ai-webui
printf 'WEBUI_SECRET_KEY=%s\n' "$(openssl rand -hex 32)" > .env
services:
ollama:
image: ollama/ollama:latest
restart: unless-stopped
environment:
OLLAMA_NUM_PARALLEL: "1"
OLLAMA_CONTEXT_LENGTH: "2048"
volumes:
- models:/root/.ollama
webui:
image: ghcr.io/open-webui/open-webui:main
restart: unless-stopped
ports:
- "127.0.0.1:3000:8080"
environment:
OLLAMA_BASE_URL: http://ollama:11434
WEBUI_SECRET_KEY: ${WEBUI_SECRET_KEY:?set WEBUI_SECRET_KEY in .env}
volumes:
- webui:/app/backend/data
depends_on:
- ollama
volumes:
models:
webui:
2. Start and bootstrap your administrator
Run the first block on the VPS, then the SSH command on your computer. Open http://127.0.0.1:3000 and create your first administrator before sharing the tunnel or endpoint. In the Admin Panel confirm that new signups are disabled after bootstrap. Never turn off authentication to fix a login problem.
sudo docker compose up -d
sudo docker compose exec ollama ollama pull qwen2.5:0.5b
curl --fail-with-body http://127.0.0.1:3000/health
ssh -N -L 127.0.0.1:3000:127.0.0.1:3000 YOUR_USER@YOUR_SERVER_IP
3. Verify chat and protect the workspace
Choose the downloaded model and ask a short nonconfidential question. If the list is empty, check the Ollama connection URL and container logs; 127.0.0.1:11434 inside the UI container would point to the wrong container. Keep tools/functions disabled until reviewed. Back up the webui volume and .env together; preserve the secret key because stored credentials may depend on it. The model volume can be large, so retain model identifiers if you intend to download weights again instead of copying them.
Updates and recovery
Before upgrading, stop the application for a consistent backup, keep data and secrets off the VPS, and test recovery on a separate instance. Moving image tags in these examples are for initial evaluation; pin a reviewed release tag or digest before ongoing use. Record the current digest with sudo docker image inspect IMAGE_NAME --format '{{json .RepoDigests}}'. Avoid unattended upgrades without compatibility checks, and do not delete persistent volumes with down -v.
If startup fails, inspect sudo docker compose ps, recent logs, free disk and memory. Do not share logs containing keys, prompts or personal data. For directory-permission errors, check the expected UID/GID and ownership instead of granting 777. Set up HTTPS, authentication and request limits before sharing access.