Ubuntu同时部署OpenClaw和Hermes Agent
适用系统: Ubuntu 22.04 / 24.04
最后更新: 2026-05-28
一、概述
OpenClaw 和 Hermes Agent 都是开源的个人 AI 助手框架,可以在你的服务器或个人电脑上运行,通过 Telegram、Discord、WhatsApp、QQ 等消息平台进行交互。两者可以同时部署在同一台 Ubuntu 机器上,互不冲突。
二、环境准备
2.1 系统依赖
1 2 3 4 5
| sudo apt update && sudo apt upgrade -y
sudo apt install -y curl git build-essential python3 python3-pip python3-venv
|
2.2 安装 Node.js(OpenClaw 需要)
OpenClaw 推荐 Node 24 或 **Node 22.19+**。
1 2 3 4 5 6 7
| curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - sudo apt install -y nodejs
node --version npm --version
|
💡 如果需要 Node 24,可使用 nvm 管理多版本:
1 2 3 4
| curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash source ~/.bashrc nvm install 24 nvm use 24
|
2.3 验证 Python(Hermes 需要)
1 2
| python3 --version pip3 --version
|
三、安装 OpenClaw
3.1 全局安装
1 2 3 4
| npm install -g openclaw@latest
openclaw --version
|
3.2 初始化配置
运行引导向导,会一步步配置网关、工作区、消息渠道和技能:
1
| openclaw onboard --install-daemon
|
--install-daemon 会自动安装 systemd 用户服务,让网关开机自启并在后台持续运行。
3.3 配置文件位置
1 2 3 4 5 6 7 8
| ~/.openclaw/ ├── openclaw.json # 主配置(模型、渠道、行为等) ├── .env # 环境变量 / API密钥 └── workspace/ # 工作区 ├── SOUL.md # 人格定义 ├── MEMORY.md # 长期记忆 ├── AGENTS.md # 项目级指令 └── skills/ # 自定义技能
|
3.4 网关管理
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| openclaw gateway status
openclaw gateway start
openclaw gateway stop
journalctl --user -u openclaw-gateway -f
openclaw gateway --port 18789 --verbose
|
四、安装 Hermes Agent
4.1 一键安装
1
| curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
|
安装完成后,激活虚拟环境或重新加载 shell:
1 2 3
| source ~/.bashrc
export PATH="$HOME/.hermes/hermes-agent/venv/bin:$PATH"
|
4.2 初始化配置
1 2 3 4 5
| hermes setup
hermes model
|
4.3 配置文件位置
1 2 3 4 5 6 7 8 9 10
| ~/.hermes/ ├── config.yaml # 主配置 ├── .env # API 密钥(独立文件,不提交到 git) ├── state.db # 会话存储(SQLite) ├── skills/ # 已安装技能 ├── logs/ # 日志 │ ├── agent.log │ ├── errors.log │ └── gateway.log └── hermes-agent/ # 源代码(git 安装方式)
|
4.4 网关管理
1 2 3 4 5 6 7 8 9 10 11 12 13
| hermes gateway install
hermes gateway status
hermes gateway start hermes gateway stop hermes gateway restart
journalctl --user -u hermes-gateway -f
|
4.5 常用命令速查
1 2 3 4 5 6 7 8 9 10
| hermes hermes chat -q "问题" hermes model hermes config edit hermes tools hermes skills list hermes sessions list hermes cron list hermes doctor hermes update
|
五、从 OpenClaw 迁移到 Hermes
如果你已在用 OpenClaw,Hermes 提供了一键迁移:
5.1 预览(推荐先预览)
1
| hermes claw migrate --dry-run
|
这会显示哪些内容可以迁移、哪些会跳过、哪些会冲突。
5.2 执行迁移
1 2 3 4 5
| hermes claw migrate --preset user-data
hermes claw migrate --preset full --migrate-secrets
|
5.3 迁移内容包括
| 内容 |
OpenClaw 来源 |
Hermes 目标 |
| 人格定义 |
workspace/SOUL.md |
~/.hermes/SOUL.md |
| 长期记忆 |
workspace/MEMORY.md |
~/.hermes/memories/MEMORY.md |
| 用户档案 |
workspace/USER.md |
~/.hermes/memories/USER.md |
| 自定义技能 |
workspace/skills/ |
~/.hermes/skills/openclaw-imports/ |
| 模型/提供商 |
openclaw.json → models.providers |
config.yaml → custom_providers |
| 消息平台令牌 |
openclaw.json → channels |
.env → 对应变量 |
| 命令审批 |
exec-approvals.json |
config.yaml → command_allowlist |
5.4 迁移后清理
六、同时运行两个 Agent
两个 Agent 互不冲突,因为它们使用完全独立的数据目录和服务名:
6.1 服务隔离
1 2 3 4 5
| systemctl --user status openclaw-gateway
systemctl --user status hermes-gateway
|
6.2 利用 Hermes 的 profiles 隔离
如果你想让 Hermes 有多个独立实例(例如一个用于工作,一个用于个人),可以用 profiles:
1 2 3 4 5
| hermes profile create work hermes profile create personal
hermes --profile work
|
6.3 频道分配策略
如果你在不同平台上使用不同 Agent,可以在各自的配置中指定不同的 token:
1 2
| OpenClaw → Telegram Bot A, Discord Server A Hermes → Telegram Bot B, Discord Server B, QQ
|
也可以让两者共用同一个平台的不同 Bot/账号。
6.4 资源占用参考
| 组件 |
内存占用(大致) |
说明 |
| OpenClaw Gateway |
~200-400 MB |
Node.js 进程 |
| Hermes Gateway |
~100-300 MB |
Python 进程 |
| 模型调用 |
外部 API(无本地开销) |
除非使用本地模型 |
💡 建议:至少 2GB 可用内存。如果使用本地模型(vLLM / llama.cpp),需要额外的 GPU 或内存。
七、systemd 开机自启
确保两个网关都在用户级 systemd 下运行:
1 2 3 4 5 6 7 8 9 10
| sudo loginctl enable-linger $USER
systemctl --user is-active openclaw-gateway systemctl --user is-active hermes-gateway
systemctl --user enable openclaw-gateway systemctl --user enable hermes-gateway
|
八、常见问题
Q1: 两个 Agent 能否绑定同一个 Telegram Bot?
不能。Telegram Bot Token 只能被一个服务使用。需要创建两个不同的 Bot。
Q2: 端口冲突怎么办?
OpenClaw 默认使用 18789 端口,Hermes 默认使用随机端口(由 systemd socket activation 管理)。一般不会冲突。如需自定义:
1 2 3 4 5
| openclaw gateway --port 18888
hermes config set gateway.port 18999
|
Q3: 如何查看日志排查问题?
1 2 3 4 5 6
| journalctl --user -u openclaw-gateway -f --since "10 min ago"
journalctl --user -u hermes-gateway -f cat ~/.hermes/logs/gateway.log | tail -100
|
Q4: 系统更新后网关挂了?
1 2 3 4
| systemctl --user daemon-reload systemctl --user restart openclaw-gateway systemctl --user restart hermes-gateway
|
Q5: WSL2 用户注意
Q6: OpenClaw 迁移后技能不生效?
迁移后的技能在 ~/.hermes/skills/openclaw-imports/,启动新会话后才会加载。使用 /reset 或开启新对话即可。
九、端口与路径速查表
| 项目 |
路径/值 |
| OpenClaw 配置 |
~/.openclaw/openclaw.json |
| OpenClaw 工作区 |
~/.openclaw/workspace/ |
| OpenClaw 守护服务 |
systemctl --user ... openclaw-gateway |
| OpenClaw 默认端口 |
18789 |
| Hermes 配置 |
~/.hermes/config.yaml |
| Hermes 密钥 |
~/.hermes/.env |
| Hermes 技能 |
~/.hermes/skills/ |
| Hermes 守护服务 |
systemctl --user ... hermes-gateway |
| Hermes 安装目录 |
~/.hermes/hermes-agent/ |
| Hermes 日志 |
~/.hermes/logs/ |
十、总结
在 Ubuntu 上同时运行 OpenClaw 和 Hermes Agent 是完全可行的:
- ✅ 数据目录独立(
~/.openclaw/ vs ~/.hermes/)
- ✅ 服务名独立(两个 systemd user service)
- ✅ 运行时无冲突(Node.js vs Python)
- ✅ Hermes 提供一键迁移,可无缝过渡
- ✅ 可通过 profiles 进一步隔离不同的 Hermes 实例
两个 Agent 各有所长,可以同时运行、互补使用。迁移路径也很顺畅,随时可以逐步将 OpenClaw 的配置和记忆迁移到 Hermes。
📚 参考资料: