A retired local model server can leave both a background service and a large model store behind. A complete Ollama uninstall on Linux removes the installed application and service, with a separate decision about retaining model data.

The standalone Linux installer creates a systemd service and a dedicated Ollama account. Removal requires sudo access and the actual installation paths; the binary's resolved location identifies the prefix for its accompanying libraries.

Stopping Ollama interrupts requests and downloads. Deleting its service home also destroys downloaded models and local identity keys, so a private backup outside that home is needed if those files must be recoverable.

Steps to uninstall Ollama on Linux:

  1. Locate the installed Ollama binary.
    $ readlink -f "$(command -v ollama)"
    /usr/bin/ollama

    The library and binary removal paths below use the installation prefix, /usr. If the binary resolves elsewhere, only its matching installation prefix belongs in those removal commands. Deleting every possible prefix can remove unrelated installations.

  2. Inspect the Ollama service definition.
    $ sudo systemctl cat ollama

    ExecStart should identify the same binary, and User and Group identify the account to remove. The service file is normally at the path below; any listed drop-ins belong to the service's configuration directory.

    /etc/systemd/system/ollama.service
    /etc/systemd/system/ollama.service.d
  3. Locate the running service's home and model-directory override.
    $ sudo cat /proc/"$(systemctl show ollama -p MainPID --value)"/environ | tr '\0' '\n' | grep -E '^(HOME|OLLAMA_MODELS)='
    HOME=/usr/share/ollama

    The data deletion below assumes this home and no OLLAMA_MODELS override. A custom model directory and your terminal account's own model store remain outside that deletion.

  4. Back up the service data first if it must be recoverable.

    The removal below permanently deletes the live model store and identity keys. The backup and restore instructions preserve the complete service data in a private directory outside the service home. A backup can contain authentication keys and needs access-controlled storage.
    Related: How to back up and restore Ollama data

  5. Stop the Ollama service.
    $ sudo systemctl stop ollama
  6. Disable Ollama's automatic startup.
    $ sudo systemctl disable ollama
  7. Confirm that Ollama is stopped.
    $ systemctl is-active ollama
    inactive

    inactive returns exit status 3. An active service is not ready for file removal.

  8. Confirm that automatic startup is disabled.
    $ systemctl is-enabled ollama
    disabled

    disabled returns a nonzero exit status.

  9. Remove the confirmed systemd unit file.
    $ sudo rm -f /etc/systemd/system/ollama.service
  10. Remove the Ollama service's drop-in directory.
    $ sudo rm -rf /etc/systemd/system/ollama.service.d

    This removes service-specific overrides such as custom environment settings.

  11. Reload systemd's unit definitions.
    $ sudo systemctl daemon-reload
  12. Delete Ollama's libraries from the confirmed installation prefix.
    $ sudo rm -rf /usr/lib/ollama
  13. Delete the confirmed Ollama binary.
    $ sudo rm -f /usr/bin/ollama
  14. Delete the default service home when its contents are no longer needed.

    This permanently removes the service's live models and identity keys. A backup kept outside this directory remains intact.

    $ sudo rm -rf /usr/share/ollama
  15. Remove the Ollama service account.
    $ sudo userdel ollama
  16. Remove the remaining Ollama group.
    $ sudo groupdel ollama

    If account removal already deleted its private group, groupdel reports that the group does not exist.

  17. Check that the installed files and default data directory are absent.
    $ ls -ld /usr/bin/ollama /usr/lib/ollama /usr/share/ollama /etc/systemd/system/ollama.service /etc/systemd/system/ollama.service.d
    ls: cannot access '/usr/bin/ollama': No such file or directory
    ls: cannot access '/usr/lib/ollama': No such file or directory
    ls: cannot access '/usr/share/ollama': No such file or directory
    ls: cannot access '/etc/systemd/system/ollama.service': No such file or directory
    ls: cannot access '/etc/systemd/system/ollama.service.d': No such file or directory

    Every named path should be missing. An unexpected existing path needs investigation before declaring removal complete.

  18. Confirm that systemd no longer knows the Ollama service.
    $ systemctl status ollama --no-pager
    Unit ollama.service could not be found.
  19. Confirm that the Ollama account is absent.
    $ id ollama
    id: 'ollama': no such user
  20. Confirm that the Ollama group is absent.
    $ getent group ollama

    No output and exit status 2 mean that the group is absent.

  21. Check that the local Ollama API no longer answers.
    $ curl -fsS http://127.0.0.1:11434/api/version

    A connection failure with curl exit status 7 is expected. A JSON response means a server is still listening, even if the service and files above are gone.

Share this guide