Ubuntu下修改Ollama的模型存储路径

Linux系统的默认存储路径是/usr/share/ollama/.ollama/models

我想在Ubuntu下修改到/mnt/ollama-models

做法如下:

  1. 创建ollama服务的配置的覆盖文件

    sudo mkdir -p /etc/systemd/system/ollama.service.d
    sudo vim /etc/systemd/system/ollama.service.d/override.conf
    
  2. 在override.conf文件里面写入:

    [Service]
    Environment="OLLAMA_MODELS=/mnt/ollama-models"
    User=你的用户名
    Group=你的用户组
    
  3. 重启ollama服务

    sudo systemctl daemon-reload
    sudo systemctl restart ollama
    
  4. 检查是否成功

    sudo systemctl status ollama
    # 或者
    ollama list
    

参考:

  • https://github.com/ollama/ollama/blob/main/docs/faq.md#where-are-models-stored
  • https://kontext.tech/article/1381/change-models-path-on-ubuntu-for-ollama

你可能感兴趣的:(ubuntu,ollama)