GEO

如何3分钟本地安装OpenClaw Agent?2026年最新分步教程

2026/3/5
如何3分钟本地安装OpenClaw Agent?2026年最新分步教程
AI Summary (BLUF)

This guide provides a comprehensive, step-by-step tutorial for quickly installing and running the OpenClaw Agent on a local machine within 3 minutes, covering system requirements, installation methods (including recommended installer and source code compilation), configuration for Chinese users, and a practical first task demonstration.

原文翻译: 本指南提供了全面的分步教程,帮助用户在3分钟内在本地机器上快速安装并运行OpenClaw Agent,涵盖系统要求、安装方法(包括推荐的安装器和源代码编译)、针对中国用户的配置以及一个实用的首个任务演示。

引言

欢迎来到 OpenClaw 中国社区。本指南旨在帮助您在几分钟内,于本地计算机上成功部署并运行一个纯净、安全的 OpenClaw Agent。无论您是希望快速体验其核心功能,还是准备进行深度开发,本文都将提供清晰的步骤指引。

Welcome to the OpenClaw China Community. This guide is designed to help you successfully deploy and run a clean, secure OpenClaw Agent on your local computer within minutes. Whether you want to quickly experience its core features or prepare for in-depth development, this article will provide clear step-by-step instructions.

系统要求

在开始安装之前,请确保您的开发环境满足以下最低要求。

Before starting the installation, please ensure your development environment meets the following minimum requirements.

  • Node.js >= 22 (下载 Node.js v22)
  • 操作系统: macOS, Linux,或通过 WSL2 运行的 Windows (推荐 Ubuntu 发行版)
    • macOS: 如果您计划进行应用构建,请安装 Xcode 或 Command Line Tools。若仅使用 CLI 和 Gateway 网关功能,则 Node.js 环境已足够。
    • Windows: 强烈推荐使用 WSL2。原生 Windows 环境未经充分测试,可能遇到较多问题且工具链兼容性较差。
  • Node.js >= 22 (Download Node.js v22)
  • Operating System: macOS, Linux, or Windows via WSL2 (Ubuntu distribution recommended)
    • macOS: If you plan to build applications, install Xcode or Command Line Tools. For CLI and Gateway functionality only, the Node.js environment is sufficient.
    • Windows: WSL2 is strongly recommended. The native Windows environment is not fully tested and may encounter more issues with poorer toolchain compatibility.

快速安装(推荐)

对于大多数用户,我们推荐使用官方安装脚本,它能自动设置命令行工具并运行新手引导流程。

For most users, we recommend using the official installation script, which automatically sets up the command-line tool and runs the onboarding process.

适用于 macOS、Linux 及 WSL2

在终端中执行以下命令:

Execute the following command in your terminal:

curl -fsSL https://open-claw.org.cn/install-cn.sh | bash

适用于 Windows (PowerShell)

请注意,安装脚本在原生 Windows 环境下不会自动安装 Git,需要您手动先行安装。

Please note that the installation script does not automatically install Git in the native Windows environment; you need to install it manually first.

以管理员身份运行 PowerShell,然后执行:

Run PowerShell as Administrator, then execute:

iwr -useb https://open-claw.org.cn/install-cn.ps1 | iex

从源代码安装(开发者/贡献者)

OpenClaw CN 集成了最新的底层安全机制与现代化构建工具链。若您选择从源代码构建,请严格遵循以下环境配置。

OpenClaw CN integrates the latest underlying security mechanisms and a modern build toolchain. If you choose to build from source, please strictly follow the environment configuration below.

  • Node.js: 必须 >= v22.0.0 (下载 Node.js v22)
  • 包管理器: 强制推荐使用 pnpm。使用 npm 在处理复杂依赖树时可能导致进程卡死。
  • Git: 用于克隆代码仓库 (下载 Git)
  • Node.js: Must be >= v22.0.0 (Download Node.js v22)
  • Package Manager: pnpm is strongly enforced. Using npm may cause the process to hang when handling complex dependency trees.
  • Git: For cloning the code repository (Download Git)

步骤 0: 安装 pnpm

如果您尚未安装 pnpm,请首先全局安装它。

If you haven't installed pnpm yet, please install it globally first.

npm install -g pnpm

步骤 1: 克隆代码仓库

为确保国内用户的最佳下载速度,请从 Gitee 镜像仓库克隆代码。我们推荐切换到最新的稳定版本分支以获得最可靠的体验。

To ensure the best download speed for users in China, please clone the code from the Gitee mirror repository. We recommend switching to the latest stable release branch for the most reliable experience.

# 1. 克隆仓库
git clone https://gitee.com/OpenClaw-CN/openclaw-cn.git
cd openclaw-cn

步骤 2: 配置国内镜像源(关键步骤!)

在安装项目依赖之前,务必pnpm 设置国内镜像源,否则依赖下载速度将极其缓慢。

Before installing project dependencies, it is essential to set up a domestic mirror source for pnpm; otherwise, dependency download speeds will be extremely slow.

pnpm config set registry https://registry.npmmirror.com/

步骤 3: 安装依赖与项目构建

OpenClaw 是一个现代化的全栈应用。首次运行需要编译前端用户界面和后端核心服务。

OpenClaw is a modern full-stack application. The first run requires compiling both the frontend user interface and the backend core services.

# 安装项目依赖 (配置镜像后速度飞快 🚀)
pnpm install

# 构建前端界面 (首次运行时会自动安装 UI 相关依赖)
pnpm ui:build

# 构建核心服务
pnpm build

💡 提示: 由于这是在项目本地而非全局安装,后续所有 OpenClaw 命令都需要通过 pnpm openclaw ... 的形式运行。

💡 Note: Since this is a local project installation rather than a global one, all subsequent OpenClaw commands need to be run via pnpm openclaw ....

步骤 4: 运行初始化向导

我们提供了一个交互式初始化工具,可以帮您一键完成 DeepSeek 模型的配置。

We provide an interactive initialization tool that can help you complete the configuration for the DeepSeek model with one click.

pnpm openclaw onboard --install-daemon

💡 提示: 在向导的 Select Provider 步骤中,请直接选择 DeepSeek,系统将自动完成所有必要的配置。

💡 Note: During the Select Provider step in the wizard, please directly select DeepSeek. The system will automatically complete all necessary configurations.

步骤 5: 启动服务

初始化完成后,您可以使用以下命令启动网关服务(假设网关当前已停止)。

After initialization is complete, you can use the following commands to start the gateway service (assuming the gateway is currently stopped).

# 启动网关 (Gateway)
pnpm openclaw gateway

如果您关闭了 Web 管理页面,可以通过以下命令重新打开。

If you have closed the web management dashboard, you can reopen it with the following command.

# 打开仪表板 (Dashboard)
pnpm openclaw dashboard

安装后验证

成功安装后,您可以使用以下命令进行基本验证和状态检查。

After successful installation, you can use the following commands for basic verification and status checks.

  • 快速环境检查: openclaw doctor
  • 检查网关健康状态: openclaw statusopenclaw health
  • 打开管理仪表板: openclaw dashboard
  • Quick Environment Check: openclaw doctor
  • Check Gateway Health: openclaw status and openclaw health
  • Open Management Dashboard: openclaw dashboard

您的第一个任务

当 Agent 成功启动后,您可以进入管理面板或使用交互式命令行,尝试下达第一个指令,体验其自动化执行能力。

Once the Agent is successfully started, you can enter the management panel or use the interactive command line to try issuing your first command and experience its automated execution capabilities.

"请帮我在桌面上创建一个名为 hello_openclaw.txt 的文件,并在里面写入:大道至简,实战落地。"

Agent 将自动解析该任务,进行规划,调用相应的文件系统 API,并最终完成文件创建与内容写入的操作。

The Agent will automatically parse this task, plan it, call the corresponding filesystem API, and ultimately complete the file creation and content writing operation.

← 返回文章列表
分享到:微博

版权与免责声明:本文仅用于信息分享与交流,不构成任何形式的法律、投资、医疗或其他专业建议,也不构成对任何结果的承诺或保证。

文中提及的商标、品牌、Logo、产品名称及相关图片/素材,其权利归各自合法权利人所有。本站内容可能基于公开资料整理,亦可能使用 AI 辅助生成或润色;我们尽力确保准确与合规,但不保证完整性、时效性与适用性,请读者自行甄别并以官方信息为准。

若本文内容或素材涉嫌侵权、隐私不当或存在错误,请相关权利人/当事人联系本站,我们将及时核实并采取删除、修正或下架等处理措施。 也请勿在评论或联系信息中提交身份证号、手机号、住址等个人敏感信息。