Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Ollama Installation

Ollama Installation

Ollama supports multiple operating systems, including macOS, Windows, Linux, and running via Docker containers.

Ollama has modest system requirements and can run models on pure CPU, but whether a discrete graphics card is present directly determines generation speed.

Platform System Requirements GPU support
macOS macOS Sonoma (v14) or newer Apple M-series chips are accelerated via Metal; Intel chips are CPU-only
Windows Windows 10 22H2 or newer (Home / Pro) NVIDIA driver 551.61+; AMD requires ROCm v7 or Vulkan driver
Linux Major distributions (Ubuntu, Debian, CentOS, etc.) NVIDIA / AMD ROCm v7 / Vulkan, pure CPU also supported
Docker A working Docker environment Linux and Windows (WSL2) support GPU passthrough; macOS does not

Model file sizes range from a few GB to hundreds of GB; reserve enough disk space before installation. Models are stored in the user's home directory by default; when space is insufficient, you can use an environment variable OLLAMA_MODELS to migrate to another disk.

Linux/macOS one-click install command:



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

Windows one-click install command:



irm https://ollama.com/install.ps1 | iex

You can also download the installer directly; official download address:https://ollama.com/download。

We can download the corresponding package for different systems; for server environments, Linux script or Docker is recommended.

Flowchart for selecting the Ollama installation method

The Ollama interface is as follows:


1. Windows system installation

Open a browser and visit the official Ollama website:https://ollama.com/download, download the installer for Windows.

The download address is:https://ollama.com/download/OllamaSetup.exe。

After the download completes, double-click the installer and follow the prompts to complete installation.

After installation, the ollama command can be used directly in cmd, PowerShell, or Windows Terminal.

You can also install via command line:

irm https://ollama.com/install.ps1 | iex

Verify the installation

Open Command Prompt or PowerShell and enter the following command to verify the installation succeeded:



ollama --version

If a version number is shown, the installation succeeded.

Change installation path (optional)

If you need to install Ollama to a non-default path, you can specify the path via command line during installation, for example:



OllamaSetup.exe /DIR="d:\some\location"

This installs Ollama to the specified directory.


2. macOS system installation

Open a browser and visit the official Ollama website:https://ollama.com/download, download the installer for macOS.

The download address is:https://ollama.com/download/Ollama.dmg。

You can also install with one click via command line:



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

After the download completes, double-click the package and follow the prompts to complete installation.

After installation, verify with the following command:



ollama --version

If a version number is shown, the installation succeeded.


3. Linux system installation

On Linux you can use a one-click install script; open a terminal and run the following command:

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

After installation, verify with the following command:



ollama --version

If a version number is shown, the installation succeeded.


Docker deployment

Docker suits servers and scenarios requiring environment isolation; official ready-made images are provided, and a CPU environment can run with a single command.



# Start Ollama container: Volume persistence for models, map port 11434

docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

NVIDIA GPU passthrough

To let a container use an NVIDIA graphics card, first install NVIDIA Container Toolkit; taking Ubuntu/Debian as an example:



# 1. Configure software repository

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \

    | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg

curl -fsSL 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



# 2. Install toolkit

sudo apt-get install -y nvidia-container-toolkit



# 3. Configure Docker runtime and restart

sudo nvidia-ctk runtime configure --runtime=docker

sudo systemctl restart docker

Then add the --gpus=all parameter to start the container:



# Startup command with GPU

docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

AMD GPU passthrough

AMD graphics cards use images with the rocm tag and mount devices:



# AMD ROCm version, mount GPU device

docker run -d --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm

Running models in a container

After the container starts, execute ollama commands inside the container via exec:



# Pull and run qwen3.5 inside the container

docker exec -it ollama ollama run qwen3.5

For example:



$ docker exec -it ollama ollama run qwen3.5

>>> 用一句话介绍 RUNOOB Runoob Tutorial

RUNOOB(Runoob Tutorial)是一个面向编程初学者的中文教程网站。

>>> /bye

Docker Desktop for macOS does not support GPU passthrough; only CPU inference is available inside the container. Apple Silicon users who want GPU acceleration should use the native installer directly.


Verify the installation

Regardless of the installation method, finish with a unified three-step verification: check version, run a chat, connect to API.

Step 1: Confirm version



# Output version description command line available

ollama -v

Step 2: Open interactive menu

Entering ollama without parameters enters the interactive menu, where you can select a model to start a chat:



$ ollama

Welcome to Ollama



  Run a model     Start an interactive chat

  Launch tools    Claude Code, VS Code, and more

Step 3: Check API service

After installation, Ollama provides an API on local port 11434; use curl to request the version endpoint to confirm the service is listening:



# Local API default address, returns JSON version information

curl http://localhost:11434/api/version



{"version":"0.17.0"}

After installation on macOS and Windows, Ollama resides in the background (menu bar / tray icon) and the API is automatically available; on Linux with a systemd service it is also ready at boot, and only the manual ollama serve method requires keeping the terminal open.


Upgrade and uninstall

Upgrading is simple, while uninstalling differs by platform; take special care not to accidentally delete downloaded models.

Upgrade to a new version

Platform Upgrade method
macOS / Windows Automatically downloads updates; click "Restart to update" on the menu bar or tray icon to apply
Linux (script installation) Re-run the installation script
Linux (manual installation) Delete the old library first, then re-download and extract the new package
Docker Pull the latest image and rebuild the container; the data volume retains models

Uninstall: macOS

macOS requires manually cleaning up the app and leftover files; execute one by one:

Example

Delete the app and command line

sudo

rm

-rf

/

Applications

/

Ollama.app

sudo

rm

/

usr

/

local

/

bin

/

ollama

Delete app leftovers

rm

-rf

"~/Library/Application Support/Ollama"

rm

-rf

"~/Library/Caches/com.electron.ollama/"

rm

-rf

~

/

Library

/

Caches

/

ollama

Delete models and config (large in size; only delete after confirming)

rm

-rf

~

/

.ollama

Uninstall: Windows

Find Ollama in Settings under "Apps - Installed apps" and click uninstall.

If you ever migrated models to another directory via OLLAMA_MODELS, the uninstaller will not delete those model files and you need to clean them up manually.

Uninstall: Linux

Example

Stop and remove the system service

sudo

systemctl stop ollama

sudo

systemctl disable ollama

sudo

rm

/

etc

/

systemd

/

system

/

ollama.service

Delete program files (the lib directory may be /usr/local/lib, /usr/lib, or /lib)

sudo

rm

-r

$

(

which

ollama

|

tr

'bin'

'lib'

)

sudo

rm

$

(

which

ollama

)

Delete the service user and model data

sudo

userdel ollama

sudo

groupdel ollama

sudo

rm

-r

/

usr

/

share

/

ollama


Common installation issues

Installation-stage issues are mostly related to network, disk, and terminal environment; the table below summarizes the most frequent ones.

Symptom Reason Solution
Terminal says ollama command not found CLI not in PATH macOS: restart the Ollama app once and agree to create the /usr/local/bin link; Windows: open a new terminal window
Model download slow or failing Network to source site unstable Configure the HTTPS_PROXY proxy; interrupted downloads resume automatically, just re-run pull
Downloads are especially slow in WSL2 Win10 WSL network adapter feature issue Disable Large Send Offload V2 (IPv4/IPv6) on the vEthernet (WSL) adapter
Garbled squares appear in Windows terminal Old terminal font does not support progress characters Change terminal font or switch to Windows Terminal
Warning of insufficient disk space The drive holding the user directory has little space Use OLLAMA_MODELS to migrate models to a larger disk (detailed in the environment variables chapter)

When configuring a proxy, set only HTTPS_PROXY , do not set HTTP_PROXY: Ollama pulls models over HTTPS only, and setting an extra HTTP proxy may actually interrupt the connection between client and server.