Appearance
腾讯云部署 OpenClaw
在腾讯云 CVM 或 Lighthouse 上运行持久化的 OpenClaw Gateway,让你的龙虾 24 小时在线。
前置条件
- 腾讯云账号(注册)
- SSH 工具(PuTTY、终端或腾讯云控制台的网页 SSH)
- 约 20 分钟
第一步:创建实例
推荐配置:
| 配置 | 推荐值 |
|---|---|
| 产品 | CVM 标准型 S5 或 Lighthouse 2 核 2 GB |
| 镜像 | Ubuntu Server 22.04 LTS 64 位 |
| 系统盘 | 40 GB SSD |
| 网络 | 默认 VPC,分配公网 IP |
| 计费模式 | 按量付费(测试)或包年包月(长期) |
Lighthouse 用户:Lighthouse 已预配置防火墙,跳过下方"安全组"步骤,直接在 Lighthouse 控制台的"防火墙"页面放行端口即可。
创建步骤:
- 登录腾讯云控制台
- 新建 CVM,选择上表配置
- 登录方式选"SSH 密钥"(推荐)或密码
- 记下实例的公网 IP
第二步:配置安全组
在腾讯云控制台 → 安全组 → 入站规则,放行以下端口:
| 端口 | 协议 | 用途 |
|---|---|---|
| 22 | TCP | SSH 远程登录 |
| 80 | TCP | HTTP(Nginx,可选) |
| 443 | TCP | HTTPS(Nginx + SSL,可选) |
| 18789 | TCP | OpenClaw Gateway Web UI(仅测试用,生产建议用 Nginx 代理) |
生产环境:18789 端口不必对外开放,用 Nginx 反向代理到 80/443 更安全。
第三步:安装 Node.js 和 OpenClaw
SSH 登录实例后执行:
bash
# 更新系统
apt update && apt upgrade -y
# 安装 Node.js 24(推荐)
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
apt install -y nodejs
# 验证
node -v # 应输出 v24.x.x
# 安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw --version第四步:运行引导配置
bash
openclaw onboard --install-daemon向导会依次引导你完成:模型 API Key 配置 → 频道选择 → Gateway 令牌生成 → systemd 守护进程安装。
完成后验证 Gateway 状态:
bash
openclaw status
systemctl --user status openclaw-gateway.service第五步(可选):Nginx 反向代理
如果你想通过域名访问 Control UI,或不想暴露 18789 端口:
bash
apt install -y nginx
# 创建 Nginx 配置
cat > /etc/nginx/sites-available/openclaw << 'EOF'
server {
listen 80;
server_name your-domain.com; # 替换为你的域名或公网 IP
location / {
proxy_pass http://127.0.0.1:18789;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
EOF
ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginx配置好后通过 http://your-domain.com 访问 Control UI。
添加 Swap(2 GB 内存以下推荐)
bash
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab故障排查
Gateway 无法启动 — 运行 openclaw doctor --non-interactive,用 journalctl --user -u openclaw-gateway.service -n 50 查看详细日志。
端口无法访问 — 检查腾讯云安全组入站规则是否放行对应端口;确认系统防火墙(ufw status)未拦截。
内存不足 / OOM — 确认 Swap 已激活(free -h);或升级到 4 GB 内存实例。
openclaw 命令找不到 — 检查 PATH:npm prefix -g,将 $(npm prefix -g)/bin 加入 ~/.bashrc。
下一步
- 渠道接入 — 连接 Telegram、飞书、Discord 等
- Gateway 配置 — 所有配置选项
- 保持更新 — OpenClaw 版本升级
- 阿里云 ECS 部署(结构相同,参考本文)