文章目录
- 以管理员身份打开 PowerShell 或 CMD,运行: wsl –install 这条命令会自动: 启用 WSL 功能 安装默认的 Ubuntu 发行版 设置 WSL2 为默认版本
- 安装完成后重启,首次启动 Ubuntu 时会要求你设置 Linux 用户名和密码。
- # 在 Windows 终端或 PowerShell 中 wsl -l -v # 你应该看到类似输出: # NAME STATE VERSION # Ubuntu Running 2 如果版本显示为 1,可以手动升级: wsl –set-version Ubuntu 2
- 对于国内用户,建议将 Ubuntu 的 apt 源更换为国内镜像以提高下载速度: # 备份原始源 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 替换为清华源 sudo sed -i ‘s/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g’ /etc/apt/sources.list sudo sed -i ‘s/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g’ /etc/apt/sources.list # 更新 sudo apt update && sudo apt upgrade -y
- 在 WSL2 终端中运行: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash 这个安装脚本会帮你自动完成: 安装系统依赖(Python、Node.js、ripgrep、ffmpeg 等) 克隆 Hermes Agent 仓库 创建 Python 虚拟环境(使用 uv 或 pip) 安装所有 Python 依赖 创建全局 hermes 命令 自动配置 LLM 提供商
- 安装完成后,重新加载配置: source ~/.bashrc
- hermes doctor 这条命令会诊断环境是否正常。如果看到绿色提示,说明安装成功。
- 问题:下载太慢或超时 如果下载 Hermes 依赖很慢,可以配置 pip 使用国内镜像: # 创建 pip 配置目录 mkdir -p ~/.pip cat > ~/.pip/pip.conf << ‘EOF’ [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn EOF # 然后重新运行安装 curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash 问题:Python 版本不兼容 Hermes 需要 Python 3.10+。WSL2 默认 Ubuntu 一般自带 Python 3.10+。如果版本太低: sudo apt install python3.11 python3.11-venv python3.11-dev -y
- hermes model 这是一个交互式向导,会引导你选择提供商和模型。
- 场景 推荐 说明 最省心 Nous Portal 免费额度,直接使用 模型最多 OpenRouter 200+ 模型可选,按量付费 已有 OpenAI 账号 OpenAI 直接使用 GPT 系列 已有 Anthropic 账号 Anthropic 使用 Claude 系列 本地运行 Ollama / llama.cpp 用本地 GPU 或 CPU 推理 国产模型 DeepSeek / z.ai GLM 国内访问快,延迟低
- 如果你希望直接写入 API Key,可以编辑配置文件: hermes config set provider openrouter hermes config set model deepseek/deepseek-chat 或直接编辑: hermes config set provider deepseek hermes config set api_key “sk-你的API密钥”
- 配置完成后,直接输入 hermes 启动交互式 TUI: hermes 输入任意问题测试响应,如果能正常回答,说明部署成功。
- WSL2 和 Windows 是独立的网络命名空间。WSL 里的自动化库(Playwright 等)无法直接操控 Windows 上运行的 Edge 浏览器进程。解决方案是:在 Windows 端启动一个 Playwright 服务器,WSL 通过 HTTP API 远程控制它。
- 在 Windows 上打开 PowerShell(管理员): # 创建项目目录 mkdir C:edge-automation cd C:edge-automation # 初始化项目和安装依赖 npm init -y npm install playwright # 安装 Edge 浏览器支持 npx playwright install msedge
- 在 C:edge-automation 目录下创建 server.js: const express = require(‘express’); const { chromium } = require(‘playwright’); const app = express(); app.use(express.json()); let browser, page; async function startBrowser() { browser = await chromium.launch({ channel: ‘msedge’, headless: false, }); const context = await browser.newContext(); page = await context.newPage(); console.log(‘[SUCCESS] Edge 浏览器已启动’); } // 导航到 URL app.post(‘/navigate’, async (req, res) => { try { await page.goto(req.body.url, { waitUntil: ‘networkidle’ }); res.json({ status: ‘ok’, title: await page.title() }); } catch (e) { res.status(500).json({ error: e.message }); } }); // 点击元素 app.post(‘/click’, async (req, res) => { try { await page.click(req.body.selector); res.json({ status: ‘ok’ }); } catch (e) { res.status(500).json({ error: e.message }); } }); // 输入文字 app.post(‘/fill’, async (req, res) => { try { await page.fill(req.body.selector, req.body.text); res.json({ status: ‘ok’ }); } catch (e) { res.status(500).json({ error: e.message }); } }); // 获取页面信息 app.get(‘/info’, async (req, res) => { res.json({ url: page.url(), title: await page.title() }); }); // 健康检查 app.get(‘/health’, (req, res) => { res.json({ status: ‘ok’, browser: browser ? ‘running’ : ‘stopped’ }); }); const PORT = 8080; startBrowser().then(() => { app.listen(PORT, ‘0.0.0.0’, () => { console.log(`[INFO] 服务器已启动: http://0.0.0.0:${PORT}`); }); });
- cd C:edge-automation node server.js 保持这个 PowerShell 窗口打开。服务器启动后,会弹出一个 Edge 浏览器窗口。
- 允许 WSL 访问 Windows 的 8080 端口: netsh advfirewall firewall add rule name=”EdgeAutomation” dir=in action=allow protocol=TCP localport=8080
- 打开另一个 WSL 终端,获取 Windows 的局域网 IP: # 方法1:通过 resolv.conf cat /etc/resolv.conf | grep nameserver # 方法2:通过 ipconfig ipconfig.exe | grep “IPv4” 然后测试连接(假设 Windows IP 是 192.168.1.100): curl http://192.168.1.100:8080/health 如果返回 {"status":"ok","browser":"running"},说明配置成功!
- 在 Hermes 中可以通过命令行调用: # 打开百度 curl -X POST http://192.168.1.100:8080/navigate -H “Content-Type: application/json” -d ‘{“url”:”https://www.baidu.com”}’ # 搜索内容 curl -X POST http://192.168.1.100:8080/fill -H “Content-Type: application/json” -d ‘{“selector”:”#kw”,”text”:”Hermes Agent”}’ # 点击搜索按钮 curl -X POST http://192.168.1.100:8080/click -H “Content-Type: application/json” -d ‘{“selector”:”#su”}’
- hermes # 启动交互式 CLI hermes model # 切换模型/提供商 hermes setup # 运行配置向导 hermes gateway # 启动消息网关(Telegram/Discord 等) hermes update # 更新到最新版本 hermes doctor # 诊断问题 hermes config set # 修改配置项
- # 创建 cron 任务,每天凌晨检查更新 hermes cron create –schedule “0 3 * * *” –cmd “hermes update” –name “daily-update”
- Hermes 会自动在对话中学习你的偏好,但你也可以手动保存重要配置: hermes config set editor “vim” hermes config set default_model “deepseek/deepseek-chat”
- Skills 是 Hermes 最大的亮点之一——它会把做过的复杂任务保存为可复用的技能: # 列出已有技能 hermes skills list # 使用某个技能 hermes skill run 技能名称
- # 重新加载 shell 配置 source ~/.bashrc # 或手动添加 PATH export PATH=”$HOME/.local/bin:$PATH” echo ‘export PATH=”$HOME/.local/bin:$PATH”‘ >> ~/.bashrc
- hermes doctor # 检查配置 hermes model # 重新选择模型 hermes config set api_key “新API密钥” # 检查 API Key
- # 进入安装目录手动更新 cd ~/.hermes/repo/hermes-agent git pull source venv/bin/activate pip install -e “.[all]”
- 如果 WSL 无法连接 Windows 服务: # 重启 WSL(在 Windows PowerShell 中) wsl –shutdown # 重启后重新打开 WSL 终端
目录
- 前言
- 一、前置准备
- 1.1 系统要求
- 1.2 一句话总结架构
- 二、安装 WSL2
- 2.1 一键安装
- 2.2 重启电脑
- 2.3 验证安装
- 2.4 (可选)更换国内镜像源
- 三、安装 Hermes Agent
- 3.1 一键安装命令
- 3.2 重新加载 shell
- 3.3 验证安装
- 3.4 常见安装问题
- 四、配置 LLM 提供商
- 4.1 使用hermes model命令
- 4.2 推荐提供商
- 4.3 手动配置(推荐国内用户使用 DeepSeek)
- 4.4 验证聊天
- 五、进阶:配置 Edge 浏览器支持
- 5.1 为什么需要特殊配置
- 5.2 在 Windows 上安装 Node.js 和 Playwright
- 5.3 创建自动化服务器脚本
- 5.4 启动服务器
- 5.5 配置 Windows 防火墙
- 5.6 在 WSL 中测试连接
- 5.7 使用示例
- 六、日常使用指南
- 6.1 常用命令
- 6.2 配置自动更新
- 6.3 保存配置到内存
- 6.4 使用 Skills(技能)
- 七、故障排查
- 7.1 hermes 命令找不到
- 7.2 模型调用失败
- 7.3 更新失败
- 7.4 WSL 网络问题
- 八、卸载与清理
- 九、总结
Hermes Agent 是一个由 Nous Research 开发的自进化的 AI 代理。简单说,它就像一个能在终端里一直陪伴你的 AI 助手——可以执行任务、写代码、操作浏览器、定时自动化、甚至接入 Telegram/Discord 等平台。
但问题是:Hermes 官方不支持原生 Windows。那 Windows 用户怎么办?
答案是:WSL2(Windows Subsystem for Linux)。通过 WSL2,你可以在 Windows 上无缝运行 Hermes Agent,享受完整的 Linux 用户体验,同时还能调用 Windows 资源(Edge 浏览器、本地文件等)。
本文会手把手带你完成全部部署,从零开始,包教包会。

- Windows 10 版本 2004+(Build 19041+)或 Windows 11
- 至少 8GB RAM(推荐 16GB)
- 至少 10GB 可用磁盘空间
- 稳定的网络连接(用于下载依赖和安装包)
你的 Windows 桌面
↓
WSL2(Ubuntu/Linux 环境)← 这就是 Hermes 运行的地方
↓
Hermes Agent(CLI 交互、自动化任务、网关服务)
Hermes 跑在 WSL2 的 Linux 里,但可以通过配置操作 Windows 里的 Edge 浏览器。
如果你已经装了 WSL2,可以直接跳到第三节。
如果你已经装了 WSL2,可以直接跳到第三节。
以管理员身份打开 PowerShell 或 CMD,运行:
wsl --install
这条命令会自动:
- 启用 WSL 功能
- 安装默认的 Ubuntu 发行版
- 设置 WSL2 为默认版本
安装完成后重启,首次启动 Ubuntu 时会要求你设置 Linux 用户名和密码。
# 在 Windows 终端或 PowerShell 中
wsl -l -v
# 你应该看到类似输出:
# NAME STATE VERSION
# Ubuntu Running 2
如果版本显示为 1,可以手动升级:
wsl --set-version Ubuntu 2
对于国内用户,建议将 Ubuntu 的 apt 源更换为国内镜像以提高下载速度:
# 备份原始源 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak # 替换为清华源 sudo sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list sudo sed -i 's/security.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list # 更新 sudo apt update && sudo apt upgrade -y
在 WSL2 终端中运行:
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
这个安装脚本会帮你自动完成:
- 安装系统依赖(Python、Node.js、ripgrep、ffmpeg 等)
- 克隆 Hermes Agent 仓库
- 创建 Python 虚拟环境(使用 uv 或 pip)
- 安装所有 Python 依赖
- 创建全局
hermes命令 - 自动配置 LLM 提供商
安装完成后,重新加载配置:
source ~/.bashrc
hermes doctor
这条命令会诊断环境是否正常。如果看到绿色提示,说明安装成功。
问题:下载太慢或超时
如果下载 Hermes 依赖很慢,可以配置 pip 使用国内镜像:
# 创建 pip 配置目录 mkdir -p ~/.pip cat > ~/.pip/pip.conf << 'EOF' [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple trusted-host = pypi.tuna.tsinghua.edu.cn EOF # 然后重新运行安装 curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
问题:Python 版本不兼容
Hermes 需要 Python 3.10+。WSL2 默认 Ubuntu 一般自带 Python 3.10+。如果版本太低:
sudo apt install python3.11 python3.11-venv python3.11-dev -y
Hermes 只是一个壳,真正干活需要对接一个 LLM(大语言模型)。
hermes model
这是一个交互式向导,会引导你选择提供商和模型。
| 场景 | 推荐 | 说明 |
|---|---|---|
| 最省心 | Nous Portal | 免费额度,直接使用 |
| 模型最多 | OpenRouter | 200+ 模型可选,按量付费 |
| 已有 OpenAI 账号 | OpenAI | 直接使用 GPT 系列 |
| 已有 Anthropic 账号 | Anthropic | 使用 Claude 系列 |
| 本地运行 | Ollama / llama.cpp | 用本地 GPU 或 CPU 推理 |
| 国产模型 | DeepSeek / z.ai GLM | 国内访问快,延迟低 |
如果你希望直接写入 API Key,可以编辑配置文件:
hermes config set provider openrouter hermes config set model deepseek/deepseek-chat
或直接编辑:
hermes config set provider deepseek hermes config set api_key "sk-你的API密钥"
配置完成后,直接输入 hermes 启动交互式 TUI:
hermes
输入任意问题测试响应,如果能正常回答,说明部署成功。
这是很多用户需要的功能——让 Hermes 在 WSL 里通过 Windows Edge 浏览器执行网页操作(发文章、填表单、截图等)。
WSL2 和 Windows 是独立的网络命名空间。WSL 里的自动化库(Playwright 等)无法直接操控 Windows 上运行的 Edge 浏览器进程。解决方案是:在 Windows 端启动一个 Playwright 服务器,WSL 通过 HTTP API 远程控制它。
在 Windows 上打开 PowerShell(管理员):
# 创建项目目录 mkdir C:edge-automation cd C:edge-automation # 初始化项目和安装依赖 npm init -y npm install playwright # 安装 Edge 浏览器支持 npx playwright install msedge
在 C:edge-automation 目录下创建 server.js:
const express = require('express');
const { chromium } = require('playwright');
const app = express();
app.use(express.json());
let browser, page;
async function startBrowser() {
browser = await chromium.launch({
channel: 'msedge',
headless: false,
});
const context = await browser.newContext();
page = await context.newPage();
console.log('[SUCCESS] Edge 浏览器已启动');
}
// 导航到 URL
app.post('/navigate', async (req, res) => {
try {
await page.goto(req.body.url, { waitUntil: 'networkidle' });
res.json({ status: 'ok', title: await page.title() });
} catch (e) { res.status(500).json({ error: e.message }); }
});
// 点击元素
app.post('/click', async (req, res) => {
try {
await page.click(req.body.selector);
res.json({ status: 'ok' });
} catch (e) { res.status(500).json({ error: e.message }); }
});
// 输入文字
app.post('/fill', async (req, res) => {
try {
await page.fill(req.body.selector, req.body.text);
res.json({ status: 'ok' });
} catch (e) { res.status(500).json({ error: e.message }); }
});
// 获取页面信息
app.get('/info', async (req, res) => {
res.json({
url: page.url(),
title: await page.title()
});
});
// 健康检查
app.get('/health', (req, res) => {
res.json({ status: 'ok', browser: browser ? 'running' : 'stopped' });
});
const PORT = 8080;
startBrowser().then(() => {
app.listen(PORT, '0.0.0.0', () => {
console.log(`[INFO] 服务器已启动: http://0.0.0.0:${PORT}`);
});
});
cd C:edge-automation
node server.js
保持这个 PowerShell 窗口打开。服务器启动后,会弹出一个 Edge 浏览器窗口。
允许 WSL 访问 Windows 的 8080 端口:
netsh advfirewall firewall add rule name="EdgeAutomation" dir=in action=allow protocol=TCP localport=8080
打开另一个 WSL 终端,获取 Windows 的局域网 IP:
# 方法1:通过 resolv.conf cat /etc/resolv.conf | grep nameserver # 方法2:通过 ipconfig ipconfig.exe | grep "IPv4"
然后测试连接(假设 Windows IP 是 192.168.1.100):
curl http://192.168.1.100:8080/health
如果返回 {"status":"ok","browser":"running"},说明配置成功!
在 Hermes 中可以通过命令行调用:
# 打开百度
curl -X POST http://192.168.1.100:8080/navigate
-H "Content-Type: application/json"
-d '{"url":"https://www.baidu.com"}'
# 搜索内容
curl -X POST http://192.168.1.100:8080/fill
-H "Content-Type: application/json"
-d '{"selector":"#kw","text":"Hermes Agent"}'
# 点击搜索按钮
curl -X POST http://192.168.1.100:8080/click
-H "Content-Type: application/json"
-d '{"selector":"#su"}'
hermes # 启动交互式 CLI
hermes model # 切换模型/提供商
hermes setup # 运行配置向导
hermes gateway # 启动消息网关(Telegram/Discord 等)
hermes update # 更新到最新版本
hermes doctor # 诊断问题
hermes config set # 修改配置项
# 创建 cron 任务,每天凌晨检查更新
hermes cron create
--schedule "0 3 * * *"
--cmd "hermes update"
--name "daily-update"
Hermes 会自动在对话中学习你的偏好,但你也可以手动保存重要配置:
hermes config set editor "vim" hermes config set default_model "deepseek/deepseek-chat"
Skills 是 Hermes 最大的亮点之一——它会把做过的复杂任务保存为可复用的技能:
# 列出已有技能 hermes skills list # 使用某个技能 hermes skill run 技能名称
# 重新加载 shell 配置
source ~/.bashrc
# 或手动添加 PATH
export PATH="$HOME/.local/bin:$PATH"
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
hermes doctor # 检查配置
hermes model # 重新选择模型
hermes config set api_key "新API密钥" # 检查 API Key
# 进入安装目录手动更新
cd ~/.hermes/repo/hermes-agent
git pull
source venv/bin/activate
pip install -e ".[all]"
如果 WSL 无法连接 Windows 服务:
# 重启 WSL(在 Windows PowerShell 中) wsl --shutdown # 重启后重新打开 WSL 终端
如果想完全卸载 Hermes:
# 删除安装目录 rm -rf ~/.hermes # 删除全局命令 rm -f ~/.local/bin/hermes
如果想还原 WSL:
# 在 Windows PowerShell 中 wsl --unregister Ubuntu
通过 WSL2,Windows 用户可以完整使用 Hermes Agent 的全部功能。整个流程虽然步骤不少,但每一步都有明确的指令,跟着做就行。
部署完成后,你就拥有一个:
- ✅ 可对话的 AI 助手
- ✅ 能执行代码和命令的自动化代理
- ✅ 可定时执行任务的调度器
- ✅ 能操控 Windows Edge 浏览器的远程控制能力
- ✅ 支持 Telegram/Discord 等多平台的网关
Hermes Agent 最强大的地方在于它的学习能力——你用得越多,它就越懂你。每次完成任务后它会自动生成技能,下次遇到类似任务就能直接复用。
以上就是Windows上部署Hermes Agent的完整指南的详细内容,更多关于Windows部署Hermes Agent的资料请关注风君子博客其它相关文章!