本教程将为您提供一份从零开始的 OpenClaw 安装指南。
OpenClaw是一个开源、可自托管的个人 AI 智能体,不仅能聊天,
更能执行文件操作、控制浏览器、发送邮件等自动化任务。
它支持在 Windows、macOS 和 Linux 系统上稳定运行。
我用的是windows11,所以安装都是在windows上进行的。

一、安装前准备:环境要求
在开始安装前,请确保系统满足以下基本要求:

软件:
Node:版本必须为 22 或更高。这是 OpenClaw 运行的核心依赖。
git:安装openclaw时要用的工具。

网络:需要能够正常访问 npm 仓库和 GitHub。(网络不行可使用Watt Toolkit软件)

验证安装:
node --version
npm --version。

二、安装 OpenClaw
以管理员身份运行 PowerShell

npm install -g openclaw@latest

安装时出现“无法加载文件 C:\Program Files\nodejs\npm.ps1”
解决方案:
更改执行策略:以管理员身份运行 在PowerShell 中输入以下命令,
Set-ExecutionPolicy RemoteSigned
然后输入 Y 确认。将执行策略更改为 RemoteSigned:

安装完成会自动进入初始配置向导

三、配置向导
安装完成后,首次运行需要进行初始配置。
也可以通过执行 openclaw onboard 命令来启动交互式向导。
根据提示进行以下选择,可以完成设置:

o 安全 -------------------------------------------------------------+
| 安全警告 — 请阅读。
|
| OpenClaw 是一个业余项目,仍处于测试阶段。可能会有粗糙之处。
| 如果启用了工具,此机器人可以读取文件并执行操作。
| 不良提示可能会诱使其执行不安全的操作。
|
| 如果您不熟悉基本的安全和访问控制,请不要运行 OpenClaw。
| 在启用工具或将系统暴露给互联网之前,请寻求有经验的人士帮助。
|
| 推荐的基础设置:
| - 配对/白名单 + @提及门控。
| - 沙箱 + 最低权限工具。
| - 将机密信息保留在智能体可访问的文件系统之外。
| - 对于使用工具或不受信任收件箱的机器人,请使用最强大的可用模型。
|
| 定期运行:
| openclaw-cn security audit --deep
| openclaw-cn security audit --fix
| |
| 必读: https://docs.openclaw.ai/gateway/security
±-------------------------------------------------------------------+

understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?

Yes

Onboarding mode

Manual (Configure port, network, Tailscale, and auth options.)

What do you want to set up?

Local gateway (this machine) (No gateway detected (ws://127.0.0.1:18789))

Workspace directory
C:\Users\ZYJ.openclaw\workspace

Model/auth provider

Custom Provider (Any OpenAI or Anthropic compatible endpoint)

API Base URL (注:OpenAI兼容,如:ollama、llmam.app等
http://127.0.0.1:11434/v1

How do you want to provide this API key?

Paste API key now (Stores the key directly in OpenClaw config)

API Key (leave blank if not required) (注:输入任意数字
1234567890

Endpoint compatibility

OpenAI-compatible (Uses /chat/completions)

Model ID (注:这要启动ollama,输入准确Model ID,才能通过Verification successful.)
qwen3.5:0.8b
Verification successful.

Endpoint ID
custom-127-0-0-1-11434

Model alias (optional)
Qwen3.5
Configured custom provider: custom-127-0-0-1-11434/Qwen3.5:0.8b

Gateway port
18789

Gateway bind

Loopback (127.0.0.1)

Gateway auth

Token (Recommended default (local + remote))

Tailscale exposure

Off (No Tailscale exposure)

How do you want to provide the gateway token?

Generate/store plaintext token (Default)

Gateway token (blank to generate)
Needed for multi-machine or non-loopback access

o Channel status ----------------------------+
|
| Telegram: needs token
| WhatsApp (default): not linked
| Discord: needs token
| Slack: needs tokens
| Signal: needs setup
| signal-cli: missing (signal-cli)
| iMessage: needs setup
| imsg: missing (imsg)
| IRC: not configured
| Google Chat: not configured
| LINE: not configured
| Feishu: install plugin to enable
| Google Chat: install plugin to enable
| Nostr: install plugin to enable
| Microsoft Teams: install plugin to enable
| Mattermost: install plugin to enable
| Nextcloud Talk: install plugin to enable
| Matrix: install plugin to enable
| BlueBubbles: install plugin to enable
| LINE: install plugin to enable
| Zalo: install plugin to enable
| Zalo Personal: install plugin to enable
| Synology Chat: install plugin to enable
| Tlon: install plugin to enable
|
±--------------------------------------------+

Configure chat channels now?

Yes

◇ How channels work ────────────────────────────────────────────────────────────

│ DM security: default is pairing; unknown DMs get a pairing code.
│ Approve with: openclaw pairing approve
│ Public DMs require dmPolicy=“open” + allowFrom=[“*”].
│ Multi-user DMs: run: openclaw config set session.dmScope “per-channel-peer” (or
│ “per-account-channel-peer” for multi-account channels) to isolate sessions.
│ Docs: channels/pairing

│ Telegram: simplest way to get started — register a bot with @BotFather and get
│ going.
│ WhatsApp: works with your own number; recommend a separate phone + eSIM.
│ Discord: very well supported right now.
│ IRC: classic IRC networks with DM/channel routing and pairing controls.
│ Google Chat: Google Workspace Chat app with HTTP webhook.
│ Slack: supported (Socket Mode).
│ Signal: signal-cli linked device; more setup (David Reagans: “Hop on
│ Discord.”).
│ iMessage: this is still a work in progress.
│ LINE: LINE Messaging API webhook bot.
│ Feishu: 飞书/Lark enterprise messaging with doc/wiki/drive tools.
│ Nostr: Decentralized protocol; encrypted DMs via NIP-04.
│ Microsoft Teams: Bot Framework; enterprise support.
│ Mattermost: self-hosted Slack-style chat; install the plugin to enable.
│ Nextcloud Talk: Self-hosted chat via Nextcloud Talk webhook bots.
│ Matrix: open protocol; install the plugin to enable.
│ BlueBubbles: iMessage via the BlueBubbles mac app + REST API.
│ Zalo: Vietnam-focused messaging platform with Bot API.
│ Zalo Personal: Zalo personal account via QR code login.
│ Synology Chat: Connect your Synology NAS Chat to OpenClaw with full agent
│ capabilities.
│ Tlon: decentralized messaging on Urbit; install the plugin to enable.

├───────────────────────────────────────────────────────────

Select a channel
Feishu/Lark (飞书)

Install Feishu plugin?
Use local plugin path
09:56:59 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: feishu (C:\Users\用户名\AppData\Roaming\npm\node_modules\openclaw\extensions\feishu\index.ts). Set plugins.allow to explicit trusted ids.

◇ Feishu credentials ────────────────────────────────────────────────────────────

│ 1) Go to Feishu Open Platform (open.feishu.cn)
│ 2) Create a self-built app
│ 3) Get App ID and App Secret from Credentials page
│ 4) Enable required permissions: im:message, im:chat, contact:user.base:readonly
│ 5) Publish the app or add it to a test group
│ Tip: you can also set FEISHU_APP_ID / FEISHU_APP_SECRET env vars.
│ Docs: feishu

├───────────────────────────────────────────────────────────

How do you want to provide this App Secret?
Enter App Secret

Enter Feishu App Secret (注:要到https://open.feishu.cn/app 注册获得)
hOcUZw**********suw1Nb71hK7GFeqi

Enter Feishu App ID
cli_a**********81cef
[info]: [ ‘client ready’ ]

◇ Feishu connection test ───────────────────────────╮

│ Connected as ou_3985d**********45f2e6b932c700c19

├────────────────────────────────────────────────────╯

Feishu connection mode
WebSocket (default)

Which Feishu domain?
Feishu (feishu.cn) - China

Group chat policy
Allowlist - only respond in specific groups

Group chat allowlist (chat_ids) (注:手机飞书端创建群聊,在设置时查看)
oc_46a957**********ad67937fc435b98b
[info]: [ ‘client ready’ ]

Select a channel
Finished

◇ Selected channels ──────────────────────────────────────────╮

│ Feishu — 飞书/Lark enterprise messaging. Docs:
│ feishu

├───────────────────────────────────────────────────────────

Configure DM access policies now? (default: pairing)
Yes

◇ Feishu DM access ────────────────────────────────────────────────────────────

│ Default: pairing (unknown DMs get a pairing code).
│ Approve: openclaw pairing approve feishu
│ Allowlist DMs: channels.feishu.dmPolicy=“allowlist” + channels.feishu.allowFrom
│ entries.
│ Public DMs: channels.feishu.dmPolicy=“open” + channels.feishu.allowFrom
│ includes “*”.
│ Multi-user DMs: run: openclaw config set session.dmScope “per-channel-peer” (or
│ “per-account-channel-peer” for multi-account channels) to isolate sessions.
│ Docs: channels/pairing

├───────────────────────────────────────────────────────────

Feishu DM policy
Pairing (recommended)
Updated ~.openclaw\openclaw.json
Workspace OK: ~.openclaw\workspace
Sessions OK: ~.openclaw\agents\main\sessions

◇ Web search ────────────────────────────────────────╮

│ Web search lets your agent look things up online.
│ Choose a provider and paste your API key.
│ Docs: https://docs.openclaw.ai/tools/web

├─────────────────────────────────────────────────────╯

Search provider
Kimi (Moonshot)

Kimi (Moonshot) API key (注:在https://platform.moonshot.cn/注册获得
sk-WMWtYmw1bA**********94GrwsFjOcAKpmMp062hPeeZtSrk

◇ Skills status ─────────────╮

│ Eligible: 7
│ Missing requirements: 40
│ Unsupported on this OS: 8
│ Blocked by allowlist: 0

├─────────────────────────────╯

Configure skills now? (recommended)
Yes

Install missing skill dependencies (注:按空格键一个一个选择,按回车进行安装
🔐 1password, 📰 blogwatcher, 🫐 blucli, 📸 camsnap, 🧩 clawhub, 🛌
eightctl, ✨ gemini, 🧲 gifgrep, 🐙 github, 🎮 gog, 📍 goplaces, 📧
himalaya, 📦 mcporter, 📄 nano-pdf, 💎 obsidian, 🎤 openai-whisper, 💡
openhue, 🧿 oracle, 🛵 ordercli, 🔊 sag, 🌊 songsee, 🔊 sonoscli, 🧾
summarize, 🎬 video-frames, 📱 wacli, 🐦 xurl

Preferred node manager for skill installs
npm
Install failed: xurl
Install failed: wacli
Install failed: video-frames
Install failed: summarize
Install failed: sonoscli
Install failed: songsee
Install failed: sag
Install failed: ordercli
Installed oracle
Install failed: openhue
Install failed: openai-whisper
Install failed: obsidian
Installed nano-pdf
Installed mcporter
Install failed: himalaya
Install failed: goplaces
Install failed: gog
Install failed: GitHub
Install failed: gifgrep
Install failed: gemini
Install failed: eightctl
Installed clawhub
Install failed: camsnap
Install failed: blucli
Install failed: blogwatcher
Install failed: 1password

Set GOOGLE_PLACES_API_KEY for goplaces?
No

Set GEMINI_API_KEY for nano-banana-pro?
No

Set NOTION_API_KEY for notion?
No

Set OPENAI_API_KEY for openai-image-gen?
No

Set OPENAI_API_KEY for openai-whisper-api?
No

Set ELEVENLABS_API_KEY for sag?
No

◇ Hooks ────────────────────────────────────────────────────────────

│ Hooks let you automate actions when agent commands are issued.
│ Example: Save session context to memory when you issue /new or /reset.

│ Learn more: https://docs.openclaw.ai/automation/hooks

├───────────────────────────────────────────────────────────

Enable hooks?
Skip for now

Config overwrite: C:\Users\用户名.openclaw\openclaw.json (sha256 64725e7a7d0132e208e101c2af5701be18c734bf9a087acb593106 -> 0576550df5b401c86c655592aad886b870bdcb7936b761f5f466b6, backup=C:\Users\用户名.openclaw\openclaw.json.bak)

Install Gateway service (recommended)
Yes

Gateway service runtime
Node (recommended)

◓ Installing Gateway service…
Installed Scheduled Task: OpenClaw Gateway
Task script: C:\Users\用户名.openclaw\gateway.cmd
Gateway service installed.

Health check failed: gateway closed (1006 abnormal closure (no close frame)): no close reason
Gateway target: ws://127.0.0.1:18789
Source: local loopback
Config: C:\Users\用户名.openclaw\openclaw.json
Bind: loopback

◇ Health check help ────────────────────────────────╮

│ Docs:
│ https://docs.openclaw.ai/gateway/health
│ https://docs.openclaw.ai/gateway/troubleshooting

├────────────────────────────────────────────────────╯

◇ Optional apps ────────────────────────╮

│ Add nodes for extra features:
│ - macOS app (system + notifications)
│ - iOS app (camera/canvas)
│ - Android app (camera/canvas)

├────────────────────────────────────────╯

◇ Control UI ────────────────────────────────────────────────────────────

│ Web UI: http://127.0.0.1:18789/
│ Web UI (with token):
│ http://127.0.0.1:18789/#token=348a38c95b2376**********b286b8e2d7f4d482f5a0678c
│ Gateway WS: ws://127.0.0.1:18789
│ Gateway: not detected (gateway closed (1006 abnormal closure (no close frame)):
│ no close reason)
│ Docs: https://docs.openclaw.ai/web/control-ui

├───────────────────────────────────────────────────────────

◇ Workspace backup ────────────────────────────────────────╮

│ Back up your agent workspace.
│ Docs: https://docs.openclaw.ai/concepts/agent-workspace

├───────────────────────────────────────────────────────────

◇ Security ──────────────────────────────────────────────────────╮

│ Running agents on your computer is risky — harden your setup:
│ https://docs.openclaw.ai/security

├───────────────────────────────────────────────────────────

◇ Dashboard ready ────────────────────────────────────────────────────────────

│ Dashboard link (with token):
│ http://127.0.0.1:18789/#token=348a38c95**********8fbc4b286b8e2d7f4d482f5a0678c
│ Opened in your browser. Keep that tab to control OpenClaw.

├───────────────────────────────────────────────────────────

◇ Web search ────────────────────────────────────────────────────────────

│ Web search is enabled, so your agent can look things up online when needed.

│ Provider: Kimi (Moonshot)
│ API key: stored in config.
│ Docs: https://docs.openclaw.ai/tools/web

├───────────────────────────────────────────────────────────

◇ What now ────────────────────────────────────────────────────────────

│ What now: https://openclaw.ai/showcase (“What People Are Building”).

├───────────────────────────────────────────────────────────

Onboarding complete. Dashboard opened; keep that tab to control OpenClaw.

四、启动与验证

启动 Web 控制台:
在终端中执行 openclaw dashboard 命令,浏览器会自动打开控制台页面(通常是 http://127.0.0.1:18789)。如果未自动打开,请手动访问该地址。

启动网关服务:
openclaw gateway
浏览器中访问控制台页面(通常是 http://127.0.0.1:18789

在聊天对话中:
请生成 memory.md 文件(这个重要的文件是缺失的,对话自动生成 )
我的名字叫zz,你的名字叫yy,请记录到相关文件。(会在user.md和identity.md中记录,很重要。)

确认一切正常:
openclaw doctor # check for config issues 检查配置问题

◇ State integrity ────────────────────────────────────────────────────╮

│ - OAuth dir not present (~.openclaw\credentials). Skipping create
│ because no WhatsApp/pairing channel config is active.

├───────────────────────────────────────────────────────────
~.openclaw>md credentials (注:解决方法)

◇ memory Search ────────────────────────────────────────────────────╮


│ Verify: openclaw memory status --deep
├───────────────────────────────────────────────────────────
注:解决方法(配置 node-llama-cpp + 本地 GGUF 模型)
安装:npm install -g node-llama-cpp
安装 sqlite-vec 包: npm install -g sqlite-vec
下载嵌入模型:all-MiniLM-L6-v2.gguf
配置命令:(openclaw.json 注:一定要使用自己系统的路径名称,确认文件都存在)
openclaw config set agents.defaults.memorySearch.provider local
openclaw config set agents.defaults.memorySearch.local.modelPath “C:\Users\用户名.openclaw\all-MiniLM-L6-v2.gguf”
openclaw config set agents.defaults.memorySearch.store.vector.enabled true
openclaw config set agents.defaults.memorySearch.store.vector.extensionPath “C:\Users\用户名\AppData\Roaming\npm\node_modules\sqlite-vec\node_modules\sqlite-vec-windows-x64\vec0.dll”
openclaw config set agents.defaults.memorySearch.fallback none
openclaw config set agents.defaults.memorySearch.sources ‘[“memory”, “sessions”]’ (不成功的话,openclaw.json文件中手动输入)

~.openclaw\workspace>md memory (注:解决方法)

o Security ---------------------------------+
|
| - No channel security warnings detected.
| - Run: openclaw security audit --deep
|
±-------------------------------------------+
使用openclaw security audit --deep 会显示Summary: 1 critical · 2 warn · 1 info
这个没很大影响,一时也解决不了。

openclaw gateway stop 网关关闭
openclaw gateway restart 网关重启
openclaw status # gateway status 网关状态
openclaw dashboard # open the browser UI 打开浏览器UI

五、后续配置:

接下来,还要安装各种技能(Skills)来扩展其功能,或配置飞书、Telegram 等消息渠道,
才能 AI 助手融入您的日常工作流。

Logo

小龙虾开发者社区是 CSDN 旗下专注 OpenClaw 生态的官方阵地,聚焦技能开发、插件实践与部署教程,为开发者提供可直接落地的方案、工具与交流平台,助力高效构建与落地 AI 应用

更多推荐