02. Installation by OS

Chapter 2 of 20 · 20 min

Installation methods differ by operating system. The core binary is the same-differences arise in how the service runs and where data gets stored.

Linux

The install script is the fastest method:

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

This installs the ollama binary to /usr/local/bin/ and creates a systemd service that starts on boot. If you prefer manual installation:

sudo mv ollama /usr/local/bin/
sudo useradd -r -s /usr/bin/nologin -d /nonexistent ollama
sudo mkdir -p /etc/systemd/system/ollama.service.d

The service configuration sets OLLAMA_HOST=127.0.0.1 by default, binding to localhost only.

macOS

Download the app from ollama.com/download or install via Homebrew:

brew install ollama

Ollama starts automatically on login as a menu bar application. The socket is at /var/run/ollama.sock. You can disable auto-start with:

brew services stop ollama

Windows

Download the installer from ollama.com. The installer adds Ollama to your PATH and registers a Windows service that runs in the background. Models are stored in %USERPROFILE%\\.ollama\\models.

To verify installation in PowerShell:

ollama --version
Get-Service ollama

Verification

After installation, start the server explicitly and check the API:

# Linux/macOS - start server in background
ollama serve &
sleep 2
curl http://localhost:11434/api/tags

# Windows - service should already be running
Invoke-RestMethod -Uri http://localhost:11434/api/tags

A common failure on Linux is installing without systemd support, then wondering why the server does not persist after closing the terminal. The install script handles this, but manual installs require you to either run ollama serve in a screen session or set up the service manually.

Local verification checkpoint

Run the smallest example from this chapter in a local workspace and record the package version, runtime, data path, and observed output. If the result depends on model size, vector count, CPU/GPU backend, or available memory, note that constraint beside the exercise so the lesson remains reproducible.

EXERCISE

Identify where your Ollama models are stored by running ollama show llama3.2:3b --json (or any installed model) and checking the model field in the JSON output. Compare this path to your home directory structure.