ollama 配置

下载 安装

1
curl -fsSL https://ollama.com/install.sh | sh

更换模型目录

在启动 ollama serve 之前, 在.bashrc 中加入

1
export OLLAMA_MODELS= < path to your models>

如果ollama 已经启动过,则寻找ollama.service 文件去更改

1
systemctl edit ollama.service

启动之后,使用模型

1
2
ollama run <modelname> #automatically pull if the model didn't exist
ollama pull <modelname>
1
ollama sever #启动服务器

linux 上可以使用

1
2

systemctl status ollama.service # 去查看当前状态

添加

1
2
3
Environment="HOST=0.0.0.0>"
Environment="OLLAMA_MODELS=< path to your models>"

修改完之后重载一下

1
2
systemctl daemon-reload
systemctl restart ollama

确认端口可使用

1
sudo ss -tulpn | gerp 11434

或者

1
lsof -i:11434