跳轉到主要內容

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 分鐘

設定

1

建立 Droplet

使用乾淨的基礎映像(Ubuntu 24.04 LTS)。除非你已檢閱第三方 Marketplace 一鍵式映像的啟動指令碼與防火牆預設值,否則請避免使用。
  1. 登入 DigitalOcean
  2. 按一下 Create > Droplets
  3. 選擇:
    • 區域: 最接近你的區域
    • 映像: Ubuntu 24.04 LTS
    • 大小: Basic、Regular、1 vCPU / 1 GB RAM / 25 GB SSD
    • 驗證: SSH 金鑰(建議)或密碼
  4. 按一下 Create Droplet 並記下 IP 位址。
2

連線並安裝

ssh root@YOUR_DROPLET_IP

apt update && apt upgrade -y

# Install Node.js 24
curl -fsSL https://deb.nodesource.com/setup_24.x | bash -
apt install -y nodejs

# Install OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
openclaw --version
3

執行入門設定

openclaw onboard --install-daemon
精靈會引導你完成模型驗證、通道設定、Gateway 權杖產生,以及 daemon 安裝(systemd)。
4

新增 swap(建議 1 GB Droplet 使用)

fallocate -l 2G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
5

驗證 Gateway

openclaw status
systemctl --user status openclaw-gateway.service
journalctl --user -u openclaw-gateway.service -f
6

存取 Control UI

Gateway 預設會繫結到 loopback。選擇下列其中一個選項。選項 A:SSH tunnel(最簡單)
# From your local machine
ssh -L 18789:localhost:18789 root@YOUR_DROPLET_IP
然後開啟 http://localhost:18789選項 B:Tailscale Serve
curl -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(需要權杖)。

疑難排解

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 保持最新狀態

相關