Setting up a private self-hosted AI platform allows you to replace expensive cloud services with a highly customizable and secure equivalent. This guide will walk you step-by-step through deploying Ollama with Open WebUI to build a self-hosted ChatGPT interface. Together, they enable running large language models (LLMs) on-premises with complete control over your data.
Prerequisites for Setting Up Ollama and Open WebUI
Before you begin, ensure your hardware and software meet the following requirements:
prerequisites
- A high-performance GPU with at least 16GB VRAM, such as AMD Radeon 7900 XT or equivalent.
- A running Proxmox VE setup or comparable hypervisor capable of virtualization.
- Ubuntu 20.04 LTS for LXC container-based deployments.
- Access to Docker and Traefik for hosting and securing services.
- Networking knowledge to configure static IP addresses for components.
Steps to Install Ollama in Your Local Environment
Follow these detailed steps to configure Ollama on your system.
steps
Set up a privileged LXC container in Proxmox.
- Create a new LXC container with Ubuntu 20.04 LTS.
- Mark the container as privileged and assign sufficient disk space for storing LLMs.
- Assign a static IP to the container for predictable networking.
Install AMD ROCm drivers.
- Inside the container, install AMD ROCm following AMD's documentation.
- Verify GPU detection with:bash
rocm-smi rocm-info
Pass through GPU devices to the container.
- Update the container’s configuration file in
/etc/pve/lxc/<container-id>.confto include:bashlxc.cgroup2.devices.allow = c 226:* rwm lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
- Update the container’s configuration file in
Install Ollama using its installation script:
bashbash <(curl -s https://ollama.com/install.sh)Secure GPU access for the Ollama service.
- Adjust the service configuration to ensure GPU detection.
- Optional: Restrict networking exposure with
ufwor similar tools.
Verify the setup.
- Test the Ollama instance by loading a small model:bash
ollama pull llama-7b ollama chat llama-7b
- Test the Ollama instance by loading a small model:
Setting Up Open WebUI for Ollama Integration
Open WebUI provides an extensible web interface to interact with models served by Ollama.
steps
Prepare a Docker Compose file:
- Create a new directory for your Open WebUI setup and populate it with the following
docker-compose.yml:yamlversion: '3.8' services: openwebui: image: openwebui/backend:latest container_name: openwebui labels: - traefik.http.routers.webui.rule=Host(`openwebui.local`) - traefik.http.routers.webui.tls=true environment: - OLLAMA_BASE_URL=http://10.20.0.20:11434 networks: - traefik-network volumes: - openwebui_data:/app/backend/data networks: traefik-network: external: true volumes: openwebui_data:
Replace
10.20.0.20with your actual Ollama container's static IP address.- Create a new directory for your Open WebUI setup and populate it with the following
Deploy Open WebUI:
bashdocker compose up -dTest connectivity between WebUI and Ollama.
- Access the WebUI via its FQDN or static IP.
- Configure chat interfaces and verify that models load from Ollama.
Secure access.
- Protect Open WebUI using Traefik with authentication middleware (e.g., Authentik or basic auth).
- Test HTTPS connections.
Customize settings:
- Add LLM models or set up extension features using the WebUI's admin interface.
VRAM Considerations for Model Selection
The amount of VRAM on your GPU directly impacts the models you can load and use effectively.
Tips for Working with Self-hosted AI Systems
Deploying a private AI platform can be complex. Here are some practical recommendations:
Connecting Open WebUI to ChatGPT and Other APIs
For hybrid setups that combine local models with cloud-based AI services, you can connect APIs like ChatGPT to Open WebUI.
steps
Enable Web Search in Open WebUI.
- Navigate to Settings → Web Search and select a search engine (e.g., DuckDuckGo).
Add external API tokens:
- Configure APIs like OpenAI's ChatGPT in the WebUI settings.
Test combined workflows.
- Integrate local models for offline tasks and cloud-based APIs for access to external information.
Takeaway
Setting up Ollama with Open WebUI gives you a powerful, self-hosted alternative to proprietary AI platforms like ChatGPT. By leveraging your hardware, you can achieve greater privacy while maintaining excellent functionality. Remember to secure and optimize your deployment for safe, efficient long-term use.
FAQ
What are the hardware requirements for hosting Ollama?
You'll need a strong GPU with at least 16GB of VRAM. AMD's Radeon 7900 XT or an Nvidia 3090 are good examples.
Can I use Open WebUI without Docker?
While Docker is the recommended method, you can host Open WebUI using other container-friendly platforms or native installations with additional setup.
Why isn't my GPU detected in the container?
For LXC, ensure GPU device passthrough is correctly configured in the container's Proxmox config file. Use tools like rocm-smi to troubleshoot.
How many models can I load at once?
This depends on your GPU's VRAM capacity. For instance, a 20GB VRAM GPU can handle a 13B model and a small 7B model simultaneously.
Official reference: Open WebUI documentation.