OpenClaw 安装部署完全指南:快速搭建你的自托管 AI 网关
OpenClaw 是一个功能强大且灵活的自托管 AI 网关。打开 http://127.0.0.1:18789配置文件:~/.openclaw/openclaw.json日志目录:~/.openclaw/logs/数据目录:~/.openclaw/data/官方文档:https://docs.openclaw.ai快速入门:https://docs.openclaw.ai/start/gettin
OpenClaw 安装部署完全指南:快速搭建你的自托管 AI 网关
OpenClaw 是一个强大的自托管 AI 网关,支持连接 WhatsApp、Telegram、Discord、Slack 等多种聊天应用到 AI 助手。本文将详细介绍如何在各种环境下安装和部署 OpenClaw。
📋 目录
- 系统要求
- 安装方法
- 快速部署步骤
- 配置方式
- 服务管理
- Docker 部署
- 远程访问
- 安全配置
- Channels 配置
- 故障排查
- 总结
1. 系统要求
在开始安装之前,先确认你的环境满足以下要求:
| 项目 | 要求 |
|---|---|
| Node.js | 推荐 Node 24(或 Node 22 LTS 22.16+) |
| 操作系统 | macOS、Linux、Windows(推荐 WSL2) |
| 内存 | Docker 部署至少 2GB RAM |
| 磁盘空间 | 至少 500MB 可用空间 |
2. 安装方法
OpenClaw 提供多种安装方式。
2.1 推荐:安装脚本(最简方式)
Linux/macOS:
curl -fsSL https://get.openclaw.ai | bash
Windows(PowerShell):
irm https://get.openclaw.ai | iex
2.2 备选:npm/pnpm 全局安装
npm install -g openclaw
pnpm add -g openclaw
2.3 开发者:从源码构建
git clone https://github.com/openclawdev/openclaw.git
cd openclaw
npm install
npm run build
npm link
3. 快速部署步骤
3.1 运行 Onboarding 向导
openclaw onboard
3.2 启动 Gateway
openclaw gateway start
3.3 打开 Control UI
- 默认端口:18789
- 访问地址:http://127.0.0.1:18789
4. 配置方式
4.1 交互式向导
openclaw onboard
openclaw configure
4.2 CLI 命令
openclaw config get gateway.port
openclaw config set gateway.port 18789
4.3 直接编辑配置文件
配置存储在 ~/.openclaw/openclaw.json
5. 服务管理
5.1 macOS:launchd
openclaw gateway install
openclaw gateway start
openclaw gateway stop
5.2 Linux:systemd
openclaw gateway install
systemctl --user enable openclaw
systemctl --user start openclaw
systemctl --user status openclaw
6. Docker 部署
6.1 快速启动
git clone https://github.com/openclawdev/docker-setup.git
cd docker-setup
./docker-setup.sh
6.2 手动部署
docker pull openclaw/openclaw:latest
docker run -d --name openclaw -p 18789:18789 -v ~/.openclaw:/root/.openclaw openclaw/openclaw:latest
6.3 Docker Compose
version: ‘3.8’
services:
openclaw:
image: openclaw/openclaw:latest
ports:
- “18789:18789”
volumes:
- ./openclaw:/root/.openclaw
restart: unless-stopped
docker-compose up -d
7. 远程访问
7.1 首选:Tailscale/VPN
curl -fsSL https://tailscale.com/install.sh | sh
tailscale up
7.2 备选:SSH 隧道
ssh -L 18789:localhost:18789 user@your-server
7.3 修改绑定地址
openclaw config set gateway.bind “0.0.0.0”
8. 安全配置
8.1 Token 认证
openclaw config set auth.token “your-secure-token”
8.2 DM 策略
openclaw config set security.dm_strategy “pairing”
openclaw config set security.dm_strategy “allowlist”
openclaw config set security.dm_strategy “open”
openclaw config set security.dm_strategy “disabled”
8.3 群组提及 Gating
openclaw config set security.group_mention_gating true
9. Channels 配置
支持的平台:WhatsApp、Telegram、Discord、Slack、Signal、iMessage、Google Chat、Mattermost、MS Teams
配对登录:
openclaw channels login whatsapp
openclaw channels login telegram
openclaw channels login discord
openclaw channels login slack
10. 故障排查
10.1 健康检查
openclaw doctor
10.2 查看日志
openclaw logs --follow
openclaw logs --lines 100
openclaw logs --level error
10.3 检查服务状态
openclaw gateway status
总结
OpenClaw 是一个功能强大且灵活的自托管 AI 网关。
快速开始:
- curl -fsSL https://get.openclaw.ai | bash
- openclaw onboard
- openclaw gateway start
- 打开 http://127.0.0.1:18789
关键配置位置:
- 配置文件:~/.openclaw/openclaw.json
- 日志目录:~/.openclaw/logs/
- 数据目录:~/.openclaw/data/
更多资源:
- 官方文档:https://docs.openclaw.ai
- 快速入门:https://docs.openclaw.ai/start/getting-started
- Docker 部署:https://docs.openclaw.ai/install/docker
祝您部署顺利!
更多推荐




所有评论(0)