Running a model on your own hardware teaches you things no API ever will: how much memory a model really needs, why throughput collapses under load, and what “private by default” feels like. This guide gets a self-hosted LLM running in a home lab in an afternoon.
What you need
- A machine with a GPU. An NVIDIA card with 8–12 GB of VRAM comfortably runs 7–8B parameter models at 4-bit quantisation. 24 GB opens up larger models and longer contexts. Apple Silicon Macs also work well thanks to unified memory.
- Linux (or macOS) with current GPU drivers.
- Docker, for the web interface.
- Disk space: a few GB per model; they add up quickly.
CPU-only works for experiments with small models. It’s slow, but it’s a free way to learn the workflow before buying hardware.
Step 1: Install Ollama
Ollama packages model download, quantised weights and a local API into one tool. On Linux:
curl -fsSL https://ollama.com/install.sh | sh
ollama --version
Pull and run a model:
ollama pull llama3.1:8b
ollama run llama3.1:8b "Explain a load balancer in one sentence."
Step 2: Use the API
Ollama listens on port 11434. That makes it a drop-in backend for your own scripts and tools:
curl http://localhost:11434/api/generate -d '{
"model": "llama3.1:8b",
"prompt": "Write a haiku about on-call.",
"stream": false
}'
It also offers an OpenAI-compatible endpoint under /v1, so many existing SDKs work by just changing the base URL.
Step 3: Add a chat interface with Open WebUI
Open WebUI gives you a ChatGPT-style interface on top of Ollama:
docker run -d -p 3000:8080 \
--add-host=host.docker.internal:host-gateway \
-v open-webui:/app/backend/data \
--name open-webui --restart always \
ghcr.io/open-webui/open-webui:main
Open http://<your-server>:3000, create the first (admin) account, and select your model.
Step 4: Make it reliable
A home lab service is still a service. Treat it like one:
- Run Ollama as a systemd service (the installer sets this up) so it survives reboots.
- Watch GPU memory with
nvidia-smi. Loading two large models at once is the most common “it got slow” cause. - Keep it off the public internet. Use a VPN such as WireGuard or Tailscale to reach it remotely.
- Back up the Open WebUI volume if you care about chat history.
- Pin model versions you depend on, so an update doesn’t silently change behaviour.
Choosing a model
Start with a general 7–8B instruction model, then try a coding-focused model and a small embedding model for retrieval experiments. Compare them on your own prompts: a dozen real tasks you care about will tell you more than any leaderboard.
What you’ll learn along the way
You’ll feel the trade-offs that matter in production: quantisation versus quality, context length versus memory, single-user speed versus many-user throughput. Those instincts transfer directly to serving models at work: the same concerns behind serving an LLM API in production. And if you need convincing that a home lab is worth the time, start with The Home Lab as a Developer’s Soul.
FAQ
How much VRAM do I need to run an LLM locally?
Roughly: 8 GB for 7–8B models at 4-bit, 16–24 GB for 13–34B models, more for 70B-class models. Context length adds to that.
Is a self-hosted LLM really private?
Yes, if it runs on your hardware and you don’t expose it publicly: prompts never leave your network. Check any plugins or web-search features you enable.
Can I use it with my code editor or agents?
Yes. Many tools accept an OpenAI-compatible base URL, which Ollama provides.