[PR #490] [CLOSED] Add OLLAMA_HOME environment variable support. #20721

Closed
opened 2026-04-19 15:13:04 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/490
Author: @akhilcacharya
Created: 9/7/2023
Status: Closed

Base: mainHead: main


📝 Commits (1)

  • 803fe2c Add OLLAMA_HOME environment variable support.

📊 Changes

6 files changed (+42 additions, -9 deletions)

View changed files

📝 cmd/cmd.go (+4 -3)
📝 docs/faq.md (+7 -1)
📝 server/auth.go (+2 -1)
📝 server/images.go (+2 -1)
📝 server/modelpath.go (+5 -3)
util/util.go (+22 -0)

📄 Description

Problem

I'd like to run Ollama on my Linux server, but I have a small home directory disk. As a result, rather than changing the home directory to my mass storage pool, I propose adding the environment variable OLLAMA_HOME to set the top-level filepath for Ollama.

Change

Switch out os.UserHomeDir with a wrapper in a new util package.

util.UserHomeDir attempts to fetch the OLLAMA_HOME environment variable, and falls back otherwise.

Add documentation under faq.md.

Tests

Tested manually. I'd be happy to add automated tests for this if existing infrastructure exists.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/490 **Author:** [@akhilcacharya](https://github.com/akhilcacharya) **Created:** 9/7/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`803fe2c`](https://github.com/ollama/ollama/commit/803fe2cdf14d312bee11c905fbb9d213c1c4db6a) Add OLLAMA_HOME environment variable support. ### 📊 Changes **6 files changed** (+42 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `cmd/cmd.go` (+4 -3) 📝 `docs/faq.md` (+7 -1) 📝 `server/auth.go` (+2 -1) 📝 `server/images.go` (+2 -1) 📝 `server/modelpath.go` (+5 -3) ➕ `util/util.go` (+22 -0) </details> ### 📄 Description ## Problem I'd like to run Ollama on my Linux server, but I have a small home directory disk. As a result, rather than changing the home directory to my mass storage pool, I propose adding the environment variable ```OLLAMA_HOME``` to set the top-level filepath for Ollama. ## Change Switch out os.UserHomeDir with a wrapper in a new `util` package. `util.UserHomeDir` attempts to fetch the OLLAMA_HOME environment variable, and falls back otherwise. Add documentation under `faq.md`. ## Tests Tested manually. I'd be happy to add automated tests for this if existing infrastructure exists. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 15:13:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#20721