Before you start
- ✓Windows 11 22H2 or newer (Pro or Home both fine)
- ✓Administrator account
- ✓NVIDIA GPU with the latest Game Ready or Studio driver installed
- ✓At least 25 GB free on C:
Native vs WSL2, pick the right path
Ollama ships a native Windows installer that uses CUDA directly. It works and is the easiest option for someone who just wants a chatbot. But every other tool in the local-AI ecosystem, vLLM, llama.cpp builds, Hugging Face Transformers, LangChain, runs more cleanly on Linux. Putting Ollama inside WSL2 lets you mix and match these tools without dual-booting.
We will cover both. If you only ever plan to chat with Ollama or use Open WebUI, the native installer is fine. If you plan to do anything with Python AI tooling, and most of this site assumes you will, install via WSL2.
On the same machine WSL2 Ollama and native Ollama can coexist but they fight for port 11434. Pick one.
Option A: Native Windows install (fastest)
Download the OllamaSetup.exe installer from ollama.com. It places ollama in %LOCALAPPDATA%\Programs\Ollama, drops a tray icon, and starts the daemon at login. No reboot required. The native build links against the same NVIDIA driver your games use, so as long as nvidia-smi works in PowerShell you are done.
# In PowerShell (no need to be admin):
winget install Ollama.Ollama
# Or download manually from https://ollama.com/download/windows
# Verify
ollama --version
ollama pull llama3.1:8b
ollama run llama3.1:8bwinget is the cleanest path. Auto-updates with `winget upgrade`.
Option B: Install WSL2 first
If you want the Linux path, enable WSL2 with a single PowerShell command. This installs the WSL feature, the kernel, and Ubuntu 22.04 as your default distro. You need to reboot after this, there is no skipping it. After the reboot, Ubuntu launches automatically and prompts you for a username and password.
# Run as Administrator
wsl --install -d Ubuntu-22.04
# After reboot, in the Ubuntu window:
sudo apt update && sudo apt upgrade -yStep 2: Install the NVIDIA WSL CUDA toolkit
WSL2 is special, you do NOT install a Linux NVIDIA driver inside it. The Linux side talks to your Windows driver through a passthrough device. What you do need is the CUDA toolkit, which provides the user-mode libraries. NVIDIA ships a WSL-specific package that does not bring its own driver. Use that one.
# Inside Ubuntu WSL
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update
sudo apt install -y cuda-toolkit-12-4
# Verify
nvidia-sminvidia-smi works inside WSL2 because Windows forwards the driver. No Linux driver install.
Never run `sudo apt install nvidia-driver-XXX` inside WSL2. It will install incompatible libraries that break the passthrough.
Step 3: Install Ollama inside WSL2
Now Ollama installs the same way as on a real Ubuntu box, one curl pipe. The installer's CUDA-detection logic works inside WSL too. After install, ollama serve runs as a systemd service inside WSL. Note: WSL2's systemd integration must be enabled in /etc/wsl.conf, which the Ubuntu-22.04 image ships with already.
curl -fsSL https://ollama.com/install.sh | sh
sudo systemctl enable --now ollama
ollama pull llama3.1:8b
ollama run llama3.1:8bStep 4: Reach Ollama from Windows apps
WSL2 networks live on a virtual switch. By default localhost:11434 in Windows is forwarded into WSL automatically, so an Open WebUI Docker container or a Python script running in Windows can still hit http://localhost:11434. If for some reason that does not work, find your WSL IP with `wsl hostname -I` and use that.
# From PowerShell, should print model list:
curl http://localhost:11434/api/tags
# If localhost forwarding is broken, get WSL IP:
wsl hostname -IStep 5: Make Ollama start at login (WSL)
By default WSL only runs while you have a terminal open. To keep Ollama running in the background even with no terminal, create a small shortcut that runs wsl -d Ubuntu-22.04 -u root -- service ollama start on user logon. Put it in shell:startup. This is hacky but it is what every WSL Ollama user does, and it costs you ~5 MB of idle RAM.
# In Windows Run dialog (Win+R), type: shell:startup
# In that folder, create a file ollama-start.bat with these contents:
@echo off
wsl -d Ubuntu-22.04 -u root -- service ollama startPerformance note: where models live
By default WSL stores its filesystem inside %USERPROFILE%\AppData\Local\Packages\... on your C: drive. If you have a small SSD and a fat HDD, that bites, a single 70B model is 40 GB. The cleanest fix is to set OLLAMA_MODELS to a path that lives on a Windows drive mounted into WSL, e.g. /mnt/d/ollama-models. Don't use a network drive, model loading reads many gigabytes sequentially and any latency kills startup time.
sudo systemctl edit ollama.service
# Add:
# [Service]
# Environment="OLLAMA_MODELS=/mnt/d/ollama-models"
sudo systemctl daemon-reload
sudo systemctl restart ollamaTags
Stuck? Share your build?
Hundreds of homelabbers are working through these same tutorials in our community. Drop your config, ask the hard question, or show off what you built.
Join the discussion
