Run Ollama Locally in 2026: Every Command You Need

๐Ÿ“˜ Tutorials 2026-08-01 ยท Updated 2026-08-24 2 min read

Complete Ollama command reference: install, pull models, chat, OpenAI-compatible API server, Modelfile and environment variables.

💡 What You Will Learn

Complete Ollama command reference: install, pull models, chat, OpenAI-compatible API server, Modelfile and environment variables.

📜 Table of Contents

Run Ollama Locally: Every Command You Need

Ollama (177k+ stars on GitHub) is the easiest way to run local LLMs in 2026. This is a copy-paste command reference.

Install

Verify with ollama --version.

Model Management

Command Purpose Example
ollama pull download a model ollama pull qwen2.5:7b
ollama list list downloaded models ollama list
ollama rm delete a model ollama rm qwen2.5:7b
ollama cp clone / rename ollama cp qwen2.5:7b my-qwen

Models are named name:tag (e.g. llama3.2:3b, qwen2.5:7b).

Chat

ollama run qwen2.5:7b

In-chat shortcuts: /bye to exit, /help for all shortcuts, /set parameter num_ctx 8192 to raise context. One-shot: ollama run qwen2.5:7b "explain RAG in one sentence".

API Server

ollama serve listens on port 11434 and exposes an OpenAI-compatible /v1/chat/completions endpoint, so any OpenAI SDK can point at http://localhost:11434/v1. Native endpoints: /api/generate (single completion) and /api/chat (multi-turn). ollama ps shows models loaded in memory.

Modelfile (custom models)

FROM qwen2.5:7b
SYSTEM "You are a careful technical editor."

Save as Modelfile, run ollama create my-editor -f Modelfile, then ollama run my-editor. Useful directives: PARAMETER temperature 0.3, PARAMETER num_ctx 8192.

Environment Variables

Key Parameters

num_ctx (context window, raise for long documents), temperature (0.8 default), top_p (0.9), num_predict (max output tokens, -1 unlimited).

FAQ

Q: Can I run without a GPU? A: Yes, CPU runs 7B at about 2-5 token/s; GPU is typically 5-20x faster. Q: Long documents get truncated? A: Raise num_ctx (--num-ctx 8192 or in Modelfile); larger context uses more memory. Q: LAN access fails? A: Set OLLAMA_HOST=0.0.0.0:11434 and open the firewall port.

Note: model tags and versions change over time; check the official docs.

❓ FAQ

Does Ollama need a GPU?

No - it runs on CPU, but GPU (CUDA/Metal) gives 5-20x speedup.

Is the API OpenAI-compatible?

Yes, the /v1/chat/completions endpoint works with most tools that expect OpenAI.

Related Articles
2026-07-27
ComfyUI Workflow Tutorial 2026: Node-Based AI Image Generation
2026-08-13
AI Audiobook Generator Open Source 2026: Self-Hosted TTS That Reads Your Library
2026-08-11
Context Engineering 2026: The Discipline That Replaced Prompt Engineering for Agents

Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only โ€” no paid placements.

๐Ÿ’ฌ Comments (0)

No comments yet. Be the first!

Login to comment