251 字
1 分钟
Debian部署QwQ大模型(Ollama)
Ollama安装
先装个Ollama
curl -fsSL https://ollama.com/install.sh | sh还是先下载下来吧
cd /optproxychains curl -fsSL https://ollama.com/install.sh -o ollama_install.sh#这里一定要加sudo,不然useradd会未找到#这里需要代理,因为下载Linux bundle太慢了sudo proxychains bash ollama_install.sh坐等
提示出
>>> The Ollama API is now available at 127.0.0.1:11434.>>> Install complete. Run "ollama" from the command line.就ok了
注意,下面几个连续操作都是改变ollama.service,你可以一次配完
开放一下api
nano /etc/systemd/system/ollama.service#在[Service]里面加Environment="OLLAMA_HOST=0.0.0.0"Environment="OLLAMA_ORIGINS=*"#重启一下服务systemctl daemon-reloadsystemctl restart ollamasystemctl status ollama修改模型路径
chown -R ollama:ollama /mnt/modelchmod -R 775 /mnt/model
#在[Service]里面加Environment="OLLAMA_MODELS=/mnt/model"添加一下代理
#在[Service]里面加Environment="https_proxy=192.168.40.1:7890"保持加载
#在[Service]里面加Environment="OLLAMA_KEEP_ALIVE=-1"上面的方法保持效果不好,用下面的
nano /etc/systemd/system/ollama-run.service[Unit]Description=Ollama Run ServiceAfter=network.target
[Service]ExecStart=/usr/local/bin/ollama run qwqRestart=alwaysUser=rootWorkingDirectory=/rootEnvironment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
[Install]WantedBy=multi-user.target
systemctl daemon-reloadsystemctl enable --now ollama-run安装模型
ollama pull qwq:32bcurl http://localhost:11434/api/generate -d '{"model": "qwq", "keep_alive": -1}'ok,pull下来的话就可以使用了
调整layer
#在[Service]里面加Environment="OLLAMA_GPU_LAYER=cuda"Environment="CUDA_VISIBLE_DEVICES=GPU-6b53d422-019c-11f0-b3ec-82c4d041ae01" Debian部署QwQ大模型(Ollama)
https://iiii.fun/posts/linux/debian-ollama-qwq/