OpenClawSkills
GitHub
平台 • 5 分钟阅读

DigitalOcean

在 DigitalOcean 上运行 OpenClaw(简单的付费 VPS 选项)

Tutorial.step

目标

在 DigitalOcean 上运行持久化的 OpenClaw Gateway,费用为 $6/月(或预留定价 $4/月)。

如果你想要 $0/月的选项并且不介意 ARM + 特定提供商的设置,请参阅 ''Oracle Cloud 指南''。

Tutorial.step

成本比较(2026)

| 提供商 | 计划 | 规格 | 价格/月 | 备注 |

| | - |

Tutorial.step

前置条件

- DigitalOcean 账户(''注册可获得 $200 免费额度'')

- SSH 密钥对(或愿意使用密码认证)

- 约 20 分钟

Tutorial.step

1)创建 Droplet

1. 登录 ''DigitalOcean''

2. 点击 Create → Droplets

3. 选择:

- 区域: 离你最近(或你的用户最近)

- 镜像: Ubuntu 24.04 LTS

- 规格: Basic → Regular → $6/月(1 vCPU,1GB RAM,25GB SSD)

- 认证: SSH 密钥(推荐)或密码

4. 点击 Create Droplet

5. 记录 IP 地址

Tutorial.step

2)通过 SSH 连接

Bash
ssh root@YOUR_DROPLET_IP
Tutorial.step

3)安装 OpenClaw

Bash
apt update && apt upgrade -y

curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
apt install -y nodejs

curl -fsSL https://openclaw.ai/install.sh | bash -

openclaw --version
Tutorial.step

4)运行入门向导

Bash
openclaw onboard --install-daemon

向导将引导你完成:

- 模型认证(API 密钥或 OAuth)

- 频道设置(Telegram、WhatsApp、Discord 等)

- Gateway 令牌(自动生成)

- 守护进程安装(systemd)

Tutorial.step

5)验证 Gateway

Bash
openclaw status

systemctl --user status openclaw-gateway.service

journalctl --user -u openclaw-gateway.service -f
Tutorial.step

6)访问控制面板

Gateway 默认绑定到回环地址。要访问控制 UI:

选项 A:SSH 隧道(推荐)

Bash
ssh -L 18789:localhost:18789 root@YOUR_DROPLET_IP

选项 B:Tailscale Serve(HTTPS,仅回环)

Bash
curl -fsSL https://tailscale.com/install.sh | sh
tailscale up

openclaw config set gateway.tailscale.mode serve
openclaw gateway restart

Open: ''https://<magicdns>/''

说明:

- Serve 保持 Gateway 仅回环访问,并通过 Tailscale 身份标头进行认证。

- 如果需要令牌/密码认证,请设置 ''gateway.auth.allowTailscale: false'' 或使用 ''gateway.auth.mode: "password"''。

选项 C:Tailnet 绑定(不使用 Serve)

Open: ''http://<tailscale-ip>:18789'' (token required).

Bash
openclaw config set gateway.bind tailnet
openclaw gateway restart

Open: ''http://<tailscale-ip>:18789'' (token required).

Tutorial.step

7)连接你的频道

#

Tutorial.step

Telegram

Bash
openclaw pairing list telegram
openclaw pairing approve telegram '<CODE>'

#

Tutorial.step

WhatsApp

Bash
openclaw channels login whatsapp

其他提供商请参阅 ''频道''。

Tutorial.step

持久化

所有状态存储在:

- ''~/.openclaw/'' — 配置、凭据、会话数据

- ''~/.openclaw/workspace/'' — 工作区(SOUL.md、内存等)

这些数据在重启后仍然存在。定期备份它们:

Bash
tar -czvf openclaw-backup.tar.gz ~/.openclaw ~/.openclaw/workspace

-- |

Tutorial.step

故障排除

#

Tutorial.step

Gateway 无法启动

Bash
openclaw gateway status
openclaw doctor --non-interactive
journalctl -u openclaw --no-pager -n 50

#

Tutorial.step

端口已被占用

Bash
lsof -i :18789
kill '<PID>'

#

Tutorial.step

内存不足

Bash
free -h

---

Tutorial.step

另请参阅

- ''Hetzner 指南'' — 更便宜、更强大

- ''Docker 安装'' — 容器化设置

- ''Tailscale'' — 安全远程访问

- ''配置'' — 完整配置参考