Environment Configuration in Ollama

From the Ollama cheat sheet · Installation & Setup · verified Jul 2026

Environment Configuration

Configure Ollama behavior with environment variables.

bash
# Common environment variables
export OLLAMA_HOST=0.0.0.0:11434    # Listen on all interfaces
export OLLAMA_MODELS=/path/to/models # Custom model storage path
export OLLAMA_KEEP_ALIVE=5m          # How long to keep models loaded
💡 Ollama runs as a system service automatically — no need to manually start it
⚡ Set OLLAMA_HOST=0.0.0.0 to expose the API on your local network
📌 OLLAMA_KEEP_ALIVE controls how long models stay loaded in memory (default 5m)
🟢 Use OLLAMA_MODELS to store models on a different drive if disk space is limited
serverconfig

More Ollama tasks

Back to the full Ollama cheat sheet