平台与环境兼容(按官方 Platforms/Install)
官方推荐
- Gateway 推荐 Node 运行时。
- Windows 建议通过 WSL2 运行 Gateway。
- Bun 属于实验路径,不作为 Gateway 主推荐运行时。
参考:
- https://docs.openclaw.ai/platforms/index.md
- https://docs.openclaw.ai/install/index.md
- https://docs.openclaw.ai/install/bun.md
平台支持矩阵
桌面平台
| 平台 | 支持级别 | 运行时 | 备注 |
|---|---|---|---|
| macOS (Intel) | ✅ 完全支持 | Node 22+ | 推荐 |
| macOS (Apple Silicon) | ✅ 完全支持 | Node 22+ | 推荐 |
| Linux (x64) | ✅ 完全支持 | Node 22+ | 推荐 |
| Linux (ARM64) | ✅ 完全支持 | Node 22+ | 推荐 |
| Windows | ⚠️ 通过 WSL2 | Node 22+ | 需要 WSL2 |
移动平台(Client)
| 平台 | 支持级别 | 功能 | 备注 |
|---|---|---|---|
| iOS | ✅ 支持 | 远程控制 | 通过 OpenClaw iOS App |
| Android | ✅ 支持 | 远程控制 | 通过 OpenClaw Android App |
云平台
| 平台 | 支持级别 | 部署方式 | 备注 |
|---|---|---|---|
| Fly.io | ✅ 官方支持 | Docker | 推荐 |
| GCP | ✅ 支持 | Docker/VM | Compute Engine |
| AWS | ✅ 支持 | Docker/VM | EC2, ECS |
| Azure | ✅ 支持 | Docker/VM | Virtual Machines |
| Hetzner | ✅ 支持 | Docker/VM | 性价比高 |
| Railway | ✅ 支持 | Docker | 简单部署 |
| Render | ✅ 支持 | Docker | 免费层可用 |
| Northflank | ✅ 支持 | Docker | 企业友好 |
平台文档入口
桌面平台
- macOS:https://docs.openclaw.ai/platforms/macos.md
- Linux:https://docs.openclaw.ai/platforms/linux.md
- Windows (WSL2):https://docs.openclaw.ai/platforms/windows.md
移动平台
云平台
- Fly.io:https://docs.openclaw.ai/install/fly.md
- GCP:https://docs.openclaw.ai/install/gcp.md
- Hetzner:https://docs.openclaw.ai/install/hetzner.md
- Railway:https://docs.openclaw.ai/install/railway.md
- Render:https://docs.openclaw.ai/install/render.md
- Northflank:https://docs.openclaw.ai/install/northflank.md
部署形态建议
本地开发
yaml
形态: 单机 Gateway + Dashboard
优点: 快速迭代、调试方便
缺点: 无高可用、需要本地维护
适用场景:
- 个人开发
- 功能测试
- 学习探索团队试点
yaml
形态: VPS Gateway + Tailscale/SSH 隧道
优点: 团队共享、成本可控
缺点: 单点故障、需要运维
适用场景:
- 小团队(< 10 人)
- 试点阶段
- 成本敏感生产稳定
yaml
形态: 独立主机 + 独立配置 + 明确安全边界
优点: 高可用、安全可控
缺点: 成本较高、运维复杂
适用场景:
- 生产环境
- 团队(> 10 人)
- 合规要求平台特定配置
macOS 配置
bash
# 安装 Node.js(推荐使用 nvm)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 22
nvm use 22
# 安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
# 配置 launchd 服务
openclaw onboard --install-daemon
# 管理服务
launchctl start com.openclaw.gateway
launchctl stop com.openclaw.gatewayLinux 配置
bash
# 安装 Node.js(Ubuntu/Debian)
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# 安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
# 配置 systemd 服务
openclaw onboard --install-daemon
# 管理服务
sudo systemctl start openclaw-gateway
sudo systemctl stop openclaw-gateway
sudo systemctl status openclaw-gatewayWindows (WSL2) 配置
bash
# 安装 WSL2(PowerShell 管理员)
wsl --install -d Ubuntu
# 进入 WSL2
wsl
# 安装 Node.js
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# 安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash
# 注意:Windows 下服务管理需要手动配置
# 建议使用 screen 或 tmux 保持后台运行Docker 配置
bash
# 使用官方镜像
docker pull openclaw/openclaw:latest
# 创建配置目录
mkdir -p ~/.openclaw
# 运行容器
docker run -d \
--name openclaw \
--restart unless-stopped \
-p 18789:18789 \
-v ~/.openclaw:/root/.openclaw \
-e OPENCLAW_GATEWAY_AUTH_TOKEN=your-secure-token \
openclaw/openclaw:latest
# 查看日志
docker logs -f openclaw
# 进入容器
docker exec -it openclaw /bin/shDocker Compose 配置
yaml
# docker-compose.yaml
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- '18789:18789'
volumes:
- ~/.openclaw:/root/.openclaw
environment:
- OPENCLAW_GATEWAY_AUTH_TOKEN=${OPENCLAW_GATEWAY_TOKEN}
- OPENCLAW_LOG_LEVEL=info
healthcheck:
test: [CMD, openclaw, health]
interval: 30s
timeout: 10s
retries: 3服务安装方式
系统服务(推荐)
bash
# 安装为系统服务
openclaw onboard --install-daemon
# 或手动安装
openclaw gateway install
# 管理服务
# macOS (launchd)
launchctl start com.openclaw.gateway
# Linux (systemd)
sudo systemctl start openclaw-gateway手动运行
bash
# 前台运行(调试用)
openclaw gateway --verbose
# 后台运行(nohup)
nohup openclaw gateway > openclaw.log 2>&1 &
# 使用 screen
screen -dmS openclaw openclaw gateway
# 使用 tmux
tmux new -d -s openclaw "openclaw gateway"云平台快速部署
Fly.io
bash
# 安装 flyctl
curl -L https://fly.io/install.sh | sh
# 登录
fly auth login
# 创建应用
fly apps create openclaw
# 部署
fly deploy
# 查看状态
fly statusRailway
bash
# 安装 Railway CLI
npm install -g @railway/cli
# 登录
railway login
# 初始化项目
railway init
# 部署
railway up
# 查看日志
railway logsRender
- 连接 GitHub 仓库
- 选择 Docker 环境
- 设置环境变量
- 部署
环境变量参考
bash
# 核心配置
OPENCLAW_HOME=~/.openclaw
OPENCLAW_CONFIG_PATH=~/.openclaw/config.yaml
OPENCLAW_STATE_DIR=~/.openclaw/state
# 网关配置
OPENCLAW_GATEWAY_HOST=127.0.0.1
OPENCLAW_GATEWAY_PORT=18789
OPENCLAW_GATEWAY_AUTH_TOKEN=your-secure-token
# 日志配置
OPENCLAW_LOG_LEVEL=info
OPENCLAW_LOG_FORMAT=json
# Provider 配置
OPENAI_API_KEY=sk-xxx
ANTHROPIC_API_KEY=sk-ant-xxx
# 渠道配置
DISCORD_BOT_TOKEN=xxx
TELEGRAM_BOT_TOKEN=xxx
SLACK_APP_TOKEN=xoxp-xxx
SLACK_BOT_TOKEN=xoxb-xxx