New Tool Radar

Local AI

How to Make Ollama Start Automatically at Boot on Linux

Set up Ollama as a systemd service on Linux so the server starts with your computer, and check it is active and enabled.

Schematic diagram with three steps: create the ollama.service file with ExecStart ollama serve, enable and start it with systemctl, then check is-active is active and is-enabled is enabled.

On Linux, Ollama can run as a systemd service, which is the part of the system that starts programs at boot and restarts them if they stop. Ollama’s Linux page calls adding Ollama as a startup service “recommended”, and gives the steps: create a user and group for Ollama, create a service file, then start the service. Once that is done, Ollama is listening on port 11434 after every reboot without an open terminal.

Check whether the service already exists

Before creating anything, check what is already there. Run systemctl status ollama. If the output shows the service loaded and active, the installer already set it up and there is nothing to create. If the command reports the unit is not found, work through the steps below.

Create the user and the service file

The service runs Ollama as its own system user, not as your login user. Create the user and group first:

sudo useradd -r -s /bin/false -U -m -d /usr/share/ollama ollama
sudo usermod -a -G ollama $(whoami)

Then create the service file at /etc/systemd/system/ollama.service with these contents, which are the ones in Ollama’s Linux documentation:

[Unit]
Description=Ollama Service
After=network-online.target
[Service]
ExecStart=/usr/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=$PATH"
[Install]
WantedBy=multi-user.target

The Restart=always line means systemd starts Ollama again if it stops unexpectedly, and WantedBy=multi-user.target is what ties the service to normal boot. Then load the new file and switch the service on:

sudo systemctl daemon-reload
sudo systemctl enable ollama
sudo systemctl start ollama

Try it: prove it starts now and will start at boot

Starting a service and enabling it are two different jobs: starting makes it run now, enabling makes it run at boot. Check both separately, plus the answer on port 11434.

Check Command What you should see
Running now systemctl is-active ollama active
Starts at boot systemctl is-enabled ollama enabled
Full status systemctl status ollama Active: active (running), with the service file listed as loaded
Server answers curl http://localhost:11434 “Ollama is running”

If a check fails, read the service log with journalctl -e -u ollama, which Ollama’s Linux page gives as the way to view the logs of Ollama running as a startup service. Expected result. We checked Ollama’s Linux page and the Continue guide’s Ollama check. We did not create a service or run these commands on this machine.

Limits

Enabling the service does not start it, and starting it does not enable it, so a machine that only had one of the two done will still need a manual start after a reboot. Restarting the service unloads any loaded model and interrupts requests in progress, so do maintenance when nothing is using it. To change settings later, Ollama’s Linux page says to edit the service with systemctl edit ollama rather than editing the unit file directly, then run systemctl daemon-reload and restart the service. We did not test any of this ourselves.

Sources

See all