Linux 安装 Ollama

1、下载地址 Download Ollama on Linux

2、有网络直接执行 curl -fsSL https://ollama.com/install.sh | sh 命令

3、下载慢的解决方法

bash 复制代码
1、curl -fsSL https://ollama.com/install.sh -o ollama_install.sh
2、sed -i 's|https://ollama.com/download/ollama-linux|https://gh.llkk.cc/https://github.com/ollama/ollama/releases/download/v0.5.7/ollama-linux|g' ollama_install.sh
3、chmod +x ollama_install.sh
4、sh ollama_install.sh

4、修改端口和模型路径

bash 复制代码
 vim /etc/systemd/system/ollama.service

这个是增加的变量

"OLLAMA_MODELS=/mnt/ollama/models" "OLLAMA_HOST=0.0.0.0:1001

bash 复制代码
[Unit]
Description=Ollama Service
After=network-online.target

[Service]
ExecStart=/usr/local/bin/ollama serve
User=ollama
Group=ollama
Restart=always
RestartSec=3
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/dat/java/jdk1.8.0_271/bin:/dat/java/jdk1.8.0_271/jre/bin:/root/bin" "OLLAMA_MODELS=/mnt/ollama/models" "OLLAMA_HOST=0.0.0.0:1001"

[Install]
WantedBy=default.target

文件夹赋权限

bash 复制代码
1、 chomd 775 -R /mnt/ollama/models/
2、 chown ollama.ollama -R /mnt/ollama/models

保存之后执行,重载和重启命令

bash 复制代码
1、sudo systemctl daemon-reload
2、sudo systemctl restart ollama

4、查看状态启动成功

5、运行模型一定要用这个... 指定端口,因为改了端口。客户端找不到默认了,就会提示

could not connect to ollama app, is it running?(坑了好长一会...)

bash 复制代码
OLLAMA_HOST=127.0.0.1:1001 ollama list
 
OLLAMA_HOST=127.0.0.1:44311 ollama ps
 
OLLAMA_HOST=127.0.0.1:44311 ollama run deepseek-r1:7b

6、感谢Ubuntu 24.04上报:Error: could not connect to ollama app, is it running?的解决方法-CSDN博客

Ubuntn下载Ollama慢或卡顿解决方案_ollama下载慢怎么办-CSDN博客

相关推荐
Johny_Zhao1 天前
OpenClaw安装部署教程
linux·人工智能·ai·云计算·系统运维·openclaw
chlk1232 天前
Linux文件权限完全图解:读懂 ls -l 和 chmod 755 背后的秘密
linux·操作系统
舒一笑2 天前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 天前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号3 天前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash3 天前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
曲幽3 天前
FastAPI实战:打造本地文生图接口,ollama+diffusers让AI绘画更听话
python·fastapi·web·cors·diffusers·lcm·ollama·dreamshaper8·txt2img
哈基咪怎么可能是AI3 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行4 天前
Linux和window共享文件夹
linux
曲幽4 天前
我用FastAPI接ollama大模型,差点被asyncio整崩溃(附对话窗口实战)
python·fastapi·web·async·httpx·asyncio·ollama