Open Weight Models · linux · Keep nearby
Ollama quick reference · linux
Use these commands from a Linux client shell. Keep the same server mode throughout the course. Commands marked systemd require an installed ollama.service on a machine running systemd; ollama serve is the alternative foreground workflow, not an extra server to start alongside it.
Everyday commands
| Command | Use it to… |
|---|---|
cd "$HOME/CyberCorps/open-weight-models" | Return to the folder containing your Python files, Modelfile, and evidence. |
python3 --version | Check the Python 3 interpreter used by the API and capstone scripts. |
ollama --version | Inspect the installed Ollama client version. |
ollama list | Check the server connection and its downloaded model inventory. |
ollama pull gemma3:1b | Download the local course model. |
ollama run gemma3:1b | Open a local model chat; enter /bye inside the chat to return to the shell. |
ollama show gemma3:1b | Inspect the selected model's details. |
ollama ps | Inspect loaded models and their observed processor allocation. |
ollama stop gemma3:1b | Unload the base model while keeping its downloaded files. |
ollama create cybercorps-study -f Modelfile | Create or update the named assistant from the file in your current project folder. |
ollama show --modelfile cybercorps-study | Inspect the configuration stored under the capstone's model name. |
python3 local_chat.py | Run the saved lesson 5 client from the project folder. |
python3 study_assistant.py | Run the five capstone cases using cybercorps-study. |
free -h | Inspect system memory where procps/procps-ng free is installed; this does not report all GPU memory. |
systemctl status ollama --no-pager | Systemd only: inspect the installed Ollama service before deciding whether to start it. |
sudo systemctl start ollama | Systemd only: start the installed service if it is inactive. |
sudo journalctl -u ollama -b -n 100 --no-pager | Systemd only: read recent Ollama logs from the current boot. |
sudo systemctl edit ollama | Systemd only: edit the service override; lesson 7 shows the local-only Environment setting and restart steps. |
OLLAMA_NO_CLOUD=1 ollama serve | Manual foreground alternative: start only after stopping your own prior foreground server and confirming no competing service; verify its startup output. |
Run one command at a time. Model removal changes your local installation; unloading a model only releases its memory. See Lesson 7 for troubleshooting and privacy settings.
Make a local API request
Start Ollama and download gemma3:1b first. These examples request one complete JSON response. The answer is in message.content. Use the example for your shell.
Linux shell: send a local chat request · bash
curl --fail --show-error --max-time 120 \
http://localhost:11434/api/chat \
-H 'Content-Type: application/json' \
-d '{
"model": "gemma3:1b",
"stream": false,
"messages": [
{"role": "user", "content": "Note: the workshop starts at 09:30. Using only this note, what time does it start?"}
]
}'The local endpoint needs no API key. Keep it on your own machine; it is not an authenticated public service. See Lesson 5 for a Python client and conversation history.
Key terms
Weights
The learned numerical parameters used by a model. Their availability does not by itself describe the permissions in its licence.
Inference
Using an existing model to generate a result from an input.
Token
A unit of text processed by the model. A word may occupy more than one token.
Context
The working input available for a generation, including instructions, supplied material, and conversation history.
Quantisation
Representing model values with fewer bits to reduce storage and memory needs, with possible quality trade-offs.
Model tag
A model identifier such as gemma3:1b. Record the model ID as well when you need to track a particular downloaded version.
Modelfile
An Ollama configuration that selects a base model and supplies settings or instructions.
Evaluation
Checking outputs against defined tasks and expected behaviour, while recording errors as well as successes.
Official references
- Ollama CLI reference
- Ollama chat API
- Ollama Modelfile reference
- The course model: Gemma 3 1B
- Ollama: Linux installation and service management
- Ollama: installer source and supported architectures
- Ollama: Linux hardware and GPU support
- Ollama: Linux environment variables and local-only mode
- Python: using Python on Linux and Unix
- Ubuntu: set up Python using Ubuntu packages
- Fedora: Python installation and use