Manual Ollama Installation

From MK Wiki EN
Jump to navigation Jump to search

Tested on Debian 13

Main reference: Linux - Ollama - Manual installation

Rationale

Since I don't want to pollute my system with software whose origin is not the operating system's package repository, I install Ollama to "/opt" rather than "/bin".

Download and Install

Its necessary to install some packages:

apt install zstd curl -y

Then let's download Ollama:

curl -fsSL https://ollama.com/download/ollama-linux-amd64.tar.zst

Unpack the archive:

tar --zstd -xf ollama-linux-amd64.tar.zst -C /opt

Improved ollama.service file

[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/media/data/opt/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=$PATH"
Environment="OLLAMA_HOST=0.0.0.0"
Environment="OLLAMA_CONTEXT_LENGTH=16384"

[Install]
WantedBy=multi-user.target