Setting the OLLAMA_HOST Environment Variable in Windows
The Unix/Linux command export OLLAMA_HOST=https://192.168.1.13:11434 sets an environment variable that would be available to all processes launched from that shell. In Windows, there are several equivalent methods to achieve this, depending on whether you want the variable to be temporary (session-only) or persistent.
Command Prompt (CMD) Methods
Temporary (Session-Only) Variable
To set OLLAMA_HOST for the current CMD session only:
set OLLAMA_HOST=https://192.168.1.13:11434
This sets the variable only for the current command prompt window. When you close this window, the variable will be lost[1][2]. You can verify it was set by typing:
echo %OLLAMA_HOST%
Persistent Variable
To make the variable persistent (available after restarts and in new sessions), use the setx command:
setx OLLAMA_HOST "https://192.168.1.13:11434"
This sets the variable at the user level. To set it system-wide (equivalent to adding to /etc/environment in Linux), use:
setx OLLAMA_HOST "https://192.168.1.13:11434" /M
The /M flag requires administrator privileges[2][6]. Changes made with setx won't be visible in the current session - you'll need to open a new command prompt window to see them[2][4].
PowerShell Methods
Temporary (Session-Only) Variable
In PowerShell, set the variable for the current session with:
$Env:OLLAMA_HOST = "https://192.168.1.13:11434"
Verify it with:
echo $Env:OLLAMA_HOST
Persistent Variable
To set a persistent user-level environment variable in PowerShell:
[Environment]::SetEnvironmentVariable("OLLAMA_HOST", "https://192.168.1.13:11434", "User")
For a system-wide variable (requires administrator privileges):
[Environment]::SetEnvironmentVariable("OLLAMA_HOST", "https://192.168.1.13:11434", "Machine")
These changes won't affect the current PowerShell session - you'll need to start a new session for them to take effect[6][7].
Using the Windows GUI
For a more visual approach:
- Press Win + R, type
sysdm.cpl and press Enter