Did You Know? Ollama has been downloaded more than 5 million times from Docker Hub. That’s huge!
Today, Ollama is the easiest way to get up and running with large language models(a.k.a LLMs). With Ollama, users can download, run, and manage various pre-trained language models, and the tool provides an interface for querying and interacting with these models. It is often used by developers who want to experiment with LLMs without managing the complexities of cloud deployment or large-scale infrastructure.
$ docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
So, you’ve been using Ollama but now it’s time to bid it farewell. Whether you’ve found another tool that better suits your needs or simply no longer requires its services, uninstalling Ollama is a breeze. Let’s walk through the process step by step:
Stopping the Ollama container
docker stop ollama
Stop the Ollama Service
If you’re running the Ollama server locally(with no container running), follow the below steps:
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:
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:
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:
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:
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:
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!
Further Reading
- How to Run Open Source LLMs Locally with Ollama and Docker — Llama3.1, Phi3, Mistral, Gemma2
- How to setup Ollama with Open WebUI using Docker Compose
- Running Ollama with NVIDIA GPU Acceleration: A Docker Compose Guide
- Running Ollama and Open WebUI in a Kubernetes Cluster
- Ollama vs vLLM: Choosing the Best Tool for AI Model Workflows
- How to Install and Run Ollama with Docker: A Beginner’s Guide
- Running Llama 3 Locally with Ollama and Ollama WebUI