M4 Mac mini深入探索之本地大语言模型,并以服务方式部署Ollama到MacOS
视频地址:
https://youtu.be/YsxkXePijtQ
1. 安装ollama客户端
官方下载地址
https://ollama.com/download
2.创建并编辑配置文件
nano ~/Library/LaunchAgents/com.user.ollama.service.plist
3.配置文件中写入下面内容
定义了服务方式运行,以及做了跨域设置。使得内网其他的网络访问被允许
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.user.ollama.service</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/ollama</string>
<string>serve</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/ollama.err</string>
<key>StandardOutPath</key>
<string>/tmp/ollama.out</string>
<key>EnvironmentVariables</key>
<dict>
<key>OLLAMA_HOST</key>
<string>0.0.0.0</string>
<key>Ollama_ORIGINS</key>
<string>*</string>
</dict>
</dict>
</plist>
4.赋予权限,启动服务
chmod 644 ~/Library/LaunchAgents/com.user.ollama.service.plist
launchctl load ~/Library/LaunchAgents/com.user.ollama.service.plist
请问配置文件ctrl+x后yes退出后,仍在编辑配置文件窗口中,是打开新的终端输入最后两行吗?我的这个总不成功,最后的提示是no such file or directory,不知道咋回事