ollama_offline_tools/README.md
2025-03-27 16:47:00 +08:00

104 lines
2.2 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Ollama 离线部署工具
## 📌 使用流程(三步走)
### 1. 克隆仓库 & 下载镜像
```bash
git clone https://git.aiot.ml/kanshan/ollama_offline_tools.git
cd ollama_offline_tools
chmod +x *.sh # 添加执行权限
# 下载所需版本(任选其一)
./mirror_ollama.sh # 下载最新版
./mirror_ollama.sh v0.6.2 # 下载指定版本
./mirror_ollama.sh --all # 下载全部版本
```
### 2. 启动本地文件服务器
```bash
# 启动Python HTTP服务默认端口8000
python3 host_ollama.py
# 如需自定义端口
python3 host_ollama.py 8080
```
### 3. 手动修改安装脚本
编辑 `install.sh`,将:
```bash
"https://download.main.ml/0.6.2" # 原始地址
```
修改为你的本地地址:
```bash
"http://[你的IP]:8000" # 示例http://192.168.1.100:8000
```
### 4. 执行安装(在其他机器)
```bash
# 方法1直接运行修改后的install.sh
sudo ./install.sh
# 方法2通过HTTP服务安装
curl -sSL http://[你的IP]:8000/install.sh | sudo bash
```
---
## 📂 文件说明
| 文件 | 用途 |
|------|------|
| `mirror_ollama.sh` | 从GitHub下载Ollama发行版到`ollama_releases/`目录 |
| `host_ollama.py` | 启动本地HTTP服务器支持目录浏览 |
| `install.sh` | **需手动修改**的安装脚本 |
| `ollama_releases/` | 镜像文件存储目录 |
---
## 🌐 网络配置建议
1. 获取本机IP
```bash
ip a # Linux
ifconfig # macOS
```
2. 确保防火墙放行端口:
```bash
sudo ufw allow 8000/tcp # Ubuntu示例
```
3. 同一局域网内的其他设备可通过 `http://[你的IP]:8000` 访问
---
## 💡 注意事项
1. 首次使用需运行 `chmod +x *.sh` 添加执行权限
2. 确保Python版本 ≥ 3.6
3. 全量下载需要约 50GB 磁盘空间
4. 修改`install.sh`时保留文件名路径(如`/ollama-linux-amd64.tgz`
---
## 🚨 常见问题
**Q如何知道下载是否完成**
A检查 `ollama_releases/` 目录下的文件结构应类似:
```
ollama_releases/
├── v0.6.2/
│ ├── ollama-linux-amd64.tgz
│ └── checksums.txt
└── latest/
```
**QWindows机器如何访问**
A在浏览器输入 `http://[Linux机器的IP]:8000` 即可下载文件
---