Stop the Ollama Service

First things first, we need to stop the Ollama service from running. This ensures a smooth uninstallation process. Open your terminal and enter the following command:

1
sudo systemctl stop ollama

This command halts the Ollama service.

Disable the Ollama Service

Now that the service is stopped, we need to disable it so that it doesn’t start up again upon system reboot. Enter the following command:

1
sudo systemctl disable ollama

This ensures that Ollama won’t automatically start up in the future.

Remove the Service File

We need to tidy up by removing the service file associated with Ollama. Enter the following command:

1
sudo rm /etc/systemd/system/ollama.service

This deletes the service file from your system.

Delete the Ollama Binary

Next up, we’ll remove the Ollama binary itself. Enter the following command:

1
sudo rm $(which ollama)

This command removes the binary from your bin directory.

Remove Downloaded Models and Ollama User

Lastly, we’ll clean up any remaining bits and pieces. Enter the following commands one by one:

1
2
sudo rm -r /usr/share/ollama 
sudo userdel ollama sudo groupdel ollama

These commands delete any downloaded models and remove the Ollama user and group from your system.

And that’s it! You’ve successfully uninstalled Ollama from your system. If you ever decide to reinstall it in the future, just follow the installation steps again. If you have any questions or run into any issues, feel free to reach out. Happy computing!