Ollama

Install

Download the ollama binary

Ollama is distributed as a self-contained binary. Download it to a directory in your PATH:

sudo curl -L https://ollama.com/download/ollama-linux-amd64 -o /usr/bin/ollama
sudo chmod +x /usr/bin/ollama

Create a user for Ollama:

sudo useradd -r -s /bin/false -m -d /usr/share/ollama ollama

Create a service file in /etc/systemd/system/ollama.service:

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

[Service]
Environment=OLLAMA_HOST=0.0.0.0
ExecStart=/usr/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3

[Install]
WantedBy=default.target

Then start the service:

sudo systemctl daemon-reload
sudo systemctl enable ollama

Start Ollama

Start Ollama using systemd:

sudo systemctl start ollama

Using Ollama

ollama run llama2
ollama run mistral
ollama run yi

https://github.com/ollama/ollama https://blog.inoki.cc/2024/04/16/Ollama-cn/