本地电脑关了就没了。把 Hermes 装到一台云服务器上,它就能 7×24 常驻:帮你盯定时任务、接微信/QQ 机器人、跑周报、管网站。本文以阿里云轻量应用服务器为例,从买到装到跑起来。
阿里云官网:https://www.aliyun.com/product/swas(轻量应用服务器)
控制台 → 你的实例 → 防火墙 / 安全组,放行这些端口(其它一律不开):
| 端口 | 用途 | 建议 |
|---|---|---|
| 22 | SSH 登录 | 必须(或用密钥后改自定义高位端口) |
| 80 / 443 | HTTP / HTTPS(网站、Nginx) | 要跑网站才开 |
| 其它 | 应用端口 | 一律不开,走 Nginx 反代到 80/443 |
轻量默认支持密码登录,但强烈建议用密钥(更安全、免密):
把密钥放到本地,设好权限(关键!):
cp 下载的/密钥.pem ~/my-server-key.pem chmod 600 ~/my-server-key.pem
从本地终端(macOS/Linux/WSL)连:
ssh -i ~/my-server-key.pem root@你的公网IP
轻量服务器 root 用户通常直接可用。连上后先做基础更新:
apt update && apt upgrade -y
顺手配个 SSH 别名(省事):
echo -e "Host myhermes\n HostName 你的IP\n User root\n IdentityFile ~/my-server-key.pem" >> ~/.ssh/config
之后 ssh myhermes 直连。
在服务器上执行官方安装命令(会自动装好 Python/Node/FFmpeg 等全部依赖):
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash
装完让命令生效:
source ~/.bashrc hermes --version
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890
或在服务器上配好能通 GitHub 的网络后重试。Hermes 需要接一个大模型 API 才能干活。最简单用 Nous Portal(一条命令):
hermes setup --portal
或者接第三方 API(OpenRouter / DeepSeek / GLM 等),运行向导选模型填 Key:
hermes model
配完跑个健康检查:
hermes doctor
没报错就说明模型配好了。先试一句:
hermes chat -q "你好,用一句话介绍你自己"
SSH 一断开,前台跑的 Hermes 就没了。要常驻,用 systemd 用户服务:
hermes gateway install # 装成后台服务 hermes gateway start hermes gateway status
但注意:服务器重启后 systemd 用户服务默认不自动起。让网关随开机自启 + 避免 SSH 退出杀掉服务:
sudo loginctl enable-linger $USER # 允许用户服务开机自启 systemctl --user enable hermes-gateway
sudo reboot 后 hermes gateway status 是否 still running。验收清单:
hermes doctor 无错hermes chat -q "..." 能回答hermes gateway status 显示 running进阶玩法(都有独立教程):
hermes cron create "每天 9 点" --prompt "..."