Ollama on Linux runs as a systemd service named ollama. systemctl is how you start it, stop it, check whether it is healthy, and decide whether it starts at boot.
What you need
- Ollama installed on Linux via the install script
- sudo access for systemctl commands
- A terminal on the Linux machine
Step 1: Check the current status
Run systemctl status ollama. The output shows whether the service is active (running) or inactive, plus recent log lines. A running service means the API at http://localhost:11434 should answer.
Step 2: Start, stop, and restart
Start with sudo systemctl start ollama, stop with sudo systemctl stop ollama, and restart with sudo systemctl restart ollama. Stopping the service unloads models and closes port 11434; starting it again reloads nothing until a model is requested.
Step 3: Control start at boot
Run sudo systemctl enable ollama so the service starts automatically at boot, or sudo systemctl disable ollama to stop that. Check the change with systemctl is-enabled ollama.
Worked example: stop and restart the service
The table below is a synthetic example. The commands are the documented systemctl commands; the states are the expected outcomes.
| Action | Command | Expected result |
|---|---|---|
| Status | systemctl status ollama | active (running) |
| Stop | sudo systemctl stop ollama | inactive (dead) |
| Start | sudo systemctl start ollama | active (running) |
Expected result (UNTESTED). status shows active (running) after start and inactive (dead) after stop, and the API answers only while the service runs. This check was not run live; the commands come from the cited Linux docs.
Limits
- systemctl needs sudo for start, stop, enable, and disable.
- Stopping the service drops any loaded model from memory.
- The service binds port 11434 on localhost by default.
- On non-systemd systems these commands do not exist; use ollama serve instead.
