Ollama
Prerequisites
Section titled “Prerequisites”- Proxmox
- NVIDIA GPU
Install NVIDIA drivers
Section titled “Install NVIDIA drivers”Install the NVIDIA drivers on the Proxmox host. The Proxmox forum guide by bialykostek was used as a reference.
-
Create a blacklist file:
Terminal window nano /etc/modprobe.d/blacklist-nouveau.conf -
Add the following, then save and close the file:
blacklist nouveauoptions nouveau modeset=0 -
Update the initramfs:
Terminal window update-initramfs -u -
Check whether the Nouveau module is loaded:
Terminal window lsmod | grep nouveau -
If it is loaded, unload it and check again:
Terminal window rmmod nouveaulsmod | grep nouveau -
Confirm that the GPU is visible:
Terminal window lspci | grep NVIDIA -
Install the build dependencies and matching headers:
Terminal window apt updateapt install -y build-essential dkms wget ca-certificatesapt install -y "proxmox-headers-$(uname -r)" -
Download and install a compatible NVIDIA driver. Select a driver version appropriate for your GPU and Proxmox kernel:
Terminal window cd /rootwget https://download.nvidia.com/XFree86/Linux-x86_64/580.178.04/NVIDIA-Linux-x86_64-580.178.04.runchmod +x NVIDIA-Linux-x86_64-580.178.04.run./NVIDIA-Linux-x86_64-580.178.04.run -m=kernel --dkms --no-questionsFollow the installer prompts. On a headless Proxmox host, decline any X configuration options.
-
Verify the installation:
Terminal window nvidia-smi -
Optionally enable persistence mode:
Terminal window nvidia-smi --persistence-mode=1nvidia-persistenced
Create and configure the Ollama LXC
Section titled “Create and configure the Ollama LXC”Use the Ollama Proxmox helper script to create the LXC. After installation:
-
Stop the LXC. In the PVE shell, set ownership for the models dataset if the container is unprivileged, then add a mount point to the LXC configuration:
Terminal window chown -R UID:GID /poolname/datasetnameecho "mp0: /poolname/datasetname,mp=/mnt/ollama-models" >> /etc/pve/lxc/104.conf -
Start the LXC. In its shell, edit the Ollama service configuration:
Terminal window systemctl edit ollamaAdd the following settings. If
OLLAMA_HOSTalready exists, update its value:[Service]Environment="OLLAMA_HOST=0.0.0.0:11434"Environment="OLLAMA_MODELS=/mnt/ollama-models"Save and close the editor.
Binding to
0.0.0.0makes Ollama reachable on all network interfaces. Restrict access to trusted clients using your firewall and network configuration. -
Reload systemd and restart Ollama:
Terminal window systemctl daemon-reloadsystemctl restart ollama -
Verify the GPU and bind mount:
Terminal window nvidia-smifindmnt /mnt/ollama-models -
Download and run a model:
Terminal window ollama run qwen3:8b
Troubleshooting
Section titled “Troubleshooting”Container fails to start after the host boots
Section titled “Container fails to start after the host boots”TASK ERROR: Device /dev/nvidia0 does not exist
Section titled “TASK ERROR: Device /dev/nvidia0 does not exist”This can indicate that the NVIDIA kernel modules are not loaded on the host.
-
Check whether the modules are loaded:
Terminal window lsmod | grep nvidia -
If they are not loaded, load the required modules and verify the device files:
Terminal window modprobe nvidiamodprobe nvidia-uvmmodprobe nvidia-drmls -l /dev/nvidia*If the container configuration includes
nvidia-modesetas a device resource, remove that entry for this headless Ollama setup.