Documentation Index
Fetch the complete documentation index at: https://openclaw.zhcndoc.com/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 key(推荐)或密码
- 点击 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
运行 onboarding
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。
下一步