Merge a384a5bd24b608606219ad2baf35c23088c6f03f into d7eb05b9361febead29a74e71ddffc2ebeff5302

This commit is contained in:
Yuri Khrustalev 2024-11-14 13:56:28 +08:00 committed by GitHub
commit fabca2f9a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 11 deletions

View File

@ -73,23 +73,17 @@ If Ollama is run as a macOS application, environment variables should be set usi
### Setting environment variables on Linux
If Ollama is run as a systemd service, environment variables should be set using `systemctl`:
If Ollama is run as a systemd service, environment variables should be set via the file specified in the `EnvironmentFile` option of the systemd unit:
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]`:
1. Edit the file `/etc/ollama/serve.conf`:
```ini
[Service]
Environment="OLLAMA_HOST=0.0.0.0"
OLLAMA_HOST=0.0.0.0
```
3. Save and exit.
4. Reload `systemd` and restart Ollama:
2. Restart Ollama:
```bash
systemctl daemon-reload
systemctl restart ollama
```

View File

@ -129,7 +129,7 @@ sudo tar -C /usr -xzf ollama-linux-amd64.tgz
## Installing specific versions
Use `OLLAMA_VERSION` environment variable with the install script to install a specific version of Ollama, including pre-releases. You can find the version numbers in the [releases page](https://github.com/ollama/ollama/releases).
Use `OLLAMA_VERSION` environment variable with the install script to install a specific version of Ollama, including pre-releases. You can find the version numbers in the [releases page](https://github.com/ollama/ollama/releases).
For example:
@ -168,3 +168,8 @@ sudo rm -r /usr/share/ollama
sudo userdel ollama
sudo groupdel ollama
```
Remove the config
```bash
sudo rm -rf /etc/ollama
```

View File

@ -119,6 +119,18 @@ configure_systemd() {
status "Adding current user to ollama group..."
$SUDO usermod -a -G ollama $(whoami)
if $SUDO test -f "/etc/ollama/serve.conf" ; then
status "Skip creating ollama serve config file..."
else
status "Creating ollama serve config file..."
$SUDO mkdir -p /etc/ollama/
cat <<EOF | $SUDO tee /etc/ollama/serve.conf >/dev/null
# The list of supported env variables could be found by running: ollama serve --help
#OLLAMA_DEBUG=1
#OLLAMA_HOST=0.0.0.0:11434
EOF
fi
status "Creating ollama systemd service..."
cat <<EOF | $SUDO tee /etc/systemd/system/ollama.service >/dev/null
[Unit]
@ -132,6 +144,7 @@ Group=ollama
Restart=always
RestartSec=3
Environment="PATH=$PATH"
EnvironmentFile=/etc/ollama/serve.conf
[Install]
WantedBy=default.target