概念 study · 研习 #server, tooling 2026-06-03

Hermes Agent 安装与踩坑实录

本文记录在云服务器上安装 Hermes Agent 的完整过程。Hermes 是 Nous Research 开源的一个 AI Agent 框架——可以把它理解成一个运行在终端里的 AI 助手,支持任何 LLM 提供商,还能接入微信、Telegram 等消息平台。

前置:需要一台安装了 Ubuntu 24.04 的服务器 → 从零购买并配置云服务器

Hermes 是什么

一句话:一个能调用工具、有记忆、连接微信的终端 AI Agent。

它不跑模型——推理调用 DeepSeek/OpenAI 等 API。所以不需要 GPU,一台 1C2G 的轻量服务器就能跑。

🔐 运行 Hermes 之前,建议先做好服务器安全加固 → SSH 异常登录调查与安全加固实录

核心能力:

安装:官方方式为什么失败

curl | bash 脚本做了什么

官方安装命令:

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

这行命令做了七件事:

步骤 做什么
1. 检测系统 Linux/macOS,装对应系统依赖
2. 装 uv Python 包管理器(比 pip 快 10-100 倍)
3. 装 Python 3.11 没有就自动装
4. 装 Node.js 浏览器工具需要
5. git clone 从 GitHub 拉源码
6. pip install 安装所有 Python 依赖
7. 配置 PATH ops 命令可用

为什么在国内跑不动

🕳 第一个坑:GitHub 被阻断。

安装脚本第 5 步 git clone 失败了:

fatal: unable to access 'https://github.com/NousResearch/hermes-agent.git/':
GnuTLS recv error (-110): The TLS connection was non-properly terminated.

这是 GFW 干的。你 ping github.com 能通,但 clone 大仓库时连接被 RST。

解决方案:源码打包 scp

既然服务器拉不下 GitHub,就从能拉下的机器打包传过去:

# 在能访问 GitHub 的机器上(比如你的笔记本)
cd ~/.hermes
tar --exclude='.git' --exclude='venv' --exclude='node_modules' \
    -czf hermes-agent-src.tar.gz hermes-agent/

# 传到服务器
scp hermes-agent-src.tar.gz ops@服务器IP:/tmp/

# 在服务器上解压
ssh ops@服务器IP
cd ~/.hermes
tar -xzf /tmp/hermes-agent-src.tar.gz

安装 Python 依赖也慢

🕳 第二个坑:pip install 超时。

uv pip install -e . 需要从 PyPI 下载几十个包。默认 PyPI 服务器在国外,国内下载可能 10KB/s。

解决:用清华镜像。

cd ~/.hermes/hermes-agent
source .venv/bin/activate
uv pip install -e . -i https://pypi.tuna.tsinghua.edu.cn/simple

配置 DeepSeek API

Hermes 本身不跑模型,需要连接一个 LLM 提供商。我们用的 DeepSeek:

# 写入 API Key 到 .env
echo "DEEPSEEK_API_KEY=*** ~/.hermes/.env

# 设置默认模型
ops config set model.default deepseek-v4-pro
ops config set model.provider deepseek
ops config set model.base_url https://api.deepseek.com/v1

测试

ops chat -q "你好" --model deepseek-v4-pro

🕳 第三个坑:首次运行特别慢。

第一次 ops chat 可能要等 30-60 秒。不是卡住了——它在扫描 100+ 个 Skill 文件。 第二次就快了,2-3 秒出回复。

ops 命令在任何地方可用

装完之后你可能会发现:ops: command not found

.bashrc 和 .profile 的区别

这是 Linux 新手的经典困惑。

文件 什么时候被加载
~/.bashrc 打开新终端(非登录 Shell)
~/.profile SSH 登录时(登录 Shell)

🕳 第四个坑:只配了 .bashrc,SSH 登录后 ops 命令找不到。

解决:两个都配。

# 在 ~/.bashrc 和 ~/.profile 末尾都加上
export PATH="$HOME/.local/bin:$HOME/.hermes/hermes-agent/.venv/bin:$PATH"
export HERMES_HOME="$HOME/.hermes"

免密 SSH 登录

Linux/Mac

ssh-keygen -t ed25519  # 一路 Enter
ssh-copy-id ops@服务器IP

Windows

# PowerShell 里
mkdir C:\Users\你的用户名\.ssh        # 如果报 no such file
ssh-keygen -t ed25519
type C:\Users\你的用户名\.ssh\id_ed25519.pub
# 复制输出,SSH 登录服务器后:
echo "粘贴那串公钥" >> ~/.ssh/authorized_keys

🕳 Windows 特有坑: ssh-keygen 不会自动创建 .ssh 目录,需要手动 mkdir

验证清单


下一步: 接入微信 Gateway,让手机也能用 Hermes → 微信 Gateway 接入 Hermes