--- title: "在 Ubuntu 安装 Ollama 并运行 Qwen2.5‑Coder 7B" type: source tags: [ollama, qwen, qwen-coder, ubuntu, 本地大模型] date: 2025-09-15 --- ## Source File - [[raw/Home Office/在 Ubuntu 安装 Ollama 并运行 Qwen2.5‑Coder 7B.md]] ## Summary - 核心主题:在 Ubuntu 上安装 Ollama 本地大模型运行平台,运行 Qwen2.5-Coder 7B 代码模型 - 问题域:本地 AI 推理基础设施 - 方法/机制:Ollama 提供 REST API 和 CLI,支持 Python/Node.js SDK,自动 GPU 加速 - 结论/价值:构建本地 AI coding agent 基础设施,qwen2.5-coder:7b 适合 DevOps/SQL/Kubernetes 场景 ## Key Claims - 安装命令:curl -fsSL https://ollama.com/install.sh | sh - qwen2.5-coder:7b 模型大小约 4.5GB,无需 GPU 即可运行 - Ollama API 默认监听 127.0.0.1:11434,修改 /etc/systemd/system/ollama.service 添加 OLLAMA_HOST=0.0.0.0 开放远程访问 - 有 CUDA 时 Ollama 自动使用 GPU 加速,无需额外配置 - qwen2.5-coder 相比普通 qwen2.5 的优势:Tool usage 能力强,Shell/Python/SQL 理解强 ## Key Quotes > "qwen2.5-coder:7b 相比普通 qwen2.5:7b 更适合工程任务" — 代码专用模型的选择依据 ## Key Concepts - [[Ollama]]:本地大模型运行平台 - [[Qwen2.5-Coder]]:阿里通义千问代码专用模型 - [[REST API]]:Ollama 提供的 HTTP 接口 - [[GPU 加速]]:CUDA 环境下自动启用 ## Key Entities - [[Ubuntu]]:宿主机操作系统 ## Connections - [[Ubuntu]] ← runs ← [[Ollama]] - [[Ollama]] ← hosts ← [[Qwen2.5-Coder]] - [[OpenClaw]] ← calls ← [[Ollama API]] ## Contradictions - 无