A Linux host can keep Ollama available without an open terminal or desktop session. The Ollama systemd service runs the local API in the background and supports automatic startup at boot.
Systemd tracks the running process separately from its boot policy. Starting the ollama unit makes it available now, while enabling it arranges startup on later boots; disabling it does not stop a running server.
The ollama unit must already exist, as it does after installation with the Linux installer. Stopping or restarting it interrupts active requests and unloads models, so service maintenance needs a suitable interruption window.
To remove automatic startup, sudo systemctl disable ollama changes the boot policy to disabled, which systemctl is-enabled ollama reports; the running API remains available. For planned maintenance, sudo systemctl stop ollama stops the API; systemctl is-active ollama then reports inactive and requests to the local endpoint fail. Neither operation deletes downloaded models. Starting and enabling the service restores normal background operation.
Steps to manage the Ollama service:
- Check whether the Ollama service is active.
$ systemctl is-active ollama inactive
active means the process is running; inactive means it is stopped. A failed state calls for log inspection before further changes.
Related: How to view Ollama logs - Start the Ollama service if it is stopped.
$ sudo systemctl start ollama
Starting an already active unit leaves its existing process running. A missing ollama.service means the service has not been installed.
Related: How to install Ollama on Linux - Confirm that the API answers after startup.
$ curl -fsS --retry 5 --retry-connrefused --retry-delay 1 http://127.0.0.1:11434/api/version curl: (7) Failed to connect to 127.0.0.1 port 11434 after 0 ms: Could not connect to server {"version":"0.40.12"}
The version follows the installed release. A connection-refused message can precede the version response while the request retries startup; a persistent failure needs service-status and log inspection.
- Restart the Ollama service when a configuration change requires it.
A restart interrupts requests and unloads models even when the service was already healthy.
$ sudo systemctl restart ollama
- Check that the API is reachable after the restart.
$ curl -fsS --retry 5 --retry-connrefused --retry-delay 1 http://127.0.0.1:11434/api/version curl: (7) Failed to connect to 127.0.0.1 port 11434 after 0 ms: Could not connect to server {"version":"0.40.12"}
- Enable the service at boot when the host should serve Ollama after restarts.
$ sudo systemctl enable ollama Created symlink '/etc/systemd/system/default.target.wants/ollama.service' → '/etc/systemd/system/ollama.service'.
An already enabled unit may produce no output. Enabling alone does not start a stopped service.
- Verify that boot startup is enabled.
$ systemctl is-enabled ollama enabled
- Inspect the running service without opening a pager.
$ systemctl status ollama --no-pager --lines=0 ● ollama.service - Ollama Service Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: enabled) Active: active (running) since Wed 2026-10-28 10:55:47 +08; 1s ago ##### snipped #####
The status should show active (running). This proves process state; the API request confirms that the server accepts connections.
- Confirm that the enabled service still answers API requests.
$ curl -fsS http://127.0.0.1:11434/api/version {"version":"0.40.12"}