跳转到内容

Oracle Cloud

在 Oracle Cloud 的 Always Free ARM 层(最多 4 个 OCPU,24 GB 内存,200 GB 存储)上免费运行持久的 OpenClaw Gateway(网关)。

  1. 创建 OCI 实例

    1. 登录到 Oracle Cloud Console
    2. 导航到 Compute > Instances > Create Instance
    3. 配置:
      • Name: openclaw
      • Image: Ubuntu 24.04 (aarch64)
      • Shape: VM.Standard.A1.Flex (Ampere ARM)
      • OCPUs: 2(或最多 4 个)
      • Memory: 12 GB(或最多 24 GB)
      • Boot volume: 50 GB(最多 200 GB 免费)
      • SSH key: 添加您的公钥
    4. 点击 Create 并记下公共 IP 地址。
  2. 连接并更新系统

    Terminal window
    ssh ubuntu@YOUR_PUBLIC_IP
    sudo apt update && sudo apt upgrade -y
    sudo apt install -y build-essential

    build-essential 是某些依赖项进行 ARM 编译所必需的。

  3. 配置用户和主机名

    Terminal window
    sudo hostnamectl set-hostname openclaw
    sudo passwd ubuntu
    sudo loginctl enable-linger ubuntu

    启用 linger 可以在注销后保持用户服务运行。

  4. 安装 Tailscale

    Terminal window
    curl -fsSL https://tailscale.com/install.sh | sh
    sudo tailscale up --ssh --hostname=openclaw

    从现在起,通过 Tailscale 连接:ssh ubuntu@openclaw

  5. 安装 OpenClaw

    Terminal window
    curl -fsSL https://openclaw.ai/install.sh | bash
    source ~/.bashrc

    当系统提示“How do you want to hatch your bot?”时,选择 Do this later

  6. 配置 Gateway(网关)

    结合 Tailscale Serve 使用令牌认证,以确保安全远程访问。

    Terminal window
    openclaw config set gateway.bind loopback
    openclaw config set gateway.auth.mode token
    openclaw doctor --generate-gateway-token
    openclaw config set gateway.tailscale.mode serve
    openclaw config set gateway.trustedProxies '["127.0.0.1"]'
    systemctl --user restart openclaw-gateway
  7. 锁定 VCN 安全性

    在网络边缘拦截除 Tailscale 以外的所有流量:

    1. 在 OCI 控制台中,前往 Networking > Virtual Cloud Networks
    2. 点击您的 VCN,然后点击 Security Lists > Default Security List
    3. 移除0.0.0.0/0 UDP 41641 (Tailscale) 之外的所有入站规则。
    4. 保留默认的出站规则(允许所有出站流量)。

    这将在网络边缘阻止 22 端口上的 SSH、HTTP、HTTPS 以及其他所有流量。从此时起,您只能通过 Tailscale 进行连接。

  8. 验证

    Terminal window
    openclaw --version
    systemctl --user status openclaw-gateway
    tailscale serve status
    curl http://localhost:18789

    从您 tailnet 中的任何设备访问控制 UI:

    https://openclaw.

    .ts.net/ ```

    将 `

    替换为您的 tailnet 名称(可在tailscale status` 中看到)。

如果 Tailscale Serve 无法正常工作,请从您的本地计算机使用 SSH 隧道:

Terminal window
ssh -L 18789:127.0.0.1:18789 ubuntu@openclaw

然后打开 http://localhost:18789

实例创建失败(“Out of capacity”) — 免费套餐的 ARM 实例非常受欢迎。请尝试不同的可用性域,或在非高峰时段重试。

Tailscale 无法连接 — 运行 sudo tailscale up --ssh --hostname=openclaw --reset 以重新进行身份验证。

Gateway(网关) 无法启动 — 运行 openclaw doctor --non-interactive 并使用 journalctl --user -u openclaw-gateway -n 50 检查日志。

ARM 二进制文件问题 — 大多数 npm 包都可以在 ARM64 上运行。对于原生二进制文件,请查找 linux-arm64aarch64 版本。使用 uname -m 验证架构。