Linux

Ollama: How to Run AI Locally on Your Computer for Free

Ollama: How to Run AI Locally on Your Computer for Free
Table of Contents

An AI assistant that runs entirely on your own computer. No subscription, no API bill, no internet needed once it is downloaded, and nothing you type ever leaves your machine. That is not a future promise; you can have it working in about ten minutes.

The tool is Ollama. This guide installs it on Windows, Mac and Linux with the actual commands, helps you choose a model that fits your RAM instead of one that crawls, and shows you how to use it from your own code.

What you will have by the end:

✓ Ollama installed and verified
✓ A model chosen to match your computer, not a random one
✓ A working chat in your terminal, offline
✓ A local API you can call from Node, PHP or Python
✓ Your own custom assistant with a Modelfile

What Ollama Actually Does

When you use a cloud AI service, your words travel to somebody else’s server, get processed there, and come back. With Ollama the model file sits on your disk and runs on your own processor and memory.

CLOUD AI Your computer your question travels over the internet Someone else’s server needs internet · costs money OLLAMA Your computer  ·  the model lives here works offline · free after download · nothing leaves question and answer both stay in the same box
🔒 PrivacyClient documents, business data, code you cannot share. None of it leaves your disk, which matters if you have ever hesitated before pasting something into a chat box.
✈ Works offlineAfter the download, no connection needed. Useful on a plane, on slow internet, or when the service you rely on is down.
💰 No per-request billRun it a thousand times a day for the cost of electricity. Good for experiments that would be expensive to meter.
⚙ Full controlChoose the model, set its personality with a Modelfile, and call it from your own code through a local API.

1Install Ollama

Windows

Go to ollama.com/download, get the Windows installer, run it and follow the steps. When it finishes, Ollama runs quietly in the background and its icon appears in the system tray near the clock.

macOS

Download the macOS file from the same page, open it, and drag Ollama into Applications. Launch it once; the icon appears in the menu bar at the top of the screen. If you prefer Homebrew: brew install ollama.

Linux (and WSL)

The original guide said to “run the installation command” without showing it. Here it is:

Terminal
curl -fsSL https://ollama.com/install.sh | sh

Pasting a script from the internet deserves a glance first. Open https://ollama.com/install.sh in your browser and read it before running, which is good practice with any curl | sh command, from any project.

Check it worked

Terminal
ollama --version
Terminal
$ ollama --version
ollama version is 0.12.3

Example output. Any version number means you are ready.

PICK PROPERLY

2Choose a Model That Fits Your Computer

This is where most people go wrong. They install the biggest model they have heard of, it crawls at one word per second, and they decide local AI is not viable. The model must fit comfortably in your memory, with room left for everything else you are running.

HOW MUCH RAM DOES YOUR COMPUTER HAVE?

Start with this

The rule of thumb: a model needs roughly half a gigabyte of RAM per billion parameters in its compressed form, plus a couple of gigabytes of working room. So a 7B model wants about 5 GB, and a 14B model about 9 GB. If you have a dedicated graphics card with its own memory, the same arithmetic applies to that, and it will be considerably faster.

3Run Your First Model

Terminal
ollama run llama3.2

The first run downloads the model, which is a few gigabytes, so it takes a while. After that it starts in seconds and never needs the internet again.

Terminal
$ ollama run llama3.2
pulling manifest
pulling dde5aa3fc5ff: 100% ▕████████████████▏ 2.0 GB
verifying sha256 digest
writing manifest
success

>>> Explain what a Docker volume is, in two sentences.

A Docker volume is a storage area managed by Docker that lives
outside a container's own filesystem. Because it is separate, the
data inside it survives when the container is deleted or rebuilt.

>>> /bye

Example session. Type /bye to leave, or /? to see the in-chat commands.

Turn off your Wi-Fi and ask it something else. It keeps working. That moment is when the idea stops being abstract: a genuinely useful AI assistant, running on a laptop, with no connection at all.

Models worth knowing

ModelGood atTry
Llama 3.2General chat and writing. Small sizes that run almost anywhere.ollama run llama3.2
Llama 3.1 8BA noticeable step up in quality, if you have the memory.ollama run llama3.1
Qwen 2.5 CoderWriting and explaining code. The one to use as a coding helper.ollama run qwen2.5-coder
Gemma 3Google’s open models, several sizes including very small ones.ollama run gemma3
Mistral 7BFast, solid all-rounder that has been popular for a long time.ollama run mistral
DeepSeek-R1Reasoning step by step. Slower, but shows its working.ollama run deepseek-r1:7b

Model names move. New versions appear constantly and old tags get superseded, so check ollama.com/library for what is current rather than trusting any article’s list, including this one. Add a size tag to be specific: ollama run gemma3:4b.

4The Commands You Will Use

CommandWhat it does
ollama run <model>Chat with a model, downloading it first if needed
ollama pull <model>Download without starting a chat, useful before travelling
ollama listWhat you have downloaded, and how much space each takes
ollama psWhat is loaded in memory right now
ollama show <model>Details: parameter count, context length, licence
ollama rm <model>Delete a model and reclaim the disk space
ollama serveRun the background service manually, if it is not already running
ollama run <model> "question"Ask one question and get the answer, without entering chat mode
Terminal
$ ollama list
NAME                  ID              SIZE      MODIFIED
llama3.2:latest       a80c4f17acd5    2.0 GB    2 hours ago
qwen2.5-coder:7b      2b0496514337    4.7 GB    yesterday
mistral:latest        f974a74358d6    4.1 GB    3 days ago

$ ollama ps
NAME                  SIZE      PROCESSOR          UNTIL
llama3.2:latest       3.1 GB    100% GPU            4 minutes from now

Example output. In ollama ps, “100% GPU” means it is running on your graphics card, which is much faster. “100% CPU” means it is not.

THE USEFUL PART

5Use It From Your Own Code

Ollama quietly runs a local API on port 11434. This is what turns it from a terminal toy into something you build with: no key, no bill, and your data never leaves the machine.

Terminal  —  check the API is alive
curl http://localhost:11434/api/tags
summarise.js  —  Node.js
const res = await fetch('http://localhost:11434/api/chat', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    model: 'llama3.2',
    stream: false,
    messages: [
      { role: 'system', content: 'You summarise text in exactly 3 bullets.' },
      { role: 'user',   content: '...paste the text here...' }
    ]
  })
});

if (!res.ok) throw new Error(`Ollama error ${res.status}`);

const data = await res.json();
console.log(data.message.content);
summarise.php  —  PHP or Laravel
<?php
$payload = [
  'model'  => 'llama3.2',
  'stream' => false,
  'prompt' => 'Write a one-line product description for a blue mug.',
];

$ch = curl_init('http://localhost:11434/api/generate');
curl_setopt_array($ch, [
  CURLOPT_POST           => true,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER     => ['Content-Type: application/json'],
  CURLOPT_POSTFIELDS     => json_encode($payload),
]);

$data = json_decode(curl_exec($ch), true);
echo $data['response'];

Projects this makes easy: summarise your own notes, tag support emails, generate alt text for images in bulk, draft commit messages, or process a folder of client documents that must never leave the office. All free to run, as many times as you like.

6Make Your Own Assistant

A Modelfile wraps an existing model with your own instructions and settings. Create a file named Modelfile, with no extension:

Modelfile
FROM llama3.2

# 0 is focused and repeatable, 1 is creative and loose
PARAMETER temperature 0.3

# how much conversation it can remember at once
PARAMETER num_ctx 4096

SYSTEM """
You are a senior Laravel developer reviewing code for a junior.
Always: point out security problems first, keep answers under
150 words, and show a corrected code snippet.
Never: suggest a package without saying why it is needed.
"""
Terminal
ollama create laravel-reviewer -f Modelfile
ollama run laravel-reviewer

Now you have a permanent assistant with that personality, usable from the terminal or the API like any other model.

Want a Chat Window Instead of a Terminal?

Ollama is a command-line tool at heart, but several free interfaces sit on top of it and look like a normal chat app.

Open WebUIThe most popular option: a browser chat interface with conversation history, file uploads and multiple models. Runs in one Docker command.docs.openwebui.com ↗
Your editorSeveral VS Code extensions connect to a local Ollama model for code completion and explanations, with nothing sent to a server.
Terminal  —  Open WebUI with Docker
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

# Then open http://localhost:3000

When It Does Not Behave

It is painfully slow, one word at a time

The model is too big for your memory, so your computer is swapping to disk. Run ollama ps: if it says “100% CPU” and you have a graphics card, it is not using it. Otherwise drop to a smaller model, for example from a 14B to a 7B, or from a 7B to a 3B. A smaller model you actually use beats a bigger one you wait for.

Error: model requires more system memory

Exactly what it says. Close other applications, or pick a smaller size tag: ollama run gemma3:1b instead of the larger variants. Check what you have with ollama list and remove what you do not need.

Error: could not connect to ollama app

The background service is not running. On Windows and macOS, open the Ollama application. On Linux, sudo systemctl start ollama, or just run ollama serve in a terminal and leave it open.

Port 11434 already in use

Ollama is already running, usually from the tray or menu bar app, so you do not need to start it again. If you genuinely need a different port, set OLLAMA_HOST=127.0.0.1:11500 before starting it.

My disk is filling up

Models are large. ollama list shows the size of each, and ollama rm <model> removes one. It is easy to collect six models you tried once; keep two or three you actually use.

Can I run it inside WSL?

Yes, and the Linux install command works there. If you already run Ollama on Windows, you do not need a second copy: from WSL you can reach the Windows one over the network. See our WSL setup guide for the general environment.

Being Honest About the Limits

Local models are genuinely useful. They are not the same as the largest cloud models, and pretending otherwise leads to disappointment.

Local with OllamaLarge cloud models
PrivacyComplete. Nothing leaves your machineYour text goes to a provider
CostFree after downloadPer request, or a subscription
Works offlineYesNo
Quality on hard problemsGood; a clear step behind the bestStill the leaders
SpeedDepends entirely on your hardwareConsistently fast
Best forPrivate documents, bulk jobs, offline work, learning, experimentsHardest reasoning, longest context, newest capabilities

Most people end up using both. Local models for the routine, high-volume and private work, cloud for the genuinely hard questions. That split costs almost nothing and keeps your sensitive material at home.

Common Questions

Is Ollama really free?

Yes. The tool is open source and the models in its library are free to download and run. You pay in disk space and electricity. Some models have licences that restrict commercial use, so check ollama show <model> if you plan to build a product on one.

Do I need a graphics card?

No, but it helps a great deal. Small models run acceptably on a modern CPU. A dedicated GPU, or an Apple Silicon Mac with its unified memory, makes larger models practical.

Can it read my files?

Not by itself, but you can feed them in. From the terminal, pipe a file into it; from code, read the file and include the text in your prompt. Interfaces such as Open WebUI add file uploads on top.

Does it train on my data?

No. Running a model does not change it. Your conversations are not used for training by anyone, which is the entire privacy argument for doing this locally.

Which model should I actually start with?

Start small and go up. On 8 GB of RAM begin with llama3.2; on 16 GB try llama3.1 or qwen2.5-coder for programming. If it answers quickly, try a larger one. If it crawls, go smaller.

Can I use this for client work?

That is one of its best uses, precisely because client material never leaves your machine. Check the licence of the specific model if the output goes into a commercial product, and tell clients what you are doing, since “it runs on my own computer” is usually a reassuring answer.

WATCH IT

The Full Video Guide

Here is the whole setup on video:

New AI, Linux, Docker and Laravel tutorials every week.

Read next: Apple Just Made the Case That Your Next AI Server Is a Mac, which is the same idea at a larger scale: owning the hardware instead of renting the tokens.

Final Thoughts

Two things decide whether local AI feels magical or disappointing. Pick a model that fits your RAM, because an 8 GB machine running a 3B model is genuinely pleasant while the same machine running a 14B one is misery. And use the API on port 11434, because that is where it stops being a novelty and starts replacing work you currently pay for.

Install it tonight, run the model the picker suggested, then turn off your Wi-Fi and ask it something. Tell me in the comments which model you landed on and how it ran. I read every one.

If this was useful, share it with someone paying monthly for something their laptop can do.

Share this article

Muhammad Azeem

Written by

Muhammad Azeem

Articles by Muhammad Azeem on azeemtechstudio.com.

Stay Updated

Get the latest coding tutorials, web development tips, AI tools, and technology articles delivered to your inbox.

No spam — we only use your email to send new articles.

Join the Discussion

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

About AzeemTechStudio

AzeemTechStudio Learn about programming and Web Development

Practical tutorials, programming tips and insights on Laravel, PHP, Docker, Linux, JavaScript, AI and modern web development.

Learn more