本文档提供了 OpenClaw 汉化版的详细安装和配置指南,帮助你从零开始搭建和使用这个强大的 AI 工具。
OpenClaw 要求 Node.js >= 22.12.0。
node -v
# 应输出 v22.x.x 或更高 curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs # 安装 nvm(如果还没有)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# 国内用户如果下载慢,使用镜像:
export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node
nvm install 22
nvm use 22 node -v # 应显示 v22.x.x
npm -v # 应显示 10.x.x npm install -g @qingchencloud/openclaw-zh@latest 如果下载慢,加上淘宝镜像源:
npm install -g @qingchencloud/openclaw-zh@latest --registry=https://registry.npmmirror.com openclaw --version
# 应输出类似:2026.2.4-zh.1
openclaw --help
# 应显示中文帮助信息 如果提示 openclaw: command not found,需要将 npm 全局路径加入 PATH:
# 查看 npm 全局路径
npm prefix -g
# 将输出的路径/bin 加入你的 shell 配置文件(~/.bashrc 或 ~/.zshrc)
export PATH="$(npm prefix -g)/bin:$PATH" openclaw onboard 向导会引导你完成以下配置:
如果你已经有 API Key,想跳过向导直接配置:
# 第1步:创建基础配置
openclaw setup
# 第2步:设置网关模式
openclaw config set gateway.mode local
# 第3步:设置 AI 模型和 API Key(以 Claude 为例)
openclaw config set agents.defaults.model anthropic/claude-sonnet-4-20250514
openclaw config set auth.anthropic.apiKey sk-ant-你的API密钥
# 第4步:设置网关认证(推荐)
openclaw config set gateway.auth.token 你设定的密码 # 方式1:前台运行(可以看到实时日志,按 Ctrl+C 停止)
openclaw
# 方式2:安装为守护进程(后台运行,开机自启)
openclaw onboard --install-daemon openclaw dashboard 这会自动在浏览器中打开带 Token 的 Dashboard 页面。如果浏览器没有自动打开,手动访问:http://localhost:18789
# 查看网关状态
openclaw status
# 运行诊断(检查配置是否正确)
openclaw doctor 默认情况下只能在本机通过 localhost 访问。如果想让内网其他设备也能访问:
# 绑定到局域网
openclaw config set gateway.bind lan
# 设置访问密码(必须)
openclaw config set gateway.auth.token 你的密码
# 重启生效
openclaw gateway restart 然后在其他设备上访问 http://你的IP:18789,在「网关令牌」输入框填入密码。
# 添加 Telegram
openclaw channels add telegram
# 按提示输入 Bot Token
# 添加 WhatsApp
openclaw channels add whatsapp
# 扫描二维码连接