Amazon Cyber Monday deals See deals →ad

Mets Minor League Blog

Music theory, instruments and musicians

Mets Minor League Blog

Music theory, instruments and musicians

Uninstall Ollama on Linux: Remove the App and Models

To uninstall Ollama on Linux, stop its service, remove the Ollama program using the method you installed it with, and delete its model files if you no longer need them. The exact steps depend on whether you used Ollama’s install script, a package manager, or a manual installation; removing the program alone may leave downloaded models and configuration behind.

Before You Uninstall Ollama

Ollama can run as a background service and store large language models separately from its executable. Removing one does not necessarily remove the other. Before proceeding, decide whether you want to keep your models, and check whether another user or application on the machine depends on the Ollama service.

  • Keep models: Remove the application and service, but leave Ollama’s model-storage directory intact. You may be able to use the files again after reinstalling.
  • Remove everything: Delete the application, service setup, model files, and any remaining Ollama user or system data you have identified.
  • Check storage locations: Ollama commonly stores data under /usr/share/ollama for a system installation or ~/.ollama for a user installation. A custom OLLAMA_MODELS setting can point elsewhere.

Model files can occupy many gigabytes. Use du to check a directory’s size before deleting it, and do not remove a shared data directory if other users need it.

Uninstall an Install-Script Installation

Ollama’s Linux installation script may install files under /usr/local, create an ollama system user and group, and register a systemd service. The precise files can vary by version and installation history, so inspect the service and its configuration before removing anything.

  1. Stop and disable the service: sudo systemctl stop ollama, then sudo systemctl disable ollama.
  2. Inspect its unit file with systemctl cat ollama. If it exists, remove the unit file shown there only if it belongs to Ollama and you intend to remove the service setup.
  3. Remove the Ollama executable after confirming its location. For example, command -v ollama may show /usr/local/bin/ollama; remove that specific file with sudo rm.
  4. Run sudo systemctl daemon-reload after removing a systemd unit, then check with systemctl status ollama.

Do not blindly paste a broad cleanup command from an unofficial guide. Paths may differ, and a command that recursively deletes a directory can erase models or unrelated files. If the install script created an ollama account, check whether anything else uses it before deleting the account; deleting a user is not required just to remove the application.

Uninstall a Package-Managed Installation

If you installed Ollama through a Linux distribution’s package manager or a third-party repository, use that same manager to remove it. Package removal can clean up tracked program files more reliably than manually deleting them. First identify the package and manager you used; commands differ across distributions.

  • Debian or Ubuntu: Check with dpkg -l | grep -i ollama. If it is an installed APT package, remove it with sudo apt remove ollama. Use sudo apt purge ollama only if you also want to remove package-managed configuration files.
  • Fedora or another DNF system: Check with rpm -q ollama, then, if that is the correct package, run sudo dnf remove ollama.
  • Arch Linux: Check with pacman -Q ollama; remove the matching package with sudo pacman -R ollama. Review any prompt about dependencies before confirming.

These examples apply only when the package is actually installed under that name. A package manager generally does not delete model files stored outside its managed package directories, so check separately if reclaiming disk space is your goal.

Remove Models and Leftover Data

Ollama’s model directory can be the largest part of an installation. Find the configured location before removing it. The OLLAMA_MODELS environment variable can override the default, and the setting may be defined in the systemd service, a systemd environment file, or a user shell configuration.

To inspect a running system service’s definition, use systemctl cat ollama and look for an environment setting. To check common directories, use commands such as sudo du -sh /usr/share/ollama and du -sh ~/.ollama; a missing directory is normal if that location was never used. Once you have confirmed the correct path and no longer need its contents, delete that directory deliberately. For example, sudo rm -rf /usr/share/ollama permanently removes that path and everything inside it, so verify the path before pressing Enter.

Ollama may also leave a systemd unit, an environment file, or a dedicated service account. Check the unit’s actual location and any referenced configuration before cleanup. Do not remove files just because their names contain “ollama” if you cannot establish that they belong to this installation.

Verify the Removal

After uninstalling, confirm that the command, service, and data are gone only to the extent you intended:

  • Run command -v ollama. No output usually means the executable is no longer on your shell’s PATH.
  • Run systemctl status ollama. A missing unit indicates systemd no longer recognizes it; an inactive service alone does not prove that its unit or files were removed.
  • Check the model directory or custom model path with du or ls if you intended to delete the data.
  • Open a new terminal if an old shell still remembers a command location, and check shell startup files for an Ollama-specific PATH or environment setting if needed.

If the service still appears, inspect its reported unit-file path rather than repeatedly stopping it. You may have removed the executable but left the service definition, or another installation method may have registered it.

Common Problems and Safety Notes

“Unit ollama.service not found” is not necessarily an error: the service may never have been installed, or it may already have been removed. “Command not found” after uninstalling is also expected. If Ollama returns after reboot, look for another unit, container, or package-managed installation instead of deleting arbitrary files.

Take care with elevated commands such as sudo rm -rf. They bypass normal permission protections and do not move deleted files to a desktop trash folder. Avoid wildcard paths, confirm every directory, and back up any model or configuration you might want later. If you installed Ollama inside Docker, a virtual machine, or a development environment, remove it from that environment; host-level commands will not necessarily remove its contents.

Frequently Asked Questions

Does uninstalling Ollama delete downloaded models?
Not reliably. Package removal may leave model data, and script-based installations can store it separately from the executable. Delete the confirmed model directory yourself if you want to reclaim that space.

Where are Ollama models stored on Linux?
Common locations are /usr/share/ollama for a system installation and ~/.ollama for a user installation. The OLLAMA_MODELS environment variable can set a different path, so verify the configuration before deleting files.

Can I uninstall Ollama without sudo?
Sometimes. A user-level installation and files in your home directory may be removable without administrative privileges. Stopping a system service or deleting files owned by root generally requires an administrator.

Why does the ollama command still work after uninstalling?
There may be another copy earlier in your PATH, or your shell may be using a cached command location. Check command -v ollama, inspect the reported path, and open a new terminal. Remove only the copy you have identified.

Will I lose my models if I reinstall Ollama?
Not if you preserve the model directory and reinstall with access to the same storage path. If you deleted the directory, you will need to download the models again.

Uninstall Ollama on Linux: Remove the App and Models
Scroll to top