Ollama Tutorial
Welcome to the Ollama tutorial. It follows the official Ollama docs and the ollama/ollama project so you can run open models on your machine (or Ollama Cloud) and wire them into apps through the CLI, REST, and an OpenAI-compatible API.
Ollama packages download, local inference, and an HTTP server into one workflow: after install, ollama run gemma4 starts a chat, and http://localhost:11434/api accepts requests. Code, notes, and customer text can stay on-device—you do not need a cloud vendor account just to try a prompt.
Table of Contents
Basics
- Introduction — Local LLM runtime, vs vLLM / cloud APIs, privacy
- Installation — macOS / Windows / Linux,
ollama --version, GPU and VRAM - Quick Start — Interactive menu,
pull/run//bye,ls/ps/stop
Models and APIs
- Models and quantization — Library, tags, quantization, cloud models
- REST and OpenAI-compatible API —
/api/generate,/api/chat,/api/embed,/v1 - Python and JavaScript — Official
ollamalibraries, streaming,Client
Customization and retrieval
- Modelfile —
FROM,SYSTEM,PARAMETER,ollama create - Embeddings and a RAG teaser — Embed models, vector API, LangChain RAG
Integration and practice
- Integrations — Dify, LangChain, Hermes / OpenClaw, Cursor, Docker networking
- Practical examples — Local Q&A CLI, OpenAI-compatible client, coding Modelfile
- Resources — Official docs, model library, GitHub
Learning path
Prerequisites
- Comfort with a terminal (macOS / Linux bash, or Windows PowerShell /
curl.exe) - The ideas of model, prompt, and token
- Disk space: models are often several GB to tens of GB
- Optional: an NVIDIA GPU (CUDA) or Apple Silicon (Metal). CPU-only works, just slower
Conventions in this tutorial
- Official quickstart currently uses
gemma4. Library tags change—trust ollama.com/library. For Chinese-heavy work tryqwen2.5; Llama-family tags are common general alternatives. - Local API base:
http://localhost:11434/api. OpenAI-compatible base:http://localhost:11434/v1. - Cloud uses the same API shape at
https://ollama.com/api(account / API key). - Commands and model names in docs.ollama.com win when this page and the site disagree.
What you can do after this course
- Install on macOS / Windows / Linux and confirm
ollama --version - Finish a local chat with
gemma4(orqwen2.5/ Llama) and leave with/bye - Land one request each on
http://localhost:11434/apiandhttp://localhost:11434/v1(PowerShell orcurl.exeon Windows) - Write a Modelfile and
ollama createa reusable assistant name - Point Dify, LangChain, Cursor, or a Dockerized app at Ollama