0 {{postValue.vote_count}}

How to run Ollama in Public Interface

Since Ollama is Running the Loopback Interface 127.0.0.1 with port 11434. This cause Ollama APIs unable to access outside the server.
How to run Ollama on any other Interfaces

Solution:

Open Ollama Service File

vim /etc/systemd/system/ollama.service

Add the Following Environment variable on service file

Environment="OLLAMA_HOST=192.168.11.25:11434"
Environment="OLLAMA_ORIGINS=*"

The Below daemon Service file will run ollama on 192.168.11.25 interface ip with port 11434

[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="OLLAMA_HOST=192.168.11.25:11434"
Environment="OLLAMA_ORIGINS=*"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"

[Install]
WantedBy=default.target

Since Ollama Service is Running on 192.168.11.25 interface so cli interface is not available, if you run any models you may face the following error

root@localhost:/home/globalt# ollama run llama3
Error: could not connect to ollama app, is it running?

To use Ollama in cli interface you can create a another daemon service without Environment variable or Environment="OLLAMAHOST=127.0.0.1:11434"

{{forumCtrl.question_commentErr}}

Your Answer
{{forumCtrl.responseErr}}