Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
在 DigitalOcean Droplet 上运行一个持久化的 OpenClaw Gateway 网关。
前提条件
- DigitalOcean 账户(注册)
- SSH 密钥对(或愿意使用密码认证)
- 大约 20 分钟
创建 Droplet
使用干净的基础镜像(Ubuntu 24.04 LTS)。避免使用第三方 Marketplace 一键镜像,除非你已经检查过它们的启动脚本和防火墙默认设置。
- 登录 DigitalOcean。
- 点击 Create > Droplets。
- 选择:
- Region: 离你最近的区域
- Image: Ubuntu 24.04 LTS
- Size: Basic、Regular、1 vCPU / 1 GB RAM / 25 GB SSD
- Authentication: SSH 密钥(推荐)或密码
- 点击 Create Droplet 并记下 IP 地址。
连接并安装
ssh root@YOUR_DROPLET_IP
apt update && apt upgrade -y
# 安装 Node.js 24
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
apt install -y nodejs
# 安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw --version
运行新手引导
openclaw onboard --install-daemon
向导会引导你完成模型认证、渠道设置、Gateway 网关 token 生成以及守护进程安装(systemd)。添加 swap(推荐用于 1 GB Droplet)
fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
验证 Gateway 网关
openclaw status
systemctl --user status openclaw-gateway.service
journalctl --user -u openclaw-gateway.service -f
访问 Control UI
Gateway 网关 默认绑定到回环地址。请选择以下其中一种方式。选项 A:SSH 隧道(最简单)# 在你的本地机器上
ssh -L 18789:localhost:18789 root@YOUR_DROPLET_IP
然后打开 http://localhost:18789。选项 B:Tailscale Servecurl -fsSL https://tailscale.com/install.sh | sh
tailscale up
openclaw config set gateway.tailscale.mode serve
openclaw gateway restart
然后在 tailnet 中的任意设备上打开 https://<magicdns>/。选项 C:Tailnet 绑定(不使用 Serve)openclaw config set gateway.bind tailnet
openclaw gateway restart
然后打开 http://<tailscale-ip>:18789(需要 token)。
故障排除
Gateway 网关无法启动 —— 运行 openclaw doctor --non-interactive,并使用 journalctl --user -u openclaw-gateway.service -n 50 检查日志。
端口已被占用 —— 运行 lsof -i :18789 查找进程,然后停止它。
内存不足 —— 使用 free -h 验证 swap 是否已启用。如果仍然发生 OOM,请使用基于 API 的模型(Claude、GPT),而不是本地模型,或升级到 2 GB 的 Droplet。
后续步骤
- 渠道 —— 连接 Telegram、WhatsApp、Discord 等
- Gateway 网关配置 —— 所有配置选项
- 更新 —— 让 OpenClaw 保持最新
相关内容