�
Run an Open-Source LLM on Your
PC
A complete guide to installing and using Ollama locally
� Last updated: March 2026 � LLMs · AI · Developer Tools
� Contents
1. What Are Open-Source LLMs?
2. Choosing a Platform
3. Installing Ollama
4. Running Models via CLI
5. Managing Models & Resources
6. Using Ollama with Your Own Apps
7. Troubleshooting
8. Why Run Locally?
�
You no longer need a cloud subscription or massive server to run a capable LLM. With Ollama,
you can run models like Llama 3, Mistral, or Phi entirely on your own machine — privately and
offline.
1 · What Are Open-Source LLMs?
An open-source large language model is an AI that can understand and generate text — much like
ChatGPT — but without depending on external servers. You download the model files, run them
locally, and even fine-tune them for your use cases.
Popular examples include:
•
•
•
Llama 3 (Meta)
Mistral / Mixtral (Mistral AI)
Gemma (Google)
•
Phi-3 (Microsoft)
You can choose between smaller models that run on CPUs, or larger ones that take advantage of a
dedicated GPU. Running locally gives you privacy, control, and zero API costs.
2 · Choosing a Platform
To run an open-source model, you need a platform that can load it, manage parameters, and
provide an interface. Three popular options:
Tool
Best For
Interface
� Ollama
Developers, CLI power users, API
integration
CLI + UI + REST API
� LM Studio
Beginners who prefer a GUI
Graphical desktop app
� GPT4All
Offline chat, no setup fuss
Desktop app
✅
This guide uses Ollama — it's the most developer-friendly option and integrates easily with
external tools, scripts, and apps.
3 · Installing Ollama
Option A — GUI Installer (Windows)
Visit ollama.com and download the Windows installer. Double-click the .exe and follow the setup
wizard (takes about 2 minutes). Once finished, Ollama runs as a background service.
Option B — macOS / Linux (Terminal)
# macOS (Homebrew)
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
Verify your installation with:
ollama --version
�
On first launch, Ollama starts a local server at http://localhost:11434. Keep this running
whenever you want to use a model.
4 · Running Models via CLI
The Ollama CLI makes downloading and running models a one-liner. Open your terminal and
run:
Pull a model
# Pull Google's lightweight Gemma model (270M params)
ollama pull gemma3:270m
# Or pull Llama 3 (8B — needs ~5GB RAM)
ollama pull llama3
# Or Mistral (7B — strong all-rounder)
ollama pull mistral
Run an interactive session
ollama run gemma3:270m
>>> Say something...
# Type /bye to exit
�
Everything stays on your machine. No data is sent to any server once the model is downloaded.
5 · Managing Models & Resources
Each model takes up disk space and RAM. Here are the commands you'll use most:
Command
What it does
ollama list
Show all downloaded models
ollama rm model_name
Remove a model to free disk space
ollama pull model_name
Download a model
ollama run model_name
Start a chat session with the model
ollama ps
See which model is currently loaded in memory
Hardware requirements at a glance
Model
RAM Needed
Good for
Gemma 270M / Phi-2
~2 GB
Most laptops, quick testing
Llama 3 8B / Mistral 7B
~6–8 GB
Everyday tasks, coding help
Llama 3 70B
~40+ GB
High-end desktop + GPU
6 · Using Ollama in Your Own Apps
Once Ollama is running, it exposes a local REST API at http://localhost:11434. You can call it
from any language — here's a Python example:
import requests, json
url = "http://localhost:11434/api/generate"
payload = {
"model": "gemma3:270m",
"prompt": "Summarise the key benefits of local LLMs."
}
response = requests.post(url, json=payload, stream=True)
for line in response.iter_lines():
if line:
data = json.loads(line.decode("utf-8"))
if "response" in data:
print(data["response"], end="", flush=True)
Common integrations:
•
•
•
•
Open WebUI — a ChatGPT-like browser UI that points at your local Ollama server
Continue.dev — VS Code / JetBrains plugin for AI coding assistance
LangChain / LlamaIndex — use Ollama as a drop-in LLM backend
Your own chatbot, automation scripts, or internal tools
7 · Troubleshooting
�
Most issues come down to three things: available RAM, GPU drivers, and firewall/antivirus
blocking port 11434.
Problem
Fix
Model loads slowly / crashes
Try a smaller model first (Gemma 270M or Phi-2). Close other
apps to free RAM.
Port 11434 not accessible
Add Ollama as an allowed app in your firewall / antivirus
settings.
GPU not being used
Update your GPU drivers. Ollama auto-detects
NVIDIA/AMD/Apple Silicon.
ollama: command not found
Re-open terminal after install, or add Ollama to your PATH.
Slow inference on CPU
Expected for 7B+ models. Use a 1–3B model for faster
responses on CPU.
8 · Why Run Locally?
Running LLMs on your own hardware changes the way you work with AI:
•
•
•
•
•
•
� Privacy — your data never leaves your machine
� Zero cost — no API bills, no rate limits
� Offline — works without an internet connection
⚡ Speed — no network latency once the model is loaded
� Customisable — fine-tune on your own data
� Experimentation — swap models instantly for benchmarking
As open-source communities grow and consumer hardware improves, local AI will only become
more powerful and accessible. Starting with Ollama today means you're ahead of the curve.
→ Search for models at ollama.com/search · Original guide by Manish Shivanandhan on freeCodeCamp