A few years ago, running a large language model on your own computer meant wrestling with Python environments, CUDA versions and a pile of GitHub repos that may or may not work together. Today you can run a local LLM with a single installer and one command.

I’ve heard the same three reasons over and over from people who want to try this:

  • Privacy. Nothing you type leaves your machine. That matters a lot if you’re working with client data, source code or anything under an NDA.
  • Cost. No monthly subscription and no per-token API bill.
  • Offline access. It works on a plane, at a cabin, or anywhere the Wi-Fi is bad.

In this guide I’ll walk you through setting up Ollama, the most popular tool for running open source AI models locally, picking the right model for your hardware, and hooking it up to a nice chat interface and your own scripts.

What Is Ollama?

Ollama is a free, open source tool that downloads, manages and runs large language models on your own computer. Think of it like Docker for AI models: you pull a model, you run it, and Ollama handles the GPU acceleration, memory management and model formats behind the scenes.

It runs on Windows, macOS and Linux, and it exposes a local API so other apps (and your own code) can use the models too.

Local LLM Hardware Requirements

This is the part most guides skip, and it’s the part that decides whether your experience is great or painfully slow. The key number is memory: GPU VRAM if you have a dedicated graphics card, or unified memory on Apple Silicon Macs.

Here’s a rough guide for 4-bit quantized models (the default for most Ollama downloads):

Model SizeApprox. Memory NeededExample HardwareWhat to Expect
1B to 4B parameters4 to 6 GBMost laptops from the last few years, 8 GB RAMFast, good for simple tasks and summaries
7B to 9B parameters6 to 10 GBRTX 3060 12 GB, M1/M2 Mac with 16 GBThe sweet spot for most people
12B to 14B parameters10 to 16 GBRTX 4070 Ti Super 16 GB, Mac with 24 GB+Noticeably smarter, still responsive
27B to 32B parameters18 to 24 GBRTX 3090/4090 24 GB, Mac with 32 GB+Close to commercial chatbot quality for many tasks
70B parameters40 GB+Dual GPUs or Mac with 64 GB+Excellent, but you need serious hardware

Just to reiterate: no GPU doesn’t mean no AI. Ollama will run models on your CPU and system RAM. It’ll just be slower, so stick with smaller models in that case.

Step 1: Install Ollama

Windows and macOS

Download the installer from ollama.com, run it, and you’re done. Ollama runs in the background and adds itself to your system tray or menu bar.

Linux

Run the official install script:

# Download and run the official Ollama install script
curl -fsSL https://ollama.com/install.sh | sh

# Confirm it installed and check the version
ollama --version

On Linux, Ollama installs as a systemd service, so it starts automatically on boot. If you need a fresh Linux box to play with, my guide on how to install Ubuntu 24 will get you there.

Step 2: Download and Run Your First Model

Open a terminal (or PowerShell on Windows) and run:

# Download (if needed) and start an interactive chat with Llama 3.2 (3B)
ollama run llama3.2

The first run downloads the model, which is about 2 GB for this one. After that, you’ll get a >>> prompt. Type a question and hit enter. To exit, type /bye.

That’s it. You’re now running a local LLM.

Step 3: Pick the Best Local LLM for Your Use Case

The Ollama model library has hundreds of models, which is a little overwhelming the first time. Here are the families I’d start with:

ModelGood ForTry This Command
Llama 3.2 (Meta)Lightweight general chat on modest hardwareollama run llama3.2
Qwen 3 (Alibaba)Strong all-rounder, reasoning, multilingualollama run qwen3:8b
Gemma 3 (Google)General chat, plus image understandingollama run gemma3:12b
DeepSeek-R1 distillsStep-by-step reasoning and mathollama run deepseek-r1:8b
Qwen 2.5 CoderWriting and explaining codeollama run qwen2.5-coder:7b
Mistral 7BFast, efficient general-purpose modelollama run mistral

The part after the colon is the tag, which usually sets the size. Start with a 7B or 8B model, see how fast it feels on your machine, then size up or down from there. New models land in the library all the time, so it’s worth checking back every couple of months.

Essential Ollama Commands

Here are the commands you’ll use day to day:

ollama list              # Show every model you've downloaded and its size
ollama pull qwen3:8b     # Download a model without starting a chat
ollama run qwen3:8b      # Start an interactive chat
ollama ps                # Show which models are loaded in memory right now
ollama stop qwen3:8b     # Unload a model to free up memory
ollama rm mistral        # Delete a model you don't need anymore
ollama show qwen3:8b     # Show model details: parameters, context length, license

Models can be several gigabytes each, so ollama rm is your friend if your drive starts filling up.

Step 4: Add a ChatGPT-Style Interface with Open WebUI

The terminal is fine for testing, but for daily use you’ll want a proper chat window with history, file uploads and model switching. Open WebUI is the most popular option. If you have Docker installed, it’s one command:

# Run Open WebUI in Docker and connect it to Ollama on your machine
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

Here’s what the important flags do:

  • -p 3000:8080 makes Open WebUI available at http://localhost:3000.
  • --add-host=host.docker.internal:host-gateway lets the container reach Ollama running on your host.
  • -v open-webui:/app/backend/data keeps your chats and settings when the container restarts.
  • --restart always starts it back up automatically whenever Docker starts.

Then open http://localhost:3000, create a local admin account, and pick any model you’ve pulled from the dropdown. Recent versions of Ollama’s desktop app on Windows and Mac also include a simple built-in chat window if you’d rather skip Docker altogether.

Step 5: Use the Local API in Your Own Code

This is where running AI locally gets really fun. Ollama serves an API on port 11434, and it includes an OpenAI-compatible endpoint, so a lot of existing tools and code work with just a URL change.

Here’s a quick Python example using the official openai package:

# pip install openai
from openai import OpenAI

# Point the client at your local Ollama server instead of OpenAI
client = OpenAI(
    base_url="http://localhost:11434/v1",  # Ollama's OpenAI-compatible endpoint
    api_key="ollama",                      # Required by the library, but Ollama ignores it
)

response = client.chat.completions.create(
    model="qwen3:8b",  # Any model you've pulled with `ollama pull`
    messages=[
        {"role": "system", "content": "You are a helpful Linux sysadmin."},
        {"role": "user", "content": "Explain what 'chmod 755' does in one paragraph."},
    ],
)

print(response.choices[0].message.content)

A good example of where this shines: summarizing log files or parsing documents that you’re not allowed to paste into a cloud chatbot. If you liked my file integrity monitoring with Python post, you could pipe its change reports into a local model and get a plain-English summary of what changed. All of it stays on your machine.

Troubleshooting Common Local LLM Problems

  • Responses are painfully slow. The model is probably too big for your VRAM and spilling over to the CPU. Run ollama ps and check the processor column. If it doesn’t say 100% GPU, try a smaller model or a smaller tag.
  • “Out of memory” errors. Close other GPU-heavy apps (games, video editors) or drop to a smaller model.
  • Other devices can’t reach the API. By default Ollama only listens on localhost. Set the OLLAMA_HOST environment variable to 0.0.0.0 to expose it on your network, and only do that on a network you trust.
  • The model forgets earlier parts of a long conversation. You’ve hit the context window. Some models support much longer context; you can raise it with the OLLAMA_CONTEXT_LENGTH environment variable if you have the memory to spare.

Local LLM vs Cloud AI: Which Should You Use?

Honest answer: both. The biggest frontier models from the major AI labs are still more capable than anything you can run on a gaming PC, especially for complex reasoning and long documents. But a good local model handles a huge chunk of everyday tasks like drafting, summarizing, brainstorming and simple coding help, and it does it privately and for free.

A lot of people (myself included) end up using a local model for sensitive or high-volume work and a cloud model when they need the heavy hitter.

Frequently Asked Questions

Is Ollama free?

Yes. Ollama is free and open source, and so are the models in its library, though each model has its own license, which you can view with ollama show.

Can I run a local LLM without a GPU?

Yes. Ollama falls back to your CPU and system RAM. Stick with 1B to 4B models and expect slower responses than a GPU would give you.

Is a local LLM really private?

When you run a model locally, your prompts and responses are processed on your own hardware and aren’t sent to an AI provider. Just be aware of any extra tools or plugins you connect, since those could make network calls of their own.

What’s the best local LLM for coding?

Qwen 2.5 Coder is a strong starting point. Pick the largest size your hardware handles comfortably, since coding quality improves a lot with model size.

Wrapping Up

Running a local LLM used to be a weekend project. Now it’s about a ten-minute job. Install Ollama, pull a 7B or 8B model, and spend an evening throwing your real work at it. You’ll get a feel for what it’s great at pretty quickly.

Feel free to swap in different models and adapt the Python example for your own use case.

Leave a Reply

Your email address will not be published. Required fields are marked *

Trending