Mac OSでOllama server (6)一周まわって公式版のollamaに挑戦デーモン化
Mac OSでOllama server (5)一周まわって公式版のollamaに挑戦でユーザー管理化では起動できるようになった。ただ、ユーザーがログインしないと使えないので、これをデーモン化する。
ユーザーログインしている状態でSSHから
launchctl unload -w ~/Library/LaunchAgents/com.ollama.server.plist
mv launchctl unload -w ~/Library/LaunchAgents/com.ollama.server.plist launchctl unload -w ~/Library/LaunchAgents/com.ollama.server.plist.old
でファイル名も変えておく。
/Library/LaunchAgents/com.ollama.server.plist を新しく作る。内容は
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://apple.com">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.ollama.server</string>
<key>UserName</key>
<string>ollamauser</string>
<key>GroupName</key>
<string>staff</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Ollama.app/Contents/Resources/ollama</string>
<string>serve</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>OLLAMA_HOST</key>
<string>0.0.0.0:11434</string>
<key>OLLAMA_MODELS</key>
<string>/Users/ollamauser/.ollama/models</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/ollama.stdout.log</string>
<key>StandardErrorPath</key>
<string>/tmp/ollama.stderr.log</string>
</dict>
</plist>
保存
所有権をrootに変更
sudo chown root:wheel /Library/LaunchDaemons/com.ollama.server.plist
sudo launchctl load -w /Library/LaunchDaemons/com.ollama.server.plist
で起動時に起動
コメント
コメントを投稿