部署方案
OpenHuman 在 Linux 服务器上部署 — 无桌面环境运行指南
2026-05-25约 8 分钟阅读
OpenHuman 默认是桌面端应用。但在服务器上也可以运行——通过命令行模式 + API 方式使用。适合 VPS 用户、团队共享部署、或者把 OpenHuman 作为服务运行。
方案一:部署开发服务器
# 安装 Node.js 24+
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs
# 安装 pnpm
npm install -g pnpm@10.10.0
# 克隆仓库
git clone https://github.com/tinyhumansai/openhuman.git
cd openhuman
# 安装依赖
pnpm install
# 启动服务(开发模式)
pnpm dev --host 0.0.0.0 --port 3000方案二:Docker 部署
参考详细教程:
# 创建 docker-compose.yml
version: "3.8"
services:
openhuman:
image: node:24-alpine
container_name: openhuman
ports:
- "3000:3000"
volumes:
- ./data:/app/data
- ./config.toml:/app/config.toml
working_dir: /app
command: >
sh -c "git clone https://github.com/tinyhumansai/openhuman.git . && npm install -g pnpm && pnpm install && pnpm dev --host 0.0.0.0"详见 Docker 一键部署教程。
配置 systemd 自启动
让 OpenHuman 在服务器重启后自动启动:
# /etc/systemd/system/openhuman.service
[Unit]
Description=OpenHuman AI Agent
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser/openhuman
ExecStart=/usr/bin/pnpm dev --host 0.0.0.0 --port 3000
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetsudo systemctl enable openhuman sudo systemctl start openhuman配置 Nginx 反向代理
server {
listen 80;
server_name openhuman.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:3000;
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 X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}安全注意事项
- 不要将 OpenHuman 直接暴露在公网——务必使用反向代理 + HTTPS
- 添加防火墙规则,限制访问 IP
- API Key 存储在服务器上,确保服务器本身安全
- 定期更新软件版本