ollama修改模型的目录 - xd21303/Notebook GitHub Wiki

Where are models stored?

  • macOS: ~/.ollama/models
  • Linux: /usr/share/ollama/.ollama/models
  • Windows: C:\Users\%username%\.ollama\models

How do I set them to a different location?

If a different directory needs to be used, set the environment variable OLLAMA_MODELS to the chosen directory.

Note: on Linux using the standard installer, the ollama user needs read and write access to the specified directory. To assign the directory to the ollama user run sudo chown -R ollama:ollama <directory>.

Refer to the section above for how to set environment variables on your platform.

Setting environment variables on Linux

If Ollama is run as a systemd service, environment variables should be set using systemctl:

  1. Edit the systemd service by calling systemctl edit ollama.service. This will open an editor.

  2. For each environment variable, add a line Environment under section [Service]:

    [Service]
    Environment="OLLAMA_HOST=0.0.0.0:11434"
  3. Save and exit.

  4. Reload systemd and restart Ollama:

    systemctl daemon-reload
    systemctl restart ollama

参考https://github.com/ollama/ollama/blob/main/docs/faq.md#how-do-i-configure-ollama-server

⚠️ **GitHub.com Fallback** ⚠️