Updated: May 8, 20243 min read

Easiest way to get your own Local AI: Ollama Tutorial

Written by: Fixt
Ollama Icon

Prerequisites

  • Windows 11 or Ubuntu 22.04 PC with at least 8GB of RAM (16GB recommended)
  • Nvidia GPU with Official Driver Installed (Optional, but recommended)

On Windows, you don't need to install any GPU driver on WSL, the official Nvidia Driver on Windows will take care of everything.

Docker Installation (Linux/WSL)

Based on the docker documentation [1, 2], you can install docker with the following commands:

Docker Installation Steps

curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker
##Test
docker run hello-world

Activate GPU compatibility

Based on Nvidia documentation [1], you can install the Nvidia Container Toolkit with the following commands:

NVIDIA Container Toolkit Installation Steps

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
  && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
    sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
    sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit

Configuration

sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
##Test
docker run --gpus all nvidia/cuda:11.5.2-base-ubuntu20.04 nvidia-smi

Installation

Updated docker compose file to the new Open WebUI container image.

(Ollama + Open WebUI) CPU Only

wget -O docker-compose.yaml  https://raw.githubusercontent.com/fixtse/blueprints/main/docker/docker-compose-ollama.yaml

(Ollama + Open WebUI) with GPU Support

wget -O docker-compose.yaml  https://raw.githubusercontent.com/fixtse/blueprints/main/docker/docker-compose-ollama-gpu.yaml

Only Open WebUI

wget -O docker-compose.yaml  https://raw.githubusercontent.com/fixtse/blueprints/main/docker/docker-compose-ollama-webui.yaml

to run it

docker compose up -d

How to update it

to update it

docker compose pull
docker compose up --force-recreate -d

Open WebUI

By tjbck

Ollama Library


Open WebUI Hub


Ollama Integrations


I would love to hear your comments, or suggestions on this post.


Avatar of Fixt

Fixt is a Software Engineer passionate about making the world a better place through technology and automation.