Short answer: Ollama runs the model and serves it on an API, Open WebUI gives it a ChatGPT-style browser interface, and a docker compose file with both of them is the fastest way to get a private chat UI running on a VPS. The one thing to be honest about first: without a GPU, a VPS only runs small quantized models at readable speed — this guide is CPU-only, like almost every VPS on the market.
What you need
| Model size | RAM needed | Realistic use |
|---|---|---|
| 1–3B (llama3.2:3b, qwen2.5:3b) | 4 GB | Fast replies, basic chat and summarizing |
| 7–8B (llama3.1:8b, mistral:7b) | 8 GB | Noticeably slower per token, better answers |
| 13B+ | 16 GB+ | Workable but slow; expect tens of seconds per reply |
These are RAM figures for the default 4-bit quantized models Ollama pulls — the model itself needs roughly that much memory loaded, plus headroom for the OS and Open WebUI. Disk: a 3B model is 2–3 GB, an 8B model 4–5 GB, downloaded once and cached locally.
Install Docker, then run both containers
Start from a working Docker install — see installing Docker on Ubuntu and Debian if it is not already on the server.
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
volumes:
- ollama:/root/.ollama
# Uncomment to use an NVIDIA GPU, if the server actually has one:
# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: all
# capabilities: [gpu]
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
restart: unless-stopped
ports:
- "127.0.0.1:8080:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
volumes:
- open-webui:/app/backend/data
depends_on:
- ollama
volumes:
ollama:
open-webui:docker compose up -d
docker compose logs -f open-webui # Ctrl-C once it says "Application startup complete"Open WebUI’s port is bound to 127.0.0.1 on purpose — the panel has no login screen until you create the first account, and that account becomes the instance’s admin. Reach it over an SSH tunnel first, create the account, then decide whether to expose it publicly at all (next section).
ssh -L 8080:localhost:8080 root@203.0.113.10
# then open http://localhost:8080 in your own browserPulling a model
docker exec -it ollama ollama pull llama3.2:3b
docker exec -it ollama ollama listOpen WebUI also has a model picker under Admin Settings → Models that pulls from Ollama’s library without touching a terminal — useful once the stack is running and you only want to try a different model size.
Exposing it beyond localhost (optional)
If more than one person needs access, put it behind a reverse proxy with its own authentication and TLS rather than opening 8080 to the internet directly — Open WebUI’s own login is enough for a single user, but it was not designed to be the only thing standing between the internet and an LLM that can execute tool calls if you enable them.
server {
listen 443 ssl;
server_name chat.example.com;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; # Open WebUI uses websockets
proxy_set_header Connection "upgrade";
}
}The certificate and the rest of the nginx setup are covered in nginx as a reverse proxy with Let’s Encrypt.
Open WebUI + Ollama vs. LM Studio
LM Studio is a desktop app with its own chat UI and model browser — simpler to start with on a personal computer, but it is not meant to run headless on a server the way Ollama is. On a VPS, Ollama’s API-first design and Open WebUI’s browser-based front end are the combination that actually fits: nothing needs a desktop session, and the same Ollama API can serve other tools (editor plugins, scripts) besides the chat UI.
Updating and maintenance
docker compose pull
docker compose up -dModels and chat history live in the ollama and open-webui named volumes, untouched by an image update — docker compose down (without -v) is safe to run before pulling new images.
For the rest of the Docker commands used above — logs, exec, volumes, cleaning up old images — see the Docker commands cheat sheet.
Running an automation tool like n8n alongside Ollama on the same VPS is a common next step — n8n’s HTTP Request node can call the Ollama API directly on http://ollama:11434 if both are on the same Docker network.
Frequently asked
Can I run Ollama and Open WebUI without a GPU?
Yes — Ollama runs on CPU by default. It is simply slower: a small 3B model answers in a few seconds on a modern VPS core, while a 70B model on CPU alone can take minutes per reply. Size the model to the hardware, not the other way round.
How much RAM does Ollama need?
Roughly as much as the model's quantized size: 4 GB comfortably runs a 3B model, 8 GB a 7–8B model. The default models Ollama pulls are already 4-bit quantized, which keeps the RAM figure close to the model's size on disk.
Is Open WebUI safe to expose to the internet?
Only behind its own authentication and ideally a reverse proxy with TLS — the first account created becomes the admin, and there is no login screen before that. Binding it to 127.0.0.1 and reaching it over an SSH tunnel is the simplest safe setup for a single user.
What is the difference between Ollama and LM Studio?
LM Studio is a desktop app with its own GUI, built to run on a personal computer with a screen. Ollama is API-first and runs headless, which is what a VPS needs — Open WebUI then supplies the browser interface LM Studio would otherwise provide.