Install Open WebUI: Local AI with Ollama, Postgres, SearXNG and Tika
Self-host Open WebUI with Docker Compose: Ollama for local models, Postgres with pgvector, Tika for documents and SearXNG web search that asks before every query.
Watch on YouTube
Contents
Open WebUI 0.13.3Ollama 0.40.16PostgreSQL 18 with pgvector 0.8.7Apache Tika 4.2.0SearXNG 2026.11.15Caddy 2.11Docker 29.9Debian 13Open WebUI is a web interface for language models that works like ChatGPT but runs on your server. Together with Ollama, your chats, documents and models stay with you. This guide doesn’t stop at a minimal install. It builds a setup for daily use:
- Ollama runs the language models locally.
- Postgres with pgvector stores chats, users and the vectors of your documents.
- Apache Tika extracts text from PDFs, Word files and spreadsheets.
- SearXNG searches the web without sending your queries to a commercial search API.
- Approval before web search: Before a search query leaves the server, Open WebUI shows it and waits until you allow it. Everything that stays on the server runs without asking.
- Caddy gets the HTTPS certificate.
After that I show how to add your own documents as knowledge, create skills and combine everything into a model preset.
Prerequisites
qwen3:14b (9.3 GB) fits together with its context. How to pass the card through to Docker is covered in the Ollama documentation. Models also run without a GPU, but too slowly for web search and documents. What that means in numbers, and what the alternative is, is in the section Without a GPU.sudo and use Debian 13.{{domain}}. It needs an A record pointing to your server’s IP address, and ports 80 and 443 must be open. If your server runs at home without a public IPv4 address, make it reachable with Pangolin.Step 1: Directory and secrets
Create the project directory:
mkdir -p ~/open-webui/searxng ~/open-webui/caddy
cd ~/open-webuiPasswords and keys go into a .env file. openssl generates random values:
cat > .env <<EOF
DOMAIN={{domain}}
POSTGRES_PASSWORD=$(openssl rand -hex 24)
WEBUI_SECRET_KEY=$(openssl rand -hex 32)
SEARXNG_SECRET=$(openssl rand -hex 32)
EOF
chmod 600 .envWEBUI_SECRET_KEYsigns the login tokens. If it stays the same, everyone stays logged in after a restart.SEARXNG_SECRETis used internally by SearXNG.
Step 2: Configure SearXNG
SearXNG is a metasearch engine. It queries several search services and returns the combined results. Open WebUI needs the results as JSON, which SearXNG has turned off by default:
nano searxng/settings.ymluse_default_settings: true
server:
limiter: false
image_proxy: false
search:
formats:
- html
- jsonuse_default_settings: truekeeps all defaults. The file only contains what differs.limiter: falseturns off the bot protection. SearXNG is only reachable inside the Docker network here, and Open WebUI is its only user.formatsadds JSON.
Step 3: Caddyfile
nano caddy/Caddyfile{$DOMAIN} {
reverse_proxy open-webui:8080
}Caddy reads {$DOMAIN} from the environment variable that the Compose file passes on from .env. More on Caddy is in my Caddy guide.
Step 4: The Compose file
nano compose.yamlservices:
open-webui:
image: ghcr.io/open-webui/open-webui:v0.13.3
container_name: open-webui
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
ollama:
condition: service_started
tika:
condition: service_started
searxng:
condition: service_started
environment:
WEBUI_URL: "https://${DOMAIN}"
WEBUI_SECRET_KEY: "${WEBUI_SECRET_KEY}"
DATABASE_URL: "postgresql://openwebui:${POSTGRES_PASSWORD}@postgres:5432/openwebui"
VECTOR_DB: "pgvector"
RAG_EMBEDDING_MODEL: "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
CONTENT_EXTRACTION_ENGINE: "tika"
TIKA_SERVER_URL: "http://tika:9998"
TIKA_SERVER_VERSION: "4"
ENABLE_WEB_SEARCH: "true"
WEB_SEARCH_ENGINE: "searxng"
SEARXNG_QUERY_URL: "http://searxng:8080/search?q=<query>"
ENABLE_TOOL_PERMISSIONS: "true"
ENABLE_TOOL_PERMISSIONS_AUTO: "true"
TOOL_PERMISSIONS_AUTO_PROMPT: "Require approval for every call of search_web and fetch_url, because the query leaves the server. All other tools (knowledge, notes, skills, memories, time) never require approval."
OLLAMA_BASE_URL: "http://ollama:11434"
ENABLE_OPENAI_API: "false"
ENABLE_COMMUNITY_SHARING: "false"
ENABLE_CHANNELS: "true"
volumes:
- ./data:/app/backend/data
ollama:
image: ollama/ollama:0.40.16
container_name: open-webui-ollama
restart: unless-stopped
environment:
OLLAMA_CONTEXT_LENGTH: "16384"
volumes:
- ./ollama:/root/.ollama
postgres:
image: pgvector/pgvector:0.8.7-pg18-trixie
container_name: open-webui-postgres
restart: unless-stopped
environment:
POSTGRES_USER: "openwebui"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
POSTGRES_DB: "openwebui"
volumes:
- ./postgres:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U openwebui -d openwebui"]
interval: 10s
timeout: 5s
retries: 5
tika:
image: apache/tika:4.2.0-full
container_name: open-webui-tika
restart: unless-stopped
searxng:
image: searxng/searxng:2026.11.15-2d500cb6b
container_name: open-webui-searxng
restart: unless-stopped
environment:
SEARXNG_SECRET: "${SEARXNG_SECRET}"
volumes:
- ./searxng:/etc/searxng
caddy:
image: caddy:2.11
container_name: open-webui-caddy
restart: unless-stopped
environment:
DOMAIN: "${DOMAIN}"
ports:
- "80:80"
- "443:443"
- "443:443/udp"
volumes:
- ./caddy/Caddyfile:/etc/caddy/Caddyfile
- ./caddy/data:/data
- ./caddy/config:/configOnly Caddy publishes ports. Ollama, Postgres, Tika and SearXNG are only reachable in the internal Docker network that Compose creates for the project.
The Open WebUI settings
WEBUI_URL: The public address. Open WebUI needs it for links and for logins through external providers.DATABASE_URL: Without this line Open WebUI stores everything in an SQLite file. Postgres handles several users at once better and can be backed up withpg_dumpwhile it runs.VECTOR_DB: "pgvector": The vectors of your documents go into the same Postgres database instead of a separate Chroma database in thedatafolder. Open WebUI creates thevectorextension on first start. Thepgvector/pgvectorimage ships it.RAG_EMBEDDING_MODEL: The model that turns text into vectors. It runs inside the Open WebUI container. The defaultall-MiniLM-L6-v2is trained for English. I use a multilingual model so German documents are found more reliably; if your documents are only in English, you can drop this line. Open WebUI downloads the model on first start. If you change it later, you have to re-import all documents.CONTENT_EXTRACTION_ENGINEandTIKA_*: Documents go to Tika for text extraction. Tika 4 needsTIKA_SERVER_VERSION: "4"because its API changed.ENABLE_WEB_SEARCH,WEB_SEARCH_ENGINE,SEARXNG_QUERY_URL: Web search through SearXNG. Open WebUI replaces<query>with the search term.ENABLE_TOOL_PERMISSIONS,ENABLE_TOOL_PERMISSIONS_AUTO,TOOL_PERMISSIONS_AUTO_PROMPT: The approval before web search. More on that below.OLLAMA_BASE_URL: The address of the Ollama container.ENABLE_OPENAI_API: "false": Turns off the connection to external APIs. Otherwise an empty OpenAI connection shows up.ENABLE_COMMUNITY_SHARING: "false": Hides the button that shares chats with the public Open WebUI community.ENABLE_CHANNELS: "true": Turns on channels, a kind of group chat where people and models write together.
Why OLLAMA_CONTEXT_LENGTH?
With every message, Open WebUI sends the descriptions of its tools: web search, knowledge, notes, time and several more. For me that was about 9,600 tokens before the actual question was added. Without the variable, Ollama cut the prompt down to about 2,000 tokens (truncating input prompt in the log). The model then saw no tools and could neither search nor read documents. With 16384, tools, history and search results fit. More context needs more video memory.
The versions are pinned. Open WebUI releases often and regularly changes settings, so I update on purpose.
Step 5: Start and pull a model
cd ~/open-webui
sudo docker compose up -dThe first start takes a few minutes. Docker pulls about 18 GB of images, then Open WebUI downloads the embedding model. Follow the progress in the log:
sudo docker compose logs -f open-webuiOnce GET / HTTP/1.1" 200 shows up, the interface is ready. Ctrl+C leaves the log.
Now Ollama needs a model. For web search, knowledge and skills it has to be able to call tools. In the Ollama library such models carry the “tools” tag. I pull qwen3:4b here, which is 2.5 GB:
sudo docker compose exec ollama ollama pull qwen3:4b
sudo docker compose exec ollama ollama listLarger models answer better and call tools more reliably, but need more video memory. Pick the largest model with “tools” that fits into your GPU together with 16,384 tokens of context. You can pull more models later in the admin panel under “Settings” → “Connections” via “Manage Ollama”.
Step 6: Create the admin account
Open https://{{domain}} and create an account. The first account automatically becomes administrator. Every further account starts as “pending” and can only chat after you activate it under “Users” in the admin panel. Create the admin account right away, before anyone else opens the address.
In the chat, pick the model at the top, for example qwen3:4b.
Step 7: Web search only with approval
With Ollama everything stays on your server, with one exception: during a web search, the query goes through SearXNG to search engines like Google, Bing or DuckDuckGo. That is exactly what I want a confirmation for, and nothing else.
Open WebUI has three modes for tools. Each user finds them in the chat behind the plus button left of the input field under “Tool Permissions”:
- Full access: The model uses all tools without asking.
- Ask for approval: Every tool call needs a click, even reading your documents or getting the current time.
- Auto: The model checks every call against a policy and marks whether it needs approval.
The variables in the Compose file turn on “Auto”. Users who haven’t chosen anything yet start with it. TOOL_PERMISSIONS_AUTO_PROMPT is the policy: search_web and fetch_url need approval, nothing else does. You’ll find it later in the admin panel under “Settings” → “Interface”.
Asked “Where do I park my bike according to the house rules? And what’s the weather in Berlin tomorrow?”, the model read the house rules and the time without asking. Before the web search it stopped. Clicking “search_web” shows the query under “Input”:

The query only goes to SearXNG once you allow it. If you deny it, the model answers without searching. The answer then came back with “basement, room 3” from the house rules and the weather forecast with a source.
The admin panel also has a “Web Search Confirmation” option under “Settings” → “Web Search”. It shows a fixed notice once when web search is turned on (“Use Web Search?”). It doesn’t show the query.
Step 8: Your own documents as knowledge
Under “Workspace” → “Knowledge” you create a collection and upload files. Tika extracts the text, the embedding model splits it into chunks and computes the vectors, and Postgres stores them. None of this leaves the server.
As a test I uploaded a Word file with house rules: bins on Tuesdays at 7 a.m., bicycles in basement room 3, caretaker on extension 42. Asking “When are the bins emptied and how do I reach the caretaker?” gave the correct answer with a reference to the document.
To check that the vectors really are in Postgres:
sudo docker compose exec postgres psql -U openwebui -d openwebui \
-c "select collection_name, count(*) from document_chunk group by 1;"Each file gets its own file-… collection, and each knowledge collection one with its ID.
Step 9: Skills
Skills are instructions in Markdown that you write once and use in every chat. The model first only sees name and description. If a question fits, it loads the content itself. You can also call a skill directly: type $ in the chat and the list of your skills appears.
Under “Workspace” → “Skills” I created a skill “Check Compose file”:
# Check Compose file
Check a Docker Compose file the user sends for these points and answer with a table
(point, finding, recommendation):
1. Images have a pinned version, no `latest` and no missing tag.
2. Only the reverse proxy publishes ports. Databases, Redis/Valkey and internal services
have no `ports` entry.
3. Passwords and keys are not in plain text in the file but come from an `.env`.
4. Data lives in volumes or bind mounts and survives `docker compose down`.
5. `restart: unless-stopped` or `always` is set.
6. Databases have a `healthcheck`, and dependent services wait with
`condition: service_healthy`.
Finish with the corrected file. Don't invent image versions: if you don't know the current
version, write `<VERSION>`.As the description I entered: “Checks a docker-compose.yml for pinned versions, open ports, plain-text passwords, volumes, restart policy and healthchecks.” The description decides whether the model finds the skill on its own, so keep it specific.
I then wrote without $: “Please check my Compose file” and described a file with postgres without a version, a plain-text password and an open port 5432. The model loaded the skill itself (view_skill) and suggested a corrected file with <VERSION>, a healthcheck and no open database port.
Step 10: Build a model preset
Under “Workspace” → “Models” you combine a model, a system prompt, knowledge, skills and default features into your own “model”. For users it looks like any other model in the picker.

My “house assistant” has the house rules as knowledge and web search as a default feature, so search is on in every chat. The system prompt says: house rules first, the web only if they have no answer. As the base model you pick one of your Ollama models.
Under “Access” you decide who can see the preset. That way, for example, only the group “Family” gets the house assistant.
What else Open WebUI can do
Version 0.13.3 also has these features:
- Notes: An editor for your own notes, which the model can search and edit in the chat.
- Channels: Group chats where several users write and models join when mentioned. Turned on with
ENABLE_CHANNELS. - Memories: Open WebUI remembers facts about you, such as your preferred language, and passes them to the model.
- Automations: A prompt, a model and a schedule. The server then runs the prompt itself, for example a news summary on a topic every morning.
- Calendar: Events the model can read and create.
- Code interpreter: The model writes Python code and runs it. By default this runs with Pyodide in the browser, not on the server.
- Sub-agents: The model hands subtasks to another model (
delegate_task). - Functions (admin panel): Your own Python extensions, for example filters that change every message before it is sent.
- Integrations: External tool servers that give the model more tools.
- Groups and permissions: Under “Admin Panel” → “Users” → “Groups” you decide who may use web search, skills, knowledge or code execution.
Without a GPU: an external API as alternative
On a VPS with 4 vCPUs and 8 GB RAM and no GPU I tried qwen3:4b. For a short answer it managed about 10 tokens per second. With tools it gets slow, though: just reading the roughly 9,600 tokens of tool descriptions took more than seven minutes, on every step. After 20 minutes the model still hadn’t called a single tool. The CPU is enough for simple chats without web search and documents, not for the setup in this guide.
Without suitable hardware, Open WebUI can additionally talk to an external API that works like OpenAI’s. Ollama, Postgres, Tika and SearXNG still stay on your server. Your messages, the matching chunks from your documents and the search results then go to the model provider, though.
I tested OpenRouter for this. One key gives you access to models from many providers. To set it up:
- Create an account at OpenRouter, add credit and create a key with a spending limit under “Keys”.
- In Open WebUI, turn on the “OpenAI API” in the admin panel under “Settings” → “Connections”.
- Enter
https://openrouter.ai/api/v1as the URL and paste the key. - Under “Model IDs” in the connection, list only the models your users should see, for example
openai/gpt-6-luna. Otherwise more than 400 models show up in the picker.
With openai/gpt-6-luna ($0.10 per million input tokens, $0.50 per million output tokens), web search, knowledge, skills and the approval from this guide ran within seconds. A short question cost about $0.00002, all chats for this guide together $0.007.
If you want to manage several providers and local models together, put LiteLLM in front: a proxy with an OpenAI-compatible API, its own keys and budgets per user. In Open WebUI you add LiteLLM as an OpenAI connection in the same way.
Backup
What matters is the Postgres database (chats, users, settings, vectors) and the data folder (uploaded files). Back up the database while it runs:
cd ~/open-webui
sudo docker compose exec -T postgres pg_dump -U openwebui -Fc openwebui > owui.dumpAlso keep data/uploads, .env, compose.yaml, searxng/settings.yml and the Caddyfile. You don’t strictly need data/cache and ollama: Open WebUI downloads the embedding model again when needed, and you get the language models back with ollama pull. To copy the backup to another machine you can use Duplicati, for example.
Updating Open WebUI
- Read the release notes. Open WebUI often changes settings and menus.
- Back up the database as shown above.
- Change the tags in
compose.yaml. - Pull the images and restart:
sudo docker compose pull
sudo docker compose up -dOpen WebUI migrates the database itself on start.
Frequently asked questions
Does Open WebUI run fully local?
Yes, with Ollama your chats, documents and models stay on your server. Only during a web search does the query go through SearXNG to external search engines. With the policy from this guide, Open WebUI asks first.
What hardware do I need for local models?
For web search, documents and skills, a GPU whose memory fits the model plus 16,384 tokens of context. On 4 vCPUs without a GPU, just reading the tool descriptions took me more than seven minutes per step.
Why doesn't my local model find any tools?
Usually the context is too small. Without OLLAMA_CONTEXT_LENGTH, Ollama cuts the prompt to about 2,000 tokens, while Open WebUI's tool descriptions are about 9,600 tokens long. The model also has to support tools, shown by the tools tag in the Ollama library.
Can I require approval only for web search and nothing else?
Yes, with Auto mode and a policy that only requires approval for search_web and fetch_url. The model decides based on the policy; it is not a hard rule. Users can also switch to Full access themselves.
Why does nothing change when I edit a variable in compose.yaml?
Open WebUI stores most settings in the database on first start. After that, the admin panel wins. Change the setting there or set ENABLE_PERSISTENT_CONFIG to false.
As an Amazon Associate I earn from qualifying purchases.
Changelog
Rewritten for Open WebUI 0.13.3: Ollama with a larger context, Postgres with pgvector instead of SQLite and Chroma, Tika for documents, SearXNG web search with approval only for search queries, Caddy for HTTPS, sections on knowledge, skills, model presets, backup and external APIs as an alternative without a GPU.