Come hang with us on Discord and chat directly with the team!Discordtop-bar-close-icon

2024-09-10

How to Install Open WebUI and Ollama on Ubuntu 22.04 for a Local ChatGPT Experience

tutorials
img

Open WebUI and Ollama are powerful tools for creating a local chat experience using GPT models. These tools offer a user-friendly interface for interacting with language models, suitable for those experimenting with natural language understanding or building conversational AI. This guide walks you through the installation process step by step.

Ollama is a cutting-edge platform that enables running open-source large language models locally on your machine. It simplifies the deployment and management of these models, making it an appealing option for researchers, developers, and enthusiasts. Ollama provides a user-friendly interface for running large language models (LLMs) locally, specifically on MacOS and Linux, with Windows support anticipated.

Open WebUI is a versatile, feature-rich, and user-friendly self-hosted WebUI that operates entirely offline. It supports various large language model (LLM) runners, including Ollama and OpenAI-compatible APIs.

Prerequisites

Before beginning the installation, ensure you have the following prerequisites:

  1. System Requirements:
    • Your system can be CPU-only, or you may have an NVIDIA or AMD GPU.
    • We’ll be using Ubuntu 22.04 as the operating system.
    • At least 4 vCPUs, 8 or more is recommended.
    • At least 8 GB of RAM is needed to run the 7B models, 16 GB for the 13B models, and 32 GB for the 33B models.
  2. Software:
    • Docker
    • NVidia Container Runtime for Docker
    • Open WebUI
    • Ollama Models Library

Installation Steps

1. Install or Upgrade Docker Engine on Ubuntu

Follow the official guide to install or upgrade Docker on your Ubuntu system.

2. Install GPU support for Docker

The NVIDIA Container Runtime for Docker enhances the Docker Engine to support NVIDIA GPUs for GPU-accelerated containers. Follow the official NVidia documentation to install or upgrade the NVidia Container Runtime for Docker.

3. Install OpenWebUI and Ollama

Choose an installation method based on your environment:

[Option 1] Installing Open WebUI with Bundled Ollama Support

This is the simplest and recommended method. It uses a single container image that bundles Open WebUI with Ollama, allowing for a streamlined setup with a single command. Use the appropriate command based on your hardware:

sudo docker run -d -p 3000:8080 --gpus=all -v ollama:/root/.ollama -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda

Verify that the Docker instance is running:

sudo docker ps

[Option 2] Installation with the Default Open WebUI Configuration using a separate Ollama instance

Install Ollama using:

curl -fsSL https://ollama.com/install.sh | sh

With Ollama installed, start Open WebUI:

sudo docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

[Option 3] Install using Docker Compose

Start by cloning the OpenWebUI GitHub repository:

git clone https://github.com/open-webui/open-webui

cd open-webui

Choose the appropriate Docker Compose file based on your hardware, then start the Docker environment:

sudo docker compose -v open-webui:/app/backend/data -f docker-compose.yaml up

Verify that the Docker instance is running:

sudo docker ps

4. Access the User Interface

Open your web browser and navigate to:

http://<your-host-IP>:3000

5. Create a New User

Click “Sign up” to create a new local user account. Enter your Name, Email, and Password, then click “Create Account”.

6. Downloading Ollama Models

Explore and import models from Ollama using Open WebUI:

  1. Click the “+” next to the models drop-down in the UI.
  2. Alternatively, go to Settings -> Models -> “Pull a model from Ollama.com.”

Conclusion

Congratulations! You’ve successfully set up Open WebUI and Ollama for a local ChatGPT experience. Feel free to explore the capabilities of these tools and customize your chat environment. Happy chatting!