Change Models Path on Ubuntu for Ollama

Change Models Path on Ubuntu for Ollama

Raymond Tang Raymond Tang 0 2016 6.17 index 8/6/2024

On Ubuntu, Ollama saves models by default to /usr/share/ollama/.ollama/models. This article shows you how to change the default path to a different location.

Steps

  1. Create ollama service config override file:

    sudo mkdir -p /etc/systemd/system/ollama.service.d; sudo nano /etc/systemd/system/ollama.service.d/override.conf
    
  2. Added configurations: *Replace path, user and group accordingly. 

    [Service]
    Environment="OLLAMA_MODELS=/path/to/ollama-models"
    User=raymond
    Group=raymond
    

    20240806132523-image.png

  3. Save the file.

  4. Restart services:

    sudo systemctl daemon-reload
    sudo systemctl restart ollama
    
  5. Check ollama service status:

    sudo systemctl status ollama
    

    You should be able see something like the following screenshot: 20240806132920-image.png

linux llm ubuntu

Join the Discussion

View or add your thoughts below

Comments