OpenClaw 汉化版安装指南

本文档提供了 OpenClaw 汉化版的详细安装和配置指南,帮助你从零开始搭建和使用这个强大的 AI 工具。

前提条件

1. 安装 Node.js

OpenClaw 要求 Node.js >= 22.12.0。

检查是否已安装:

node -v
# 应输出 v22.x.x 或更高

系统推荐安装方式:

  • Windows:访问 nodejs.org 下载 LTS 版本安装包
  • macOS:brew install node@22 或访问 nodejs.org
  • Ubuntu / Debian:使用命令安装
  • CentOS / RHEL:使用命令安装

Ubuntu / Debian 安装 Node.js 22:

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

使用 nvm 安装(适用于所有系统):

# 安装 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

2. 验证环境

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"

第二阶段:初始化配置

方式 A:交互式向导(推荐新手)

openclaw onboard

向导会引导你完成以下配置:

  • 步骤1:安全风险确认(输入 y 确认)
  • 步骤2:选择 AI 模型提供商(Anthropic Claude、OpenAI GPT、本地模型等)
  • 步骤3:输入 API Key
  • 步骤4:选择默认模型
  • 步骤5:配置网关(端口、认证方式)
  • 步骤6:配置聊天通道(可跳过)
  • 步骤7:安装技能(可跳过)
  • 步骤8:完成!

方式 B:快速非交互式初始化

如果你已经有 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
# 扫描二维码连接