html 如何在 Oracle VM 免费部署 Hermes Agent · Nous Research
← 返回主页
🌐 繁體中文 English 简体中文 العربية
Nous Research · MIT 开源 · 2026

如何在 Oracle VM 免费部署 Hermes Agent

OCI Free Tier ARM 实战 · 2 vCPU / 12GB RAM 永久免费(2026-06-15 起)· systemd 24/7 运行
零成本慨云端 AI Agent,所有踩坑已经替你踩平

⚡ 本指南以 2026-08-01 实测为准。所有资源必须维持喺「Always Free」额度内,超出会收费。
目录
0 架构 1 注册帐号 2 建立 VM 3 SSH 初始化 4 安装 Hermes 5 初始化设定 6 模型 API Key 7 systemd Gateway 8 Telegram Bot 9 中文回覆 10 防火墙 11 命令速查 12 踩坑合集 13 WebUI 14 备份维护 15 免费额度减半
0. 架构

0点解要咁部署(架构概览)

Hermes Agent 系 Nous Research 开发慨开源 AI Agent 框架(MIT 协议)——喺终端度读档案、写程式码、执行命令、操控浏览器,唔绑定任何模型厂商,仲内建 Telegram Gateway。放喺 Oracle 永久免费 VM 上,就变成 24/7 唔断线慨云端 AI Agent。

Telegram 讯息 Hermes Gateway DeepSeek API AI 回覆 Telegram 聊天

systemd 服务管理:开机自启、崩溃自动重启、断开 SSH 都照常运行。

💰

永久免费

ARM 2 vCPU + 12GB RAM + 200GB 磁碟(2026-06-15 起),唔使信用卡长期扣费

🔄

模型自由

DeepSeek / OpenAI / Anthropic / Google 任拣,换供应商改 config 就得

💬

Telegram 原生

内建 Gateway,一条 systemd 服务即 24/7 自动回覆

🖥️

零运维焦虑

崩溃自动重启 + journald 日志 + 远端备份,瞓觉都唔使理

1. 注册

1注册 Oracle Cloud Free Tier 帐号

前往注册页面

https://signup.cloud.oracle.com/

填姓名、电邮、国家/地区。

拣 Home Region关键

务必拣支援 Ampere ARM 实例慨区域(Home Region 之后唔改得):
Osaka / Tokyo / Paris / Frankfurt / Ashburn / Phoenix 都支援。

Home Region 拣错咗就冇 ARM 实例 — 呢个决定咗你之后有冇 2 vCPU 免费机用。

信用卡验证

要提供有效信用卡或扣帐卡。 Oracle 会暂时扣约$1 美元验证,几日后退还。唔接受虚拟卡或预付卡。

等启用

通常几分钟至几小时。收到启用邮件即可登入cloud.oracle.com

⚠️ 免费唔等于无限:资源超出「Always Free」限制会产生费用。建议升级做 Pay-As-You-Go(仍 $0,但容量不足时可以解决,亦系免费 ARM 抢唔到容量慨解药)。
2. 建立 VM

2建立 OCI 运算实例(VM)

开建立页面

OCI Console →Compute → Instances → Create Instance。区域应显示「Always Free-eligible」标签。

拣映像档

Change image → 拣Ubuntu 22.04 LTS 或 24.04 LTS

拣实例规格ARM Ampere 推荐

方案规格建议
ARM Ampere A1VM.Standard.A1.Flex— 2 OCPU + 12GB RAM(2026-06-15 前系 4/24)✅ 主力(免费额度内最大配置)
x86 MicroVM.Standard.E2.1.Micro— 1/8 OCPU + 1GB❌ 太细,仅适合测试

网络 + SSH 金钥

用预设 VCN/子网,勾选「Assign a public IPv4 address」。 SSH 拣「Paste public keys」,贴上你慨公钥(本地未有就先产生):

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

加大开机磁碟到 200GB免费上限

Show advanced options → Boot volume → 自订大小 → 输入200(GB)。预设得 50GB,迟下装嘢先嚟扩充冇咁方便。

Create 并记低 Public IP

等状态变「Running」,记低 Public IP(例如130.123.45.67)。

3. SSH

3连线 VM 与系统初始化

SSH 连线

ssh -i ~/.ssh/id_rsa ubuntu@<你的Public IP>

Ubuntu 预设用户系ubuntu;Oracle Linux 先系opc

更新系统

sudo apt update && sudo apt upgrade -y

装基本工具 + 设时区

sudo apt install -y curl git wget nano vim ufw build-essential sudo timedatectl set-timezone Asia/Hong_Kong

开 UFW 防火墙(第一层)

sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow ssh sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw enable

⚠️ 记住:Oracle 有两层防火墙— VM 入面慨 UFW/iptables 之外,仲有 OCI VCN 慨 Security List(第 10 节会讲)。两层都要开先通。

4. 安装

4安装 Hermes Agent

一键安装

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

自动完成:安装 uv → 建 Python 3.11 venv → 装 100+ 依赖 → 装 Node.js → 装 cua-driver。

重新载入 + 验证

source ~/.bashrc hermes --version

出到版本号(例如hermes 0.14.0)即成功。安装路径喺~/.local/bin/hermes,设定喺~/.hermes/

⚠️ ARM 实测坑:HTTP/2 下载失败。安装脚本喺 Node.js 下载时可能报curl: (92) HTTP/2 stream error。解法:Ctrl+C终止 → 手动用 HTTP/1.1 下载 ARM 版 Node.js:
curl --http1.1 -L "https://nodejs.org/dist/v22.11.0/node-v22.11.0-linux-arm64.tar.gz" -o /tmp/node.tar.gz mkdir -p ~/.hermes/node tar -xzf /tmp/node.tar.gz -C ~/.hermes/node --strip-components=1 rm /tmp/node.tar.gz
再重新执行安装脚本,会跳过已下载慨 Node.js。
5. setup

5初始化设定(setup 向导)

启动向导

hermes setup

选项一览

  • 设定模式:Quick setup(快速)或 Custom setup(详细)
  • 终端后端:local backend
  • 讯息平台:拣「Skip — set up later」,Telegram 之后单独设(第 7-8 节)

完成

设定写入~/.hermes/config.yaml,密钥写入~/.hermes/.env

6. API Key

6设定模型供应商与 API Key

Hermes 支援任意供应商。以下用 DeepSeek 做例(性价比高、无需海外支付)。

攞 DeepSeek API Key

platform.deepseek.com→ 注册/登入 → API Keys → 建立 Key(sk-开头)。新用户有免费额度。

确认 config.yaml

nano ~/.hermes/config.yaml
provider: deepseek model: deepseek-v4-pro base_url: https://api.deepseek.com/v1

写入 .env

DEEPSEEK_API_KEY=sk-你的deepseek密钥

验证连线

hermes chat

输入「你好」收到回覆即成功,Ctrl+C退出。

⚠️ 踩坑:DeepSeek Key 有两种!用过 Claude Code + DeepSeek 慨人可能攞错 — 一个系 Claude Code 用慨ANTHROPIC_AUTH_TOKEN,一个系 DeepSeek 平台原生 Key,两者格式相同但值唔同。用平台原始 Key;报 401 就系 Key 错。快速测试:
curl https://api.deepseek.com/v1/chat/completions \ -H "Authorization: Bearer sk-你的key" \ -H "Content-Type: application/json" \ -d '{"model":"deepseek-v4-pro","messages":[{"role":"user","content":"hi"}]}'
200 = 有效,401 = 无效。
7. Gateway systemd

7安装 Hermes Gateway(systemd 服务)

喺 Linux 伺服器上,Gateway 必须行 systemd 先做到:开机自启、崩溃自动重启、24/7 唔断线、断开 SSH 照跑。

安装 Gateway

hermes gateway install

手动建立 systemd 服务档核心步骤

⚠️最易中慨大坑:systemd 唔会读 .env 档!环境变数必须直接写入服务档,否则 Bot 会话「No messaging platforms enabled」。

sudo nano /etc/systemd/system/hermes-gateway.service
[Unit] Description=Hermes Gateway Service After=network.target [Service] Type=simple User=ubuntu WorkingDirectory=/home/ubuntu ExecStart=/home/ubuntu/.local/bin/hermes gateway Restart=always RestartSec=10 Environment=PATH=/home/ubuntu/.local/bin:/usr/local/bin:/usr/bin:/bin # 关键:systemd 唔读 .env,环境变数要直接写喺呢度! Environment=DEEPSEEK_API_KEY=sk-你的deepseek密钥 Environment=TELEGRAM_BOT_TOKEN=你的Bot Token Environment=TELEGRAM_ALLOWED_USERS=你的Telegram数字ID Environment=TELEGRAM_HOME_CHANNEL=你的Telegram数字ID Environment=GATEWAY_ALLOW_ALL_USERS=true [Install] WantedBy=multi-user.target

修改重点:User/WorkingDirectory/ExecStart按实际路径改;五个Environment=全部要填真值。

启动 + 开机自启

sudo systemctl daemon-reload sudo systemctl enable hermes-gateway sudo systemctl start hermes-gateway

验证 + 睇日志

sudo systemctl status hermes-gateway sudo journalctl -u hermes-gateway -f

状态显示active (running),日志见到✓ telegram connected即成功。

设日志轮替(防磁碟爆)

sudo nano /etc/systemd/journald.conf
SystemMaxUse=200M SystemKeepFree=500M RuntimeMaxUse=100M
sudo systemctl restart systemd-journald
实测教训(我哋部机):改服务档可以喺本地写好先上传 —sudo cp/etc/systemd/system/daemon-reload就得。另外Bot 上 systemd 之前一定要 pkill 旧慨 polling 进程,否则 Telegram 会报 409 Conflict(两个 getUpdates 同时争同一个 Bot)。最后hermes git pull --rebase更新完记得重启服务。
8. Telegram

8接入 Telegram Bot

用 @BotFather 建 Bot

Telegram 搜寻@BotFather/newbot→ 设名称/用户名 → 攞Bot Token(格式123456:ABC-DEF1234ghiJKL)。妥善保存,唔好泄漏。

攞你慨 Telegram 数字 ID

搜寻@userinfobot/start→ 攞数字 ID(例如123456789)。

更新 systemd 服务档

sudo nano /etc/systemd/system/hermes-gateway.service
Environment=TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghiJKL Environment=TELEGRAM_ALLOWED_USERS=123456789 Environment=TELEGRAM_HOME_CHANNEL=123456789 Environment=GATEWAY_ALLOW_ALL_USERS=true
sudo systemctl daemon-reload sudo systemctl restart hermes-gateway

验证

日志见到✓ telegram connected,然后喺 Telegram 同你慨 Bot 讲嘢,有回覆即成。

故障排查口诀:Bot 冇反应 → ①sudo systemctl status hermes-gateway系咪 running → ② 日志journalctl -u hermes-gateway -f→ ③ 见到No messaging platforms enabled= Token 冇读到 → ④ 检查服务档 Environment → ⑤daemon-reload+restart→ ⑥ 再验证。
9. SOUL.md

9设定中文回覆(SOUL.md)

编辑 SOUL.md

cp ~/.hermes/SOUL.md ~/.hermes/SOUL.md.backup nano ~/.hermes/SOUL.md

喺顶部加入语言规则:

CRITICAL LANGUAGE RULE: You MUST reply in Chinese (繁体中文) at all times. The user speaks Chinese. Never use English unless the user explicitly asks.

(可选)注入项目知识

SOUL.md 可以写入身份、技能、项目结构、程式码规范、常用命令 — 成为 Hermes 慨「长期记忆」,每次对话都引用。

重启生效

sudo systemctl restart hermes-gateway

改完 SOUL.md 必须重启 Gateway 先生效。

10. 防火墙

10防火墙与安全规则(两层都要开)

Oracle VM 有两层防火墙:OCI VCN 慨 Security List(云端层)+ 实例内慨 UFW(系统层)。两层都唔放行先会通。

▎10.1 OCI Security List(云端层)

开入站规则

OCI Console → Networking → Virtual Cloud Networks → 拣 VCN → Subnets → Security Lists → 预设安全清单 → Add Ingress Rules:

来源类型来源 CIDR连接埠用途
CIDR0.0.0.0/022SSH
CIDR0.0.0.0/080HTTP
CIDR0.0.0.0/0443HTTPS

若安装 WebUI 仲要开对应连接埠(如 8787)。

▎10.2 实例防火墙(系统层)

sudo ufw status verbose

应见到22 / 80 / 443 ALLOW IN。 Oracle Linux 用户如果 UFW 冇反应,可能要直接改 iptables。

⚠️ 实测教训:OCI 慨「NSG ≠ iptables」。如果喺 Console 开咗安全清单但仍然连唔到,唔好净系喺 VM 入面查 iptables — 先确认 OCI 嗰层(Security List / NSG)有冇放行。两层系独立慨,任何一层挡住都系失败。仲有:443 好多时已经俾其他服务(例如 sing-box 代理)占用,开 port 前先ss -tlnp睇下边个喺度用紧。
11. 命令速查

11常用指令速查表

指令作用
hermes chat启动终端对话模式
hermes --tui启动 TUI 介面
hermes setup重新执行设定向导
hermes update更新 Hermes Agent(源码版用git pull --rebase
hermes gateway install / status / restartGateway 安装 / 状态 / 重启
hermes cron list / status列出 / 查看排程任务
sudo systemctl status hermes-gateway查看服务状态
sudo systemctl enable hermes-gateway开机自动启动
sudo journalctl -u hermes-gateway -f即时睇服务日志
tail -f ~/.hermes/logs/gateway.log即时睇 Hermes 日志
df -h / free -h磁碟 / 记忆体使用
12. 踩坑

12踩坑合集(全部亲测)

Q:Bot 上 systemd 后报 409 Conflict?

原因:旧慨 polling 进程仲喺度同 Gateway 争同一个 Bot Token。
解决:起服务前先pkill -f "hermes"或直接pkill -f polling,再systemctl start hermes-gateway

Q:Gateway 启动咗但 Bot 完全冇反应?

原因:9 成系 systemd 冇读到环境变数。日志出现No messaging platforms enabled即系 Token 未载入。
解决:确认服务档慨Environment=五个变数全部填咗 →daemon-reload+restart→ 再睇日志。

Q:DeepSeek API 报 401 Authentication Fails?

原因:用错 Key(Claude Code 嗰个)或者 Key 过期。
解决:用 curl 测 Key(见 §6)→ 去平台重建 → 更新服务档DEEPSEEK_API_KEYdaemon-reload+restart

Q:SSH 连唔到/超时?

检查顺序:① OCI Security List 有冇开 22 → ② Public IP 啱唔啱 → ③ 金钥权限chmod 400 ~/.ssh/id_rsa→ ④ 用户名(Ubuntu 用ubuntu)。

Q:记忆体不足(OOM)?

用 ARM 2 vCPU / 12GB 实例基本上唔会遇到。 x86 micro 先要加 Swap:
sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile
再加入/etc/fstab永久生效。

Q:Oracle 会唔会回收我部机?

Oracle 会回收长期低活动慨免费实例。 Gateway 24/7 运行本身就系持续活动;想更稳阵可以加 keepalive:
crontab -e→ 加入*/30 * * * * echo "keepalive $(date)" >> ~/keepalive.log

Q:更新完要重启吗?

apt upgrade更新咗 kernel 之后要sudo reboot先生效;hermes git pull --rebase更新源码之后要sudo systemctl restart hermes-gateway

13. WebUI

13进阶:Hermes WebUI(可选)

想用浏览器介面同 Agent 互动、唔使 SSH?装 WebUI 就得。

克隆 + 设密码

cd ~ git clone https://github.com/nesquena/hermes-webui.git hermes-webui cd hermes-webui echo "HERMES_WEBUI_PASSWORD=设置一个强密码" > .env

建 systemd 服务

sudo nano /etc/systemd/system/hermes-webui.service
[Unit] Description=Hermes WebUI After=network.target [Service] Type=simple User=ubuntu WorkingDirectory=/home/ubuntu/hermes-webui ExecStart=/home/ubuntu/hermes-webui/start.sh Restart=always RestartSec=5 [Install] WantedBy=multi-user.target

启动 + 访问

sudo systemctl daemon-reload sudo systemctl enable hermes-webui sudo systemctl start hermes-webui

浏览器开http://<Public IP>:8787,用 .env 密码登入。记住 OCI Security List 要放行 8787。

(可选)Nginx 反代 + HTTPS

sudo apt install nginx certbot python3-certbot-nginx -y sudo nano /etc/nginx/sites-available/hermes-webui
server { listen 80; server_name ai.yourdomain.com; client_max_body_size 500M; location / { proxy_pass http://127.0.0.1:8787; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
sudo ln -s /etc/nginx/sites-available/hermes-webui /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl restart nginx sudo certbot --nginx -d ai.yourdomain.com
14. 备份

14备份与维护建议

▎14.1 定期备份(最重要慨档案)

tar -czvf hermes-backup-$(date +%Y%m%d).tar.gz \ ~/.hermes/config.yaml ~/.hermes/.env ~/.hermes/SOUL.md \ ~/.hermes/logs/ /etc/systemd/system/hermes-gateway.service # 拉返落本地 scp ubuntu@<Public IP>:~/hermes-backup-*.tar.gz ./

config.yaml(设定)、.env(密钥)、SOUL.md(长期记忆)、systemd 服务档 — 呢四样加埋就系成部机慨「灵魂」,冇咗渠哋等于由头嚟过。

▎14.2 维护节奏

频率做咩
每周sudo apt update && sudo apt upgrade -y+sudo apt autoremove -y
每月sudo journalctl --vacuum-time=30ddf -h/free -h检查
每 3-6 个月rotation API Key、检查 Drive/远端备份完整性

▎14.3 安全建议

附录

15 ⚠️ 2026-06-15:Oracle 免费额度悄悄减半

2026-06-15 Oracle 没有公告、没有邮件,悄悄改文档将 Always Free ARM 额度减半:4 OCPU / 24GB → 2 OCPU / 12GB(每月上限 3,000 OCPU-hrs + 18,000 GB-hrs → 1,500 + 9,000)。外送流量维持 10TB/月(未变)。

配置(长开一个月)消耗新额度 1,500 + 9,000
4 OCPU / 24GB(旧)2,920 OCPU-hrs + 17,520 GB-hrs❌ 超出一倍
2 OCPU / 12GB(新)1,460 OCPU-hrs + 8,760 GB-hrs✅ 刚好

▎纯免费 vs PAYG 命运不同

⚠️ 唯一风险(官方有提):实例正常停止 → 可以再启动;但若被终止(terminate),重建同配置要看大阪区当时 ARM 容量。保险已就绪:OCI boot volume backup + Drive 异地备份。

▎官方政策原文(关键段落)

来源:docs.oracle.com — Always Free Resources

"All tenancies get the first 1,500 OCPU hours and 9,000 GB hours per month for free for VM instances using the VM."
"you can create one or two OCI Ampere A1 Compute instances, 2 OCPUs total."

▎官方客服回覆原文(2026-08-03,PAYG 账户查询)

"Thank you for providing the details. Since your tenancy is a Pay As You Go (PAYG) account, you do not need to worry about the recent Always Free Ampere A1 resource limit update. Your existing 4 OCPU / 24 GB A1 instance does not need to be resized as a result of this policy change. You will not be billed for your existing 4 OCPU / 24 GB A1 instance solely because of the Always Free limit update. The reduction to 2 OCPUs / 12 GB RAM applies only to Always Free tenancies, not to PAYG accounts. There is no deadline requiring PAYG customers to resize existing A1 instances because of this change. If your instance is stopped, you can start it again normally. However, if it is terminated, the ability to recreate an instance with the same configuration depends on current capacity availability in your selected region. The reduction in the Always Free Ampere A1 allocation applies only to Always Free tenancies. PAYG and other paid tenancy types are not affected by this specific policy change. Based on the information available, your existing 4 OCPU / 24 GB A1 instance on your PAYG tenancy will continue to operate under the terms applicable to your paid account and will not incur charges solely because of this Always Free policy update."

▎社群共识(2026-07)

▎保险三宝(亲测)

  1. OCI Boot Volume Backup:Console → 计算 → 实例 → 引导卷 → 创建备份(云端整机还原,~10 分钟 Available)
  2. Drive 异地备份:配置 tar.gz(~/.hermes、nginx、systemd、crontab)每日自动 → Google Drive(见 §14)
  3. 不要乱停机:grandfather 期间一旦终止,可能永远开不回来

▎替代方案(万一 Oracle 完蛋)

需求方案成本
日本 IP + 最便宜保留 Oracle 2/12$0
日本 IP 付费Contabo 大阪 4vCPU/8GB | Vultr Tokyo 1-2GB~€7/月 | $5-6/月
不需要日本 IPRackNerd 1GB | GCP e2-micro~$1/月 | $0
科学上网用途VLESS/REALITY(任何 VPS 都行)+ CF Worker 后备$0 起

💡 GFW 提示:Oracle/Contabo 数据中心 IP 用久了容易被封,REALITY 可抵挡主动探测;CF Worker(edgetunnel)是免费后备线路。

附录:档案路径 + 资源限制 + 完成清单

▎档案路径总览

路径说明
~/.local/bin/hermesHermes 主程式
~/.hermes/config.yaml主设定档
~/.hermes/.env环境变数 / 密钥
~/.hermes/SOUL.md系统提示词(长期记忆)
~/.hermes/logs/gateway.logGateway 日志
/etc/systemd/system/hermes-gateway.serviceGateway systemd 服务档

▎OCI Always Free 资源上限

资源限制
ARM Ampere A1 实例2 OCPU + 12GB RAM(2026-06-15 起减半;旧账户可继续跑 4/24 直至实例终止)
x86 AMD 实例最多 2 个 E2.1.Micro(各 1/8 OCPU + 1GB)
开机磁碟总容量200GB(所有实例共享)
公有 IPv4最多 6 个
网路频宽每 vCPU 1 Gbps

▎部署完成清单

检查项
VM 已建立(ARM 2 OCPU / 12GB)并 SSH 连到
hermes --version有输出
DeepSeek API Key 有效(curl 200)
systemd 服务 active + enabled,日志见✓ telegram connected
Telegram 实测有回覆
SOUL.md 已设繁中回覆
OCI Security List + UFW 两层防火墙已开
备份策略已建立(tar.gz + 拉返本地)
相关连结

鍾意呢份指南?請我飲杯咖啡 ☕

☕ 請我喝杯咖啡