Dotfiles/setup/modules/optional-Modules/apps/ollama.sh

23 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Exit immediately on error, treat unset variables as errors, propagate pipe failures.
set -euo pipefail
# Load shared log/warn/skip helpers from the installer library.
source "$(dirname "${BASH_SOURCE[0]}")/../../lib/logging.sh"
# GPU variants: install ollama-cuda (AUR) for NVIDIA or ollama-rocm (AUR) for AMD.
# The base package runs on CPU and auto-uses GPU libs if present at runtime.
log "Installing Ollama..."
# The official Arch repo ships the CPU build; GPU support requires AUR alternatives.
sudo pacman -S --noconfirm --needed ollama
log "Enabling Ollama service..."
# The ollama systemd service exposes a REST API on port 11434 used by frontends
# such as open-webui; enable --now starts it immediately without a reboot.
enable_service ollama.service; start_service ollama.service
log "Ollama running on http://localhost:11434"
log "Pull models with: ollama pull <model>"
# Both Ollama and llama.cpp compete for GPU VRAM; running both simultaneously
# can cause OOM errors or severe performance degradation.
warn "If llama.cpp is also installed, avoid running both GPU-bound at once."