Files
hwd32 58fdb03c30 docs: 初始装机指南
包含 6 章步骤 + 排错手册:
- 01 硬件与基础检查
- 02 Windows 装 Studio 驱动
- 03 WSL2 + CUDA 12.8
- 04 Ollama 装 LLM
- 05 PyTorch 验证(待补,依赖实机跑通)
- 06 ComfyUI 装出图(待补,依赖实机跑通)
- 90 排错手册
2026-06-14 12:08:38 +08:00

129 lines
2.8 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.
# 04 Ollama 装 LLM
## 目标
装 Ollama + 拉 qwen2.5:7b 模型 + 跑通对话。
## Ollama 装
### 1. 让 Ollama 把模型存 D 盘
**WSL2 Ubuntu 终端**
```bash
echo 'export OLLAMA_MODELS=/mnt/d/ollama_models' >> ~/.bashrc
source ~/.bashrc
```
### 2. 装 zstd(解压用)
```bash
sudo apt install -y zstd
```
### 3. 装 Ollama
**WSL2 网络访问国外源(GitHub)通常不通**,所以不要用官方一键脚本。直接下二进制:
**Windows 浏览器**打开下载链接:
- https://github.com/ollama/ollama/releases/latest
-`ollama-linux-amd64.tar.zst`(约 1.3 GB
- 右键 → 另存为 → `D:\ollama-linux-amd64.tar.zst`
**WSL2 终端解压**
```bash
sudo tar -C /usr --use-compress-program=unzstd -xf /mnt/d/ollama-linux-amd64.tar.zst
ollama --version
```
**应当看到** `ollama version 0.x.x`GitHub 上的最新版)。
**如果 unzstd 报错**,用备用方法:
```bash
unzstd -k /mnt/d/ollama-linux-amd64.tar.zst -o /tmp/ollama-linux-amd64.tar
ls -lh /tmp/ollama-linux-amd64.tar
sudo tar -C /usr -xf /tmp/ollama-linux-amd64.tar
ollama --version
```
### 4. 启服务
```bash
ollama serve &
```
看到 `Listening on 127.0.0.1:11434` 后按回车。
## 拉模型
### 推荐 16G 显存能跑得动的
| 模型 | 大小 | 用途 |
|------|------|------|
| `qwen2.5:7b` | 4.5G | 中文对话主力(最舒服)|
| `qwen2.5:14b` | 9G | 强一点的中文 |
| `deepseek-r1:14b` | 9G | 推理/代码强 |
| `qwen2.5-coder:14b` | 9G | 写代码辅助 |
**D 盘预留 50G** 给模型(3-4 个模型)。
### 拉第一个
```bash
ollama pull qwen2.5:7b
```
**等 3-10 分钟**(看网络速度,4.5G)。
### 测试
```bash
ollama run qwen2.5:7b "用一句话介绍你自己"
```
**应当看到中文回复**。输入 `/bye` 退出。
## 常用命令
```bash
# 列出已下载的模型
ollama list
# 启服务(开机后或重启后)
ollama serve &
# 进入对话
ollama run qwen2.5:7b
# 停止某个模型(释放显存)
ollama stop qwen2.5:7b
# 删除模型
ollama rm qwen2.5:7b
# 通过 API 调用(端口 11434
curl http://localhost:11434/api/generate -d '{"model":"qwen2.5:7b","prompt":"你好","stream":false}'
```
## 调出 GUI(可选)
### LM Studio(图形界面)
**WSL2 终端**
```bash
cd ~/
wget https://releases.lmstudio.ai/linux/x86/0.3.10/LM-Studio-0.3.10-x64.AppImage -O lmstudio.AppImage
chmod +x lmstudio.AppImage
./lmstudio.AppImage
```
## 显存占用参考
| 模型 | 显存 | 速度(7b 量级) |
|------|------|------|
| 7b Q4_K | ~5G | 10-20 tokens/s |
| 14b Q4_K | ~10G | 6-12 tokens/s |
| 32b Q4_K | ~20G | 2-4 tokens/s**16G 跑不了**|
**16G 显存上限**14b Q4_K 量化的 32B 模型(勉强能跑但慢),再大就跑不动了。
## 下一步
✅ 通过后 → [05 PyTorch 验证](./05-pytorch-verify.md)