↓Skip to main content

Ollama Linux setup

591 words·
Ollama ML LLM NVIDIA Linux GeForce RTX 4070
Table of Contents

Installation & Configuration
#

Installation
#

Link: https://ollama.com/download

# Run setup script
curl -fsSL https://ollama.com/install.sh | sh

# Shell output:
>>> Installing ollama to /usr/local
>>> Downloading ollama-linux-amd64.tar.zst
######################################################################## 100.0%
>>> Creating ollama user...
>>> Adding ollama user to render group...
>>> Adding ollama user to video group...
>>> Adding current user to ollama group...
>>> Creating ollama systemd service...
>>> Enabling and starting ollama service...
Created symlink '/etc/systemd/system/default.target.wants/ollama.service' → '/etc/systemd/system/ollama.service'.
>>> NVIDIA GPU installed.
# Verify installation
ollama --version

# Shell output:
ollama version is 0.32.15
# Verify service status
systemctl status ollama --no-pager

Adapt Ollama Service Unit
#

Create override.conf to set OLLAMA_HOST and OLLAMA_CONTEXT_LENGTH:

sudo mkdir -p /etc/systemd/system/ollama.service.d
sudo nvim /etc/systemd/system/ollama.service.d/override.conf
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_CONTEXT_LENGTH=65536"
# Restart service unit
sudo systemctl daemon-reload
sudo systemctl restart ollama
# List service status
systemctl status ollama

# Shell output:
● ollama.service - Ollama Service
     Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: disabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
             /etc/systemd/system/ollama.service.d
             └─override.conf
     Active: active (running) since Sat 2026-09-26 17:20:39 CEST; 1min 5s ago
 Invocation: 56663b13856e4359b6b308c5a6b3ad37
   Main PID: 1768 (ollama)
      Tasks: 18 (limit: 75557)
     Memory: 1G (peak: 1.3G)
        CPU: 3.225s
     CGroup: /system.slice/ollama.service
             └─1768 /usr/local/bin/ollama serve
# Verify service unit
systemctl cat ollama

# Shell output:
[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/home/fedora/.local/bin:/home/fedora/bin:/usr/local/bin:/usr/bin"

[Install]
WantedBy=default.target

# /usr/lib/systemd/system/service.d/10-timeout-abort.conf
# This file is part of the systemd package.
# See https://fedoraproject.org/wiki/Changes/Shorter_Shutdown_Timer.
#
# To facilitate debugging when a service fails to stop cleanly,
# TimeoutStopFailureMode=abort is set to "crash" services that fail to stop in
# the time allotted. This will cause the service to be terminated with SIGABRT
# and a coredump to be generated.
#
# To undo this configuration change, create a mask file:
#   sudo mkdir -p /etc/systemd/system/service.d
#   sudo ln -sv /dev/null /etc/systemd/system/service.d/10-timeout-abort.conf

[Service]
TimeoutStopFailureMode=abort

# /etc/systemd/system/ollama.service.d/override.conf
[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_CONTEXT_LENGTH=65536"

Verify Listening Port
#

# Check Ollama listening port
sudo ss -lntp | grep 11434

# Shell output:
LISTEN 0      4096    10.0.150.101:11434      0.0.0.0:*    users:(("ollama",pid=11792,fd=3))

Add Firewall Rule
#

# Add firewalld rule
sudo firewall-cmd --permanent --add-port=11434/tcp
sudo firewall-cmd --reload



Ollama Commands
#

Download & Run LLM
#

# Download and run model
ollama run qwen3.5:9b

# Quit Ollama chat
/bye

Ollama Monitoring
#

# Ollama process monitoring
ollama ps

# Shell output:
NAME          ID              SIZE      PROCESSOR    CONTEXT    UNTIL              
qwen3.5:9b    6488c96fa5fa    7.7 GB    100% GPU     65536      4 minutes from now

List Available Models
#

# Verify API / list models
curl http://localhost:11434/api/tags | jq

# Shell output:
{
  "models": [
    {
      "name": "qwen3.5:9b",
      "model": "qwen3.5:9b",
      "modified_at": "2026-08-23T15:34:35.562288913+02:00",
      "size": 6594474711,
      "digest": "6488c96fa5faab64bb65cbd30d4289e20e6130ef535a93ef9a49f42eda893ea7",
      "details": {
        "parent_model": "",
        "format": "gguf",
        "family": "qwen35",
        "families": [
          "qwen35"
        ],
        "parameter_size": "9.7B",
        "quantization_level": "Q4_K_M",
        "context_length": 262144,
        "embedding_length": 4096
      },
      "capabilities": [
        "vision",
        "completion",
        "tools",
        "thinking"
      ]
    }
  ]
}



GPU Usage
#

Nvidia SMI
#

# Nvidia GPU monitoring
nvidia-smi

# Shell output:
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 610.57.04              KMD Version: 610.57.04     CUDA UMD Version: 13.3     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4070 ...    Off |   00000000:01:00.0 Off |                  N/A |
| 31%   63C    P2            193W /  220W |    8704MiB /  12282MiB |     91%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A            2578    C+G   /usr/bin/kwin_wayland                    11MiB |
|    0   N/A  N/A            4159      C   ...local/lib/ollama/llama-server       8652MiB |
+-----------------------------------------------------------------------------------------+
# Watch Nvidia GPU monitoring
watch -n 1 nvidia-smi