Ollama Installation: Local LLM Running Guide
Ollama installation, running local LLM models (Llama 3, Mistral, Gemma), API usage, model management, GPU acceleration and Docker deployment.
Open WebUI installation with Docker, Ollama integration, user management, RAG (document querying), model management, custom prompts and multi-user support.
Open WebUI (formerly Ollama WebUI) is an open-source project that provides a modern ChatGPT-like web interface for your local LLM models. Integrated with Ollama, you can chat with your AI models through the browser, upload documents and query your documents with RAG (Retrieval-Augmented Generation).
Open WebUI is a comprehensive web interface designed for self-hosted AI experience. Key features:
| Component | Minimum | Recommended |
|---|---|---|
| RAM | 4 GB (for UI) | 8 GB+ |
| Disk | 5 GB | 10 GB+ |
| Docker | 20.10+ | Latest |
| Ollama | Installed and running | Same server or network |
If Ollama is running on the same server:
docker run -d \
--name open-webui \
-p 3000:8080 \
--add-host=host.docker.internal:host-gateway \
-e OLLAMA_BASE_URL=http://host.docker.internal:11434 \
-v open-webui:/app/backend/data \
--restart unless-stopped \
ghcr.io/open-webui/open-webui:main
To run Ollama and Open WebUI in a single container:
docker run -d \
--name open-webui \
-p 3000:8080 \
--gpus all \
-v ollama:/root/.ollama \
-v open-webui:/app/backend/data \
--restart unless-stopped \
ghcr.io/open-webui/open-webui:ollama
version: '3.8'
services:
ollama:
image: ollama/ollama
container_name: ollama
ports:
- "11434:11434"
volumes:
- ollama_data:/root/.ollama
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
restart: unless-stopped
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
- WEBUI_SECRET_KEY=your-strong-secret-key-here
- ENABLE_SIGNUP=true
- DEFAULT_USER_ROLE=pending
volumes:
- open-webui_data:/app/backend/data
depends_on:
- ollama
restart: unless-stopped
volumes:
ollama_data:
open-webui_data:
Start:
docker compose up -d
Navigate to http://SERVER_IP:3000 in your browser.
The first user to register automatically becomes admin:
Create the first user immediately. Otherwise someone else could become admin. After registration, set ENABLE_SIGNUP=false to disable new registrations.
Verify Ollama connection from admin panel:
http://ollama:11434 (Docker Compose) or http://host.docker.internal:11434llama3.1)docker exec -it ollama ollama pull llama3.1
docker exec -it ollama ollama pull mistral
docker exec -it ollama ollama pull codellama
Open WebUI supports document upload and document-based querying:
Admin Panel → Settings → Documents:
Chunk Size: 1000
Chunk Overlap: 200
Embedding Model: nomic-embed-text
Top K: 5
docker exec -it ollama ollama pull nomic-embed-text
# Environment variables
ENABLE_SIGNUP=true
DEFAULT_USER_ROLE=pending
ENABLE_LOGIN_FORM=true
Define custom system prompts for each model:
You are a REXE Technology technical support assistant.
You specialize in server management, Docker, Linux and networking.
Include code examples.
Explain step by step.
Workspace → Prompts → Create Prompt:
Title: Linux Troubleshooting
Command: /linux-fix
Content: "Analyze the following Linux issue and suggest a solution:
1. List possible causes
2. Provide diagnostic commands
3. Write step-by-step solution
4. Add prevention tips
Issue: {{prompt}}"
server {
listen 80;
server_name ai.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
server_name ai.example.com;
ssl_certificate /etc/letsencrypt/live/ai.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ai.example.com/privkey.pem;
location / {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
client_max_body_size 100M;
}
docker compose pull
docker compose up -d
# Open WebUI logs
docker logs open-webui
# Ollama connection test
docker exec open-webui curl -s http://ollama:11434/api/tags
# Container status
docker ps | grep -E 'open-webui|ollama'
With REXE VPS servers, you can set up your own ChatGPT alternative using Open WebUI. Your data stays completely under your control.
Open WebUI supports all models running through Ollama: Llama 3.1, Mistral, Gemma 2, Phi-3, CodeLlama and more. It can also connect to OpenAI API compatible services.
RAG (Retrieval-Augmented Generation) splits your uploaded documents into chunks and creates embedding vectors. When you ask a question, relevant document chunks are found and provided as context to the model. This way the model produces accurate answers based on your documents.
Yes, Open WebUI supports multiple users. Each user has their own chat history, settings and documents. Admin can manage user roles and access permissions.
All data (chat history, user info, uploaded documents) is stored in the Docker volume at /app/backend/data. Data persistence is ensured through volume mounts. Copy this volume for backups.
Yes, Open WebUI works with both Ollama and OpenAI API. You can add your OpenAI API key in Settings → Connections to use models like GPT-4 and GPT-3.5.
No, your data remains safe as long as you use Docker volumes. During updates, the container is recreated but volume data is preserved. It's still recommended to backup before updating.
Ollama installation, running local LLM models (Llama 3, Mistral, Gemma), API usage, model management, GPU acceleration and Docker deployment.
NVIDIA driver installation, CUDA toolkit, nvidia-container-toolkit, model serving with vLLM, GPU monitoring and AI model deployment with Docker guide.
Stable Diffusion installation, AUTOMATIC1111 and ComfyUI interfaces, model downloading, LoRA training, ControlNet usage and Docker self-hosted image generation guide.