A model server's downloaded weights can outlast several application releases. On Linux, updating Ollama replaces its executable and runtime libraries while keeping the model store available to the new release.
The official installer supports updates to an existing systemd service installation. You need sudo access, curl, and zstd for current release archives; installations managed by a distribution package manager should stay with that package manager.
The installer recreates the main service unit and restarts Ollama, interrupting active requests. A private data backup and a record of the working release provide a recovery point if the new version cannot use the existing models or service configuration.
Steps to update Ollama on Linux:
- Record the running server's version for rollback.
$ curl -fsS http://127.0.0.1:11434/api/version {"version":"0.40.11"}
The version shown is the release being replaced. Your rollback version must match your own working installation.
- List the installed models to compare after the update.
$ ollama list NAME ID SIZE MODIFIED qwen2.5:0.5b a8b0c5157701 397 MB 3 hours ago
- Back up the service's data and effective configuration before replacing Ollama.
A complete data archive can contain private keys. The backup and restore procedure locates the active store, saves the service definition, and checks a restored copy before use. Custom model directories need their own backup. The data archive does not contain the Ollama executable or runtime libraries.
- Download the official installer to a local file.
$ curl -fsSL https://ollama.com/install.sh -o ollama-install.sh
- Read the downloaded installer before granting it root privileges.
$ less ollama-install.sh
The installer uses sudo for system changes, removes old runtime libraries, installs the release for the machine's architecture, and replaces the main systemd unit. Existing drop-ins remain separate; the saved service definition preserves any changes made directly to the main unit.
- Stop the service for the update window.
Requests and model downloads remain unavailable until the installer restarts the service.
$ sudo systemctl stop ollama
- Install the current Ollama release from the reviewed file.
$ sh ollama-install.sh
If the new release fails, the same reviewed installer can reinstall the recorded working version. For a previous version of 0.40.11, the rollback command is below. A changed service definition or damaged model store also needs its saved configuration or private data backup restored before normal use resumes.
$ OLLAMA_VERSION=0.40.11 sh ollama-install.sh
The rollback command is conditional recovery, not part of a successful update.
Related: How to back up and restore Ollama data - Confirm that the updated service is running.
$ systemctl is-active ollama active
If the service is inactive or failed, its logs identify the startup error.
$ sudo journalctl -u ollama -n 30 --no-pager
- Check the running API's version against the release being replaced.
$ 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"}
A higher version confirms a release change. The retry options allow a short delay while the restarted listener opens. A connection-refused message can precede the successful JSON response.
- Confirm that the CLI and server report the same version.
$ ollama --version ollama version is 0.40.12A client/server mismatch warning means the executable on your shell's path differs from the running server.
Related: How to check the Ollama version - Compare the retained models with the original inventory.
$ ollama list NAME ID SIZE MODIFIED qwen2.5:0.5b a8b0c5157701 397 MB 3 hours ago
- Run an existing model with the updated service.
$ ollama run qwen2.5:0.5b "What is 17 plus 25? Answer in one short sentence." 17 plus 25 equals 42.
An installed model from your own inventory can replace qwen2.5:0.5b. A generated answer shows that the updated service can still load and use the retained model; wording can vary.