Note! Hardware is important here. I did this using an old i7-4770 CPU, 20GB DDR3, and a Dragon Power RX580. The memory is the most important. I trie this with 6GB o DDR3 and it struggled and choked and errored out constantly.
IMPORTANT! If your BIOS has a setting to set the default video card, be sure it is set to force using the RX580. I had issues with it being set to "auto" in my BIOS.
IMPORTANT! This setup is SPECIFICALLY for the RX580. Using a more modern card would require changes to the debian packages installed, as well as the docker-compose.yml
USER_HOME_DIR
|
-- homeassistant
:~# sudo apt update
:~# sudo apt dist-upgrade
sudo apt install cmake, curl, ffmpeg, amd firmware, glslc, glslang-dev, git, mesa-vdpau-drivers, mesa-va-drivers, mesa-libgallium, mesa-vulkan-drivers, vulkan-tools
sudo apt install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Now you can either:
A) Create a new user to run everything from
B) create this in your user home directory and run everything as your user (recommended)
mkdir ~/homeassistant
cd ~/homeassistant
Create the ollama user for the docker service
sudo useradd -r -s /bin/false -U -m -d /usr/share/ollama ollama
We need to know if the ollama user (the user the service runs as) is in the render group and what the group number is
getent group render
If you don't see something like "render:x:992:ollama" then you have to add that user to the render group
sudo usermod -aG render,video ollama
Also add your user to the ollama group so you can manage models
sudo usermod -aG ollama $USER
Check again if the ollama user is in the render group.
IMPORTANT! Be sure to get the render and video group ids
getent group render
Output should be something like "render:x:992:ollama". 992 is the render group. Take note of this.
getent group video
Output should be something like "video:x:44:ollama". 44 is the video group. Take note of this as well.
Make sure your terminal is in the ~/homeassistant directory!
Pay close attention to this part
dns: # You can comment out this and the next two lines if your network isn't using any add blocking DNS hosts like pi-hole
- 8.8.4.4 # THE GOOGLE DNS SERVER ARE BEING USED HERE BECAUSE MY PI-HOLE WAS BLOCKING WEB REQUESTS FROM DOCKER
- 8.8.8.8 # THE GOOGLE DNS SERVER ARE BEING USED HERE BECAUSE MY PI-HOLE WAS BLOCKING WEB REQUESTS FROM DOCKER
IMPORTANT! THESE MUST BE CHANGED TO MATCH YOUR MACHINE AND ENVIRONMENT USING THE INFORMATION WE GATHER EARLIER
group_add: # you MUST change this to your specific Debian Trixie setup
- "YOUR_VIDEO_GROUPID" # Video group
- "YOUR_RENDER_GROUPID" # Your specific render group ID
Save the docker-compose.yml
This will take a long time!
docker compose up -d
docker exec -it ollama ollama pull tinyllama
sudo systemctl enable docker
sudo systemctl status docker
If it isn't running
sudo systemctl start docker
In a web browser, browse to:
http://yourserveripaddress:8123