How to Install Open WebUI on Ubuntu 24.04
A step-by-step installation guide.
Introduction
Open WebUI is the best self-hosted UI for Ollama β ChatGPT-like with RAG, multi-user, voice, image gen, plugins. Connects to Ollama, OpenAI APIs & more. Deploy on Ubuntu 24.04 with Docker behind Nginx + SSL.
Prerequisites
- Ubuntu 24.04 Β· 2 vCPU / 2 GB RAM min (4 vCPU / 4 GB+ for RAG)
- Docker (24.x+) + Compose v2 Β· Ollama on localhost:11434
- Ports 80/443 open Β· domain β server IP
π‘ Have Ollama? Open WebUI connects via
OLLAMA_BASE_URL.1 β Install Docker
curl -fsSL https://get.docker.com | sudo sh sudo usermod -aG docker $USER && newgrp docker docker --version && docker compose version
2 β Docker Compose
~/open-webui/docker-compose.yml:
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
restart: unless-stopped
ports: ["3000:8080"]
volumes: [./open-webui:/app/backend/data]
environment:
- OLLAMA_BASE_URL=http://host.docker.internal:11434
- WEBUI_SECRET_KEY=*** - WEBUI_NAME=My AI
- DEFAULT_MODELS=llama3.2:latest
- ENABLE_SIGNUP=true
β οΈ Linux:
host.docker.internal won't resolve. Use host LAN IP or extra_hosts: - "host.docker.internal:host-gateway".openssl rand -hex 32 docker compose up -d
Visit http://your-ip:3000 β create admin account.
3 β Nginx + SSL
sudo apt install -y nginx certbot python3-certbot-nginx
/etc/nginx/sites-available/open-webui:
server {
listen 80; server_name your-domain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2; server_name your-domain.com;
ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 86400s;
}
}
sudo ln -s /etc/nginx/sites-available/open-webui /etc/nginx/sites-enabled/ sudo nginx -t && sudo certbot --nginx -d your-domain.com sudo systemctl reload nginx
Env Vars
OLLAMA_BASE_URLβ Ollama endpoint (def:http://localhost:11434)WEBUI_SECRET_KEYβ Session key. Generate:openssl rand -hex 32WEBUI_NAMEβ Custom display nameDEFAULT_MODELSβ Pre-selected models (CSV)ENABLE_SIGNUPβfalse= no public registration (def:true)RAG_EMBEDDING_ENGINEβ Embedding backend (def:ollama)RAG_TOP_Kβ Chunks per RAG query (def:5)
Bundles ChromaDB.
Backups
cd ~/open-webui && tar -czf bk-$(date +%F).tar.gz ./open-webui
Cron (3 AM, 30-day retention):
0 3 * * * cd /home/ubuntu/open-webui && tar -czf /backups/ow-$(date +\%F).tar.gz ./open-webui && find /backups -name 'ow-*.tar.gz' -mtime +30 -delete
Updating
cd ~/open-webui && docker compose pull && docker compose up -d
β οΈ Back up first β DB migrations are one-way.
Troubleshooting
DB migration fails
Check docker compose logs --tail=100, restore backup. Manual guide.
Ollama refused
sudo systemctl status ollama;curl localhost:11434/api/tags- Set
OLLAMA_HOST=0.0.0.0:11434if 127.0.0.1 only docker exec open-webui curl http://<host>:11434/api/tags
host.docker.internal fails
Docker Desktop only β not Docker Engine on Linux. Fixes:
- Host LAN IP β
http://192.168.1.50:11434 - extra_hosts β
extra_hosts: - "host.docker.internal:host-gateway" - network_mode: host β WebUI on port 8080
#install_guide