Hermes Agent Windows 完整安装与本地模型配置教程(实战版)

71 阅读7分钟

Hermes Agent Windows 完整安装与本地模型配置教程(实战版)

别删我图片

作 者:吴佳浩

撰稿时间:2026-4-15

测试模型:Qwen3.5-35B-32K(Ollama 量化版,我比较懒就用这个你们自己随意)

测试环境:RTX 5090 + 96GB 内存 + Windows 11

我稍微说两句:

说实话这玩意最近圈子里挺火的,号称开源版 Claude Code比肩openclaw,Nous Research 出品,作为从业者不折腾一下说不过去。但这破玩意对 Windows 用户是真的不友好——官方文档明确写了原生 Windows 不支持,必须走 WSL2。所以这篇文章就是边装边踩坑边记录,全程实战,能帮你少走一个坑算一个。Mac 用户请绕道,你们一条命令就完事了。 (实际上就是看各个平台吹了好几天了,拔个草。。。)

别删我图片

Hermes Agent 是 Nous Research 开源的 AI Agent 框架,支持接入 Ollama 本地模型、OpenRouter、Anthropic 等,可实现文件操作、终端执行、浏览器控制、代码生成、任务委派等全场景自动化。简单来说就是终端里的 AI 助手,能帮你干活的那种。


目录

  1. 系统要求
  2. 整体流程概览
  3. Step 1:安装 WSL2 并迁移到非 C 盘
  4. Step 2:在 WSL2 中安装 Hermes Agent
  5. Step 3:安装 Ollama(Windows 端)
  6. Step 4:打通 WSL2 到 Windows Ollama 的网络
  7. Step 5:配置 Hermes 连接本地模型
  8. Step 6:修复上下文窗口限制(必做)
  9. Step 7:启动并使用
  10. 常用命令速查
  11. 常见问题 FAQ(实战踩坑)
  12. 模型推荐选型

1. 系统要求

项目最低要求推荐配置
操作系统Windows 10 64位(2004+)Windows 11
WSL2必须
内存8 GB RAM16 GB RAM+
显卡显存(GPU推理)8 GB VRAM(7B模型)16 GB+ VRAM
磁盘空间20 GB 可用50 GB+
网络安装时需联网

注意:Hermes Agent 官方不支持原生 Windows,WSL2 是唯一的路。别挣扎了,装吧。


2. 整体流程概览

flowchart TD
    A["Windows 环境"] --> B["安装 WSL2\n迁移到非 C 盘"]
    B --> C["WSL2 内安装 Hermes Agent\ncurl 一键脚本"]
    C --> D["Windows 端安装 Ollama\n下载目标模型"]
    D --> E["打通 WSL2 到 Windows 网络\nOLLAMA_HOST + 防火墙"]
    E --> F["配置 Hermes\n指向本地 Ollama"]
    F --> G["修复上下文窗口\n32K 覆盖为 65K"]
    G --> H["hermes chat\n开始使用"]

    style A fill:#1a1a2e,color:#fff
    style E fill:#c62828,color:#fff
    style G fill:#c62828,color:#fff
    style H fill:#00aa55,color:#fff

红色标注的两步是最大的坑,90% 的人卡在这里。别问我怎么知道的。


3. Step 1:安装 WSL2 并迁移到非 C 盘

3.1 安装 WSL2

管理员 PowerShell 执行:

wsl --install

默认安装 Ubuntu,重启后按提示设置用户名和密码。

3.2 迁移到非 C 盘(可选但建议)

WSL2 默认把虚拟磁盘放在 C 盘的 AppData 下,模型一拉一大堆,C 盘会爆。迁移到其他盘:

# 确认当前状态
wsl --list --verbose

# 创建目标目录(这里用 G 盘举例)
New-Item -ItemType Directory -Path "G:\WSL\Ubuntu" -Force

# 导出备份
wsl --export Ubuntu G:\WSL\ubuntu-backup.tar

# 注销原来的
wsl --unregister Ubuntu

# 重新导入到 G 盘
wsl --import Ubuntu G:\WSL\Ubuntu G:\WSL\ubuntu-backup.tar --version 2

实战踩坑:如果导出报错 系统找不到指定的文件,说明 ext4.vhdx 虚拟磁盘损坏了。这时直接注销重建:

wsl --unregister Ubuntu

# 下载 Ubuntu rootfs
Invoke-WebRequest -Uri "https://cloud-images.ubuntu.com/wsl/jammy/current/ubuntu-jammy-wsl-amd64-ubuntu22.04lts.rootfs.tar.gz" -OutFile "G:\WSL\ubuntu.tar.gz"

# 导入
wsl --import Ubuntu G:\WSL\Ubuntu G:\WSL\ubuntu.tar.gz --version 2

3.3 修复默认用户

导入后默认是 root,需要创建普通用户:

# 进入 WSL
wsl -d Ubuntu

# 创建用户(替换 alben 为你的用户名)
useradd -m -s /bin/bash alben
passwd alben
usermod -aG sudo alben

# 设置默认用户
echo -e '[user]\ndefault=alben' > /etc/wsl.conf
exit

回到 PowerShell 重启 WSL:

wsl --terminate Ubuntu
wsl -d Ubuntu
# 这次应该以普通用户登录了

4. Step 2:在 WSL2 中安装 Hermes Agent

4.1 更新系统依赖

sudo apt update && sudo apt install -y ripgrep ffmpeg

4.2 配置 Git(防止克隆失败)

git config --global http.postBuffer 524288000

实战踩坑:GitHub 克隆经常报 GnuTLS recv errorHTTP/2 stream was not closed cleanly。多试几次或者用 --depth=1 浅克隆。如果有代理,清空代理设置:

git config --global http.proxy ""
git config --global https.proxy ""

4.3 运行安装脚本

cd ~
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash

如果脚本克隆 GitHub 失败,手动来:

rm -rf ~/.hermes/hermes-agent
git clone --depth=1 https://github.com/NousResearch/hermes-agent.git ~/.hermes/hermes-agent

4.4 安装 Python 依赖

cd ~/.hermes/hermes-agent
export PATH="$HOME/.local/bin:$PATH"
uv venv venv --python 3.11
export VIRTUAL_ENV="$(pwd)/venv"
UV_HTTP_TIMEOUT=300 uv pip install -e ".[messaging,cron,cli,mcp,pty]"

UV_HTTP_TIMEOUT=300 是因为默认 30 秒超时,某些大包(如 elevenlabs)下载慢会失败。

4.5 创建全局命令链接

ln -sf ~/.hermes/hermes-agent/hermes ~/.local/bin/hermes
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
hermes version
# 输出 v0.8.0 就对了

5. Step 3:安装 Ollama(Windows 端)

  1. 访问 ollama.com
  2. 下载 Windows 版安装
  3. 安装后系统托盘有 Ollama 图标

下载模型

# 按显存选择
ollama pull qwen3.5:35b        # 24GB+ 显存
ollama pull qwen3:32b          # 20GB+ 显存
ollama pull deepseek-r1:32b    # 20GB+ 显存
ollama pull qwen2.5:7b         # 6GB+ 显存(入门)

# 查看已下载
ollama list

创建扩展上下文版本

# Ollama 默认上下文太小,需要扩展
"FROM qwen3.5:35b`nPARAMETER num_ctx 32768" | Out-File -FilePath "Modelfile" -Encoding utf8
ollama create qwen3.5-35b-32k -f "Modelfile"

6. Step 4:打通 WSL2 到 Windows Ollama 的网络

这是整个教程最恶心的一步。WSL2 跑在虚拟网络里,localhost 指的是 WSL 自己,不是 Windows。

graph LR
    A["WSL2 Ubuntu\n172.27.x.x"] -- "localhost 不通" --> B["Windows Ollama\n127.0.0.1:11434"]
    A -- "宿主 IP 通" --> C["Windows Ollama\n0.0.0.0:11434"]

    style A fill:#2d6a4f,color:#fff
    style B fill:#c62828,color:#fff
    style C fill:#00aa55,color:#fff

6.1 让 Ollama 监听所有网卡

PowerShell 执行:

[System.Environment]::SetEnvironmentVariable("OLLAMA_HOST", "0.0.0.0", "User")

然后彻底重启 Ollama(托盘右键 Quit 再重新打开)。

验证:

netstat -an | findstr 11434
# 应该看到:
# TCP    0.0.0.0:11434    0.0.0.0:0    LISTENING

6.2 添加防火墙规则

管理员 PowerShell:

New-NetFirewallRule -DisplayName "Ollama WSL" -Direction Inbound -Protocol TCP -LocalPort 11434 -Action Allow

6.3 检查并删除 Block 规则(关键!)

Get-NetFirewallRule -DisplayName "*Ollama*" | Format-Table DisplayName, Enabled, Direction, Action

实战踩坑:Windows 防火墙可能自动创建了 ollama.exeBlock 规则!Block 规则优先级高于 Allow,会导致怎么加 Allow 规则都没用。必须删掉 Block 规则

Get-NetFirewallRule -DisplayName "ollama.exe" | Where-Object {$_.Action -eq "Block"} | Remove-NetFirewallRule

6.4 从 WSL 测试连接

# 获取 Windows 宿主 IP
HOST_IP=$(ip route | grep default | awk '{print $3}')
echo $HOST_IP

# 测试
curl http://$HOST_IP:11434/api/tags
# 能看到模型列表就通了

Connection refused = Ollama 没监听 0.0.0.0,重启 Ollama Connection timed out = 防火墙拦截,检查 Block 规则


7. Step 5:配置 Hermes 连接本地模型

hermes model

选择 More providers... 然后选 Custom endpoint (enter URL manually)

提示填什么
API base URLhttp://172.27.112.1:11434/v1(用你实际的宿主 IP)
API key留空(Ollama 不需要)
Model nameqwen3.5-35b-32k:latest
Context length32768

或者直接改配置文件:

HOST_IP=$(ip route | grep default | awk '{print $3}')
sed -i "s|http://[^/]*:11434|http://$HOST_IP:11434|g" ~/.hermes/config.yaml

8. Step 6:修复上下文窗口限制(必做)

又是一个大坑! Hermes Agent 要求最低 64K 上下文窗口,你的模型只有 32K。不改会直接报错:

Model has a context window of 32,768 tokens, which is below the minimum 64,000 required.

解决方案——直接覆盖配置:

sed -i 's/context_length: 32768/context_length: 65536/' ~/.hermes/config.yaml

验证:

grep context_length ~/.hermes/config.yaml
# 输出 context_length: 65536

注意:这是"骗过"检查,实际模型还是 32K 上下文。对话太长时模型会开始遗忘早期内容。如果你的显存够大,可以用 num_ctx 65536 创建真正的 64K 版本模型。


9. Step 7:启动并使用

hermes chat

看到这个界面就成功了:


██╗  ██╗███████╗██████╗ ███╗   ███╗███████╗███████╗       █████╗  ██████╗ ███████╗███╗   ██╗████████╗
██║  ██║██╔════╝██╔══██╗████╗ ████║██╔════╝██╔════╝      ██╔══██╗██╔════╝ ██╔════╝████╗  ██║╚══██╔══╝
███████║█████╗  ██████╔╝██╔████╔██║█████╗  ███████╗█████╗███████║██║  ███╗█████╗  ██╔██╗ ██║   ██║
██╔══██║██╔══╝  ██╔══██╗██║╚██╔╝██║██╔══╝  ╚════██║╚════╝██╔══██║██║   ██║██╔══╝  ██║╚██╗██║   ██║
██║  ██║███████╗██║  ██║██║ ╚═╝ ██║███████╗███████║      ██║  ██║╚██████╔╝███████╗██║ ╚████║   ██║
╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚══════╝      ╚═╝  ╚═╝ ╚═════╝ ╚══════╝╚═╝  ╚═══╝   ╚═╝

╭─────────────────────────────────────────────────────────────────────────────── Hermes Agent v0.8.0 (2026.4.8) · upstream b909a9ef ───────────────────────────────────────────────────────────────────────────────╮
│                                          Available Tools                                                                                                                                                         │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⡀⠀⣀⣀⠀⢀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      browser: browser_back, browser_click, ...                                                                                                                               │
│      ⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣇⠸⣿⣿⠇⣸⣿⣿⣷⣦⣄⡀⠀⠀⠀⠀⠀⠀      clarify: clarify                                                                                                                                                        │
│      ⠀⢀⣠⣴⣶⠿⠋⣩⡿⣿⡿⠻⣿⡇⢠⡄⢸⣿⠟⢿⣿⢿⣍⠙⠿⣶⣦⣄⡀⠀      code_execution: execute_code                                                                                                                                            │
│      ⠀⠀⠉⠉⠁⠶⠟⠋⠀⠉⠀⢀⣈⣁⡈⢁⣈⣁⡀⠀⠉⠀⠙⠻⠶⠈⠉⠉⠀⠀      cronjob: cronjob                                                                                                                                                        │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⡿⠛⢁⡈⠛⢿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      delegation: delegate_task                                                                                                                                               │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠿⣿⣦⣤⣈⠁⢠⣴⣿⠿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      file: patch, read_file, search_files, write_file                                                                                                                        │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠻⢿⣿⣦⡉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      homeassistant: ha_call_service, ha_get_state, ...                                                                                                                       │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢷⣦⣈⠛⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      image_gen: image_generate                                                                                                                                               │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣴⠦⠈⠙⠿⣦⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      (and 11 more toolsets...)                                                                                                                                               │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣤⡈⠁⢤⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀                                                                                                                                                                              │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠷⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      Available Skills                                                                                                                                                        │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠑⢶⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      autonomous-ai-agents: claude-code, codex, hermes-agent, opencode                                                                                                        │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠁⢰⡆⠈⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      creative: ascii-art, ascii-video, excalidraw, ideation, m...                                                                                                            │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⠈⣡⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      data-science: jupyter-live-kernel                                                                                                                                       │
│      ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀      devops: webhook-subscriptions                                                                                                                                           │
│                                          email: himalaya                                                                                                                                                         │
│  qwen3.5-35b-32k:latest · Nous Research  gaming: minecraft-modpack-server, pokemon-player                                                                                                                        │
│     /home/alben/.hermes/hermes-agent     general: dogfood                                                                                                                                                        │
│     Session: 20260416_001157_xxxxx      github: codebase-inspection, github-auth, github-code-r...                                                                                                              │
│                                          leisure: find-nearby                                                                                                                                                    │
│                                          mcp: mcporter, native-mcp                                                                                                                                               │
│                                          media: gif-search, heartmula, songsee, youtube-content                                                                                                                  │
│                                          mlops: audiocraft-audio-generation, axolotl, clip, dsp...                                                                                                               │
│                                          note-taking: obsidian                                                                                                                                                   │
│                                          productivity: google-workspace, linear, nano-pdf, notion, ocr...                                                                                                        │
│                                          red-teaming: godmode                                                                                                                                                    │
│                                          research: arxiv, blogwatcher, llm-wiki, polymarket, resea...                                                                                                            │
│                                          smart-home: openhue                                                                                                                                                     │
│                                          social-media: xitter                                                                                                                                                    │
│                                          software-development: plan, requesting-code-review, subagent-driven-d...                                                                                                │
│                                                                                                                                                                                                                  │
│                                          28 tools · 74 skills · /help for commands                                                                                                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Welcome to Hermes Agent! Type your message or /help for commands.
✦ Tip: Browser pages over 8000 tokens are auto-summarized by the auxiliary LLM before returning to the agent.

在提示符后直接打字就行。

常用交互

hermes chat                          # 交互式对话
hermes "帮我写一个Python爬虫"          # 单次任务
hermes doctor                        # 健康检查
hermes model                         # 切换模型
hermes model qwen3:32b               # 直接指定模型

状态栏说明

qwen3.5-35b-32k:latest | 16.7K/65.5K | [###.......] 26% | 5m
部分含义
qwen3.5-35b-32k:latest当前模型
16.7K/65.5K已用 / 总上下文 tokens
26%上下文使用率
5m会话持续时间

好了自己动手测试一下吧


    ╭─ ⚕ Hermes ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    系统测试成功!Hermes Agent 正在运行。

    让我执行一个简单的命令来验证终端功能:
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
      ┊ 💻 preparing terminal…
      ┊ 💻 $         echo "Testing terminal access..." && date  0.5s

    ╭─ ⚕ Hermes ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    终端功能正常运作!当前是 2026 年 4 月 16 日星期四,协调世界时(CST)00:48:30。

    我还可以测试其他功能,比如:
    - 读写文件
    - 执行 Python 代码
    - 浏览网页
    - 搜索文件
    - 使用各种技能工具

    请告诉我您想测试什么功能,或者有什么任务需要帮助!
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
     ⚕ qwen3.5-35b-32k:latest │ 16.7K/65.5K │ [███░░░░░░░] 26% │ 5m
    ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    ❯ 
    ──────────────────────────────────────────────────────────────────────────

10. 常用命令速查

image.png


11. 常见问题 FAQ(实战踩坑)

Q1:安装脚本克隆 GitHub 失败

报错GnuTLS recv error (-110)HTTP/2 stream was not closed cleanly

原因:WSL2 网络不稳定 + 代理干扰。

解决

git config --global http.proxy ""
git config --global https.proxy ""
git config --global http.postBuffer 524288000
rm -rf ~/.hermes/hermes-agent
git clone --depth=1 https://github.com/NousResearch/hermes-agent.git ~/.hermes/hermes-agent

多试几次,总会通的。


Q2:WSL 里 curl Ollama 连接超时

报错Connection timed out

原因:Windows 防火墙有 ollama.exeBlock 规则。

解决

# 管理员 PowerShell
Get-NetFirewallRule -DisplayName "ollama.exe" | Where-Object {$_.Action -eq "Block"} | Remove-NetFirewallRule

Q3:WSL 里 curl Ollama 连接被拒

报错Connection refused

原因:Ollama 没有监听 0.0.0.0。

解决

[System.Environment]::SetEnvironmentVariable("OLLAMA_HOST", "0.0.0.0", "User")
# 然后彻底重启 Ollama

Q4:hermes 命令找不到

解决

ln -sf ~/.hermes/hermes-agent/hermes ~/.local/bin/hermes
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc

Q5:Python 依赖安装超时

报错Failed to download ... Try increasing UV_HTTP_TIMEOUT

解决

UV_HTTP_TIMEOUT=300 uv pip install -e ".[messaging,cron,cli,mcp,pty]"

Q6:上下文窗口太小被拒绝

报错context window of 32,768 tokens, below the minimum 64,000

解决

sed -i 's/context_length: 32768/context_length: 65536/' ~/.hermes/config.yaml

Q7:WSL 导出备份时 ext4.vhdx 找不到

报错无法将磁盘附加到 WSL2: 系统找不到指定的文件

原因:虚拟磁盘损坏。

解决:直接注销重建,反正也没什么数据:

wsl --unregister Ubuntu
Invoke-WebRequest -Uri "https://cloud-images.ubuntu.com/wsl/jammy/current/ubuntu-jammy-wsl-amd64-ubuntu22.04lts.rootfs.tar.gz" -OutFile "G:\WSL\ubuntu.tar.gz"
wsl --import Ubuntu G:\WSL\Ubuntu G:\WSL\ubuntu.tar.gz --version 2

12. 模型推荐选型

模型显存需求中文代码推理拉取命令
qwen2.5:7b6 GB三星两星两星ollama pull qwen2.5:7b
qwen3:32b20 GB四星三星四星ollama pull qwen3:32b
deepseek-r1:32b20 GB三星三星五星ollama pull deepseek-r1:32b
qwen3.5:35b24 GB五星四星四星ollama pull qwen3.5:35b
qwen3-coder:30b20 GB三星五星三星ollama pull qwen3-coder:30b

提醒:本地 35B 模型跑 Agent 任务效果跟 Claude Sonnet/Opus 比还是有差距的。Hermes 这种 Agent 框架的效果很大程度取决于底层模型能力。想体验完整实力建议配 OpenRouter 的 API Key。


总结

完成以上步骤后,你拥有了:

  • 完全本地的 AI Agent,数据不出本机
  • 完全免费,无需任何 API 费用
  • 断网可用,不依赖任何外部服务
  • 74 个技能,28 个工具,能执行代码、操作文件、浏览网页
  • 可扩展,支持 Skills 技能插件生态
graph LR
    A["Hermes Agent\n本地 AI 助手"] --> B["文件管理"]
    A --> C["代码执行"]
    A --> D["浏览器控制"]
    A --> E["任务委派"]
    A --> F["代码生成"]
    A --> G["文件搜索"]

    style A fill:#4a0e8f,color:#fff

说白了这玩意就是个终端里的 AI 打工人,你说话它干活。至于干得好不好,取决于你喂它什么模型。好了就这样,有空再写怎么实际用它干活。


文档版本:2026年4月(基于 Hermes Agent v0.8.0 实战整理)

官方文档hermes-agent.nousresearch.com

作者:吴佳浩Alben