ollama如何修改服务端口号

修改ollama配置使其可以监听0.0.0.0和修改端口,可以外网访问
ollama如何修改服务端口号_第1张图片

1.修改文件
vim /etc/systemd/system/ollama.service

2.增加
[Service]
Environment=“OLLAMA_HOST=0.0.0.0:11434”

3.重现加载
sudo systemctl daemon-reload
sudo systemctl restart ollama
sudo systemctl status ollama

4.查看日志
journalctl -u ollama.service

5.open-api
这样可以通过外网访问

curl http://192.168.31.11:11434/api/chat -d '{

“model”: “qwen:0.5b-chat-v1.5-q4_K_M”,

“messages”: [

{ "role": "user", "content": "介绍一下北京景点?" }

],

“stream”: false

}’

6.修改端口后,访问指令方式
把Ollama的默认端口修改后,如果再运行:
ollama ps

你可能感兴趣的:(运维开发)