Linux 安装 Hermes Agent
# 前言
Hermes Agent (opens new window) 是由 Nous Research 开发的开源 AI Agent 框架,具有以下特点:
- 多渠道接入:同一 Agent 可通过 Telegram、Discord、Slack、WhatsApp、Signal、Email 和 CLI 等多渠道访问
- 持久记忆:记住项目历史和过往解决方案,自动生成和安装 Skills
- 自动化调度:支持自然语言的 cron 任务,通过 Gateway 实现无人值守
- 委托与并行:子 Agent 拥有独立的对话、终端和 Python RPC,支持并行工作
- 安全沙箱:支持 local、Docker、SSH、Singularity、Modal 等多种后端
- 丰富的工具链:40+ 内置工具,涵盖搜索、终端、文件系统、浏览器自动化、视觉、图像生成、TTS 等
本文将详细介绍在 Linux 服务器上安装 Hermes Agent 的完整流程。
# 安装准备
# 系统要求
| 组件 | 要求 |
|---|---|
| 操作系统 | Linux(Ubuntu/Debian 推荐)、macOS、WSL2 |
| Git | 必须预先安装 |
| curl | 必须预先安装 |
| xz-utils | Linux 上需要(用于解压 Node.js) |
| build-essential | 桌面应用需要(编译原生模块) |
# 预装依赖(Ubuntu/Debian)
# 更新系统
sudo apt update && sudo apt upgrade -y
# 安装基础依赖
sudo apt install -y git curl xz-utils build-essential
1
2
3
4
5
2
3
4
5
提示
安装脚本会自动处理以下依赖,无需手动安装:
- uv(Python 包管理器)
- Python 3.11
- Node.js v22
- ripgrep(快速文件搜索)
- ffmpeg(音频格式转换)
# 一键安装
# 标准安装
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
1
安装脚本会自动完成:
- 检测并安装缺失的依赖
- 克隆 Hermes Agent 仓库
- 创建 Python 虚拟环境
- 配置全局
hermes命令 - 初始化 LLM 提供商配置
# 非 sudo 用户安装
如果你是以系统服务账号(无 sudo 权限)运行,需要分两步操作:
第一步:管理员安装浏览器依赖
# 有 sudo 权限的用户执行
sudo npx playwright install-deps chromium
1
2
2
第二步:服务用户执行安装
# 无 sudo 权限的服务用户执行
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
1
2
2
如果完全不需要浏览器自动化功能:
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash -s -- --skip-browser
1
# 安装位置
| 安装方式 | 代码位置 | 二进制位置 | 数据目录 |
|---|---|---|---|
| 普通用户 | ~/.hermes/hermes-agent/ | ~/.local/bin/hermes | ~/.hermes/ |
| Root 模式 | /usr/local/lib/hermes-agent/ | /usr/local/bin/hermes | /root/.hermes/ |
# 安装后配置
# 重载 Shell
source ~/.bashrc
# 或 zsh 用户
source ~/.zshrc
1
2
3
2
3
# 初始化配置
# 启动交互式配置向导
hermes setup
# 快速配置 Nous Portal(推荐)
hermes setup --portal
# 仅配置模型
hermes model
# 配置工具权限
hermes tools
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# 配置模型提供商
Hermes 支持多种模型提供商:
| 提供商 | 说明 |
|---|---|
| Nous Portal | OAuth 登录,一次订阅访问 300+ 模型 |
| OpenRouter | 自带 API Key 接入 |
| 自定义端点 | 任何 OpenAI 兼容的 HTTP API |
# 交互式选择模型
hermes model
# 设置 OpenRouter API Key
hermes config set OPENROUTER_API_KEY your_key
1
2
3
4
5
2
3
4
5
# 验证安装
# 运行诊断
hermes doctor
# 启动交互式会话
hermes
1
2
3
4
5
2
3
4
5
# 常用命令
# 日常使用
| 命令 | 说明 |
|---|---|
hermes | 启动交互式会话 |
hermes setup | 配置向导 |
hermes model | 选择/更换模型 |
hermes tools | 配置工具权限 |
hermes update | 更新到最新版本 |
hermes doctor | 诊断问题 |
hermes config check | 检查配置 |
hermes config set KEY VALUE | 设置配置项 |
# Gateway 消息网关
Hermes Gateway 允许通过多个聊天平台访问同一个 Agent:
# 启动 Gateway 配置向导
hermes gateway setup
# 运行 Gateway
hermes gateway
# 安装为系统服务
hermes gateway install
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 桌面应用
# 安装后启动桌面应用
hermes desktop
1
2
2
# 配置管理
# 查看当前配置
hermes config list
# 检查配置
hermes config check
# 迁移配置(升级后)
hermes config migrate
# 设置单个配置项
hermes config set OPENROUTER_API_KEY sk-or-xxx
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# 目录结构
~/.hermes/
├── hermes-agent/ # 核心代码
│ ├── venv/ # Python 虚拟环境
│ └── ... # 源码文件
├── config/ # 配置文件
├── skills/ # 自定义技能
├── sessions/ # 会话数据
└── memory/ # 持久化记忆
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# Systemd 服务配置
将 Hermes Gateway 配置为系统服务:
# 创建服务用户
sudo useradd -r -s /bin/bash hermes
sudo mkdir -p /home/hermes
sudo chown hermes:hermes /home/hermes
1
2
3
2
3
# 创建服务文件
sudo tee /etc/systemd/system/hermes.service << 'EOF'
[Unit]
Description=Hermes Agent Gateway
After=network.target
[Service]
Type=simple
User=hermes
WorkingDirectory=/home/hermes
Environment="PATH=/home/hermes/.local/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart=/home/hermes/.local/bin/hermes gateway
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 启动服务
sudo systemctl daemon-reload
sudo systemctl enable hermes
sudo systemctl start hermes
sudo systemctl status hermes
1
2
3
4
2
3
4
# 故障排除
# 常见问题
| 问题 | 解决方案 |
|---|---|
hermes: command not found | 执行 source ~/.bashrc 或检查 PATH |
| API Key 未设置 | 执行 hermes model 配置或 hermes config set |
| 配置丢失 | 执行 hermes config check 然后 hermes config migrate |
| 模块缺失错误 | 确保使用 venv 中的 launcher,而非系统 Python |
# 诊断命令
# 完整诊断
hermes doctor
# 查看环境信息
hermes doctor --verbose
# 检查安装方式
hermes update --dry-run
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
# 日志查看
# 查看 Gateway 日志
journalctl -u hermes -f
# 查看用户日志
tail -f ~/.hermes/logs/hermes.log
1
2
3
4
5
2
3
4
5
# 进阶配置
# 环境变量
| 变量 | 说明 |
|---|---|
HERMES_HOME | 数据目录位置(默认 ~/.hermes) |
OPENROUTER_API_KEY | OpenRouter API Key |
ANTHROPIC_API_KEY | Anthropic API Key |
OPENAI_API_KEY | OpenAI API Key |
# 配置文件示例
{
"model": {
"provider": "openrouter",
"model": "anthropic/claude-3.5-sonnet"
},
"tools": {
"enabled": ["bash", "read", "write", "web_search", "browser"]
},
"memory": {
"enabled": true,
"persist": true
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
# Skills 生态
Hermes 支持动态技能系统:
# 安装技能
# 从 ClawHub 安装
hermes skill install <skill-name>
# 从 GitHub 安装
hermes skill install github:user/repo
1
2
3
4
5
2
3
4
5
# 社区资源
| 平台 | 说明 |
|---|---|
| ClawHub (opens new window) | 官方技能市场 |
| LobeHub (opens new window) | 社区技能分享 |
| GitHub (opens new window) | 官方仓库 |
# 与 OpenClaw 对比
| 特性 | Hermes | OpenClaw |
|---|---|---|
| 开发团队 | Nous Research | OpenClaw Community |
| 多渠道 | Telegram/Discord/Slack/WhatsApp/Signal/Email | Telegram/飞书 |
| 记忆系统 | 持久记忆 + 自动技能生成 | 结构化记忆文件 |
| 技能系统 | 动态生成 + 社区市场 | Skill 文件定义 |
| 沙箱 | Docker/SSH/Modal/Singularity | 本地 + Docker |
# 相关链接
- 官方网站:https://hermes-agent.nousresearch.com (opens new window)
- GitHub 仓库:https://github.com/NousResearch/hermes-agent (opens new window)
- 官方文档:https://hermes-agent.nousresearch.com/docs (opens new window)
- Cheatsheet:https://hermescheatsheet.com (opens new window)
- Nous Research:https://nousresearch.com (opens new window)
# 总结
Hermes Agent 是一个功能强大的 AI Agent 框架,安装简单、配置灵活。通过 Gateway 可以实现多平台统一接入,持久记忆和技能系统让它越用越聪明。如果你的服务器资源充足,强烈推荐尝试这个工具。