@@ -280,11 +280,13 @@ openclaw uninstall
280280
281281> 🪟 ** Windows用户** :完全可用,但部分系统集成功能受限。
282282
283+ ![ Windows部署示意图] ( https://upload.maynor1024.live/file/1770963301031_attachment_531c0e90-e8a2-469c-b6ec-b9811a55edfa_image.png )
284+
283285### 系统要求
284286
285287** 硬件要求** :
286288- CPU:2核以上
287- - 内存:4GB以上
289+ - 内存:4GB以上(推荐8GB)
288290- 硬盘:10GB以上空闲空间
289291
290292** 操作系统** :
@@ -293,39 +295,285 @@ openclaw uninstall
293295** 前置软件** :
294296- Node.js 22.0.0+
295297
296- ### 安装步骤
298+ ### 部署方式选择
297299
298- #### 第一步:安装Node.js
300+ Windows有两种部署方式:
299301
300- 1 . 访问Node.js官网:https://nodejs.org/
301- 2 . 下载Windows安装包(22.x LTS版本)
302- 3 . 运行安装程序
303- 4 . 验证安装:
304- ``` cmd
305- node --version
306- ```
302+ 1 . ** WSL2 + Ubuntu(强烈推荐)** :官方推荐方式,提供完整Linux环境支持
303+ 2 . ** PowerShell原生部署** :纯Windows环境,适合不想使用WSL2的用户
307304
308- #### 第二步:安装OpenClaw
305+ ---
306+
307+ ### 方式一:WSL2 + Ubuntu部署(强烈推荐)
308+
309+ 这是官方推荐的Windows部署方式,提供最完整的Linux环境支持。
310+
311+ #### 第一步:启用WSL2
309312
310- 使用PowerShell运行 :
313+ ** 以管理员身份打开PowerShell ** ,执行 :
311314
312315``` powershell
313- irm https://openclaw.ai/install.ps1 | iex
316+ # 启用WSL功能
317+ dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
318+ dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
319+
320+ # 设置WSL 2为默认版本
321+ wsl --set-default-version 2
314322```
315323
316- #### 第三步:验证安装
324+ ** 重启计算机** 。
325+
326+ #### 第二步:安装Ubuntu
327+
328+ ** 方法一:Microsoft Store安装(推荐)**
329+
330+ 1 . 打开Microsoft Store
331+ 2 . 搜索「Ubuntu 22.04 LTS」或「Ubuntu 24.04 LTS」
332+ 3 . 点击「获取」并安装
333+ 4 . 首次启动设置用户名和密码
334+
335+ 安装完成后会自动打开Ubuntu终端,按提示设置用户名和密码。
336+
337+ #### 第三步:更新Ubuntu系统
338+
339+ 在Ubuntu终端中执行:
340+
341+ ``` bash
342+ # 更新软件包列表
343+ sudo apt update && sudo apt upgrade -y
344+
345+ # 安装基础工具
346+ sudo apt install -y curl git wget build-essential
347+ ```
348+
349+ #### 第四步:安装Node.js 22+
350+
351+ ``` bash
352+ # 添加NodeSource仓库
353+ curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
354+
355+ # 安装Node.js
356+ sudo apt install -y nodejs
357+
358+ # 验证版本(必须≥22.x)
359+ node -v
360+ npm -v
361+ ```
362+
363+ #### 第五步:安装OpenClaw
364+
365+ ** 方法A:一键脚本安装**
366+
367+ ``` bash
368+ curl -fsSL https://openclaw.ai/install.sh | bash
369+ ```
317370
318- ``` cmd
371+ #### 第六步:验证安装
372+
373+ ``` bash
374+ # 查看版本
319375openclaw --version
376+
377+ # 查看帮助
378+ openclaw --help
379+
380+ # 查看系统状态
381+ openclaw status
320382```
321383
322- #### 第四步:初始化配置
384+ #### 第七步:配置Windows访问WSL2服务
323385
324- ``` cmd
325- openclaw onboard
386+ 由于OpenClaw运行在WSL2中,需要配置端口转发以便Windows访问。
387+
388+ ** 创建启动脚本** ` start-openclaw.bat ` :
389+
390+ ``` batch
391+ @echo off
392+ echo Starting OpenClaw Gateway in WSL2...
393+ wsl -d Ubuntu-22.04 -u root service openclaw start
394+ timeout /t 3
395+ start http://localhost:18789
326396```
327397
328- 按照提示完成配置(与Mac相同)。
398+ 或直接在WSL2中启动:
399+
400+ ``` bash
401+ # 在WSL2 Ubuntu终端中
402+ openclaw gateway run --port 18789
403+ ```
404+
405+ 然后在Windows浏览器访问 ` http://localhost:18789 `
406+
407+ ---
408+
409+ ### 方式二:PowerShell原生部署
410+
411+ 适合不想使用WSL2的纯Windows用户。
412+
413+ #### 第一步:安装Node.js 22+
414+
415+ ** 方法一:官网下载安装**
416+
417+ 1 . 访问 https://nodejs.org/zh-cn
418+ 2 . 下载Windows安装包(LTS版本22.x)
419+ 3 . 运行安装程序,勾选「自动安装必要的工具」
420+
421+ #### 第二步:验证Node.js安装
422+
423+ ``` powershell
424+ # 打开PowerShell
425+ node -v
426+ npm -v
427+ ```
428+
429+ #### 第三步:以管理员身份安装OpenClaw
430+
431+ ** 重要** :必须以** 管理员身份** 运行PowerShell。
432+
433+ ``` powershell
434+ # 安装最新稳定版
435+ npm install -g openclaw@latest
436+
437+ # 或安装汉化版
438+ npm install -g @qingchencloud/openclaw-zh@latest
439+ ```
440+
441+ #### 第四步:解决安装权限问题
442+
443+ 如果遇到权限错误:
444+
445+ ``` powershell
446+ # 方法A:启用PowerShell脚本执行
447+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
448+
449+ # 方法B:修改npm安装目录
450+ npm config set prefix "C:\npm"
451+ npm config set cache "C:\npm-cache"
452+
453+ # 将目录添加到PATH
454+ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\npm", "User")
455+ ```
456+
457+ #### 第五步:验证安装
458+
459+ ``` powershell
460+ openclaw --version
461+ openclaw --help
462+ ```
463+
464+ #### 第六步:解决常见问题
465+
466+ ** 问题:sharp模块加载失败**
467+
468+ ``` powershell
469+ # 清理npm缓存
470+ npm cache clean --force
471+
472+ # 重新安装
473+ npm install -g openclaw@latest --force
474+ ```
475+
476+ ** 问题:Windows Defender阻止**
477+
478+ 将OpenClaw安装目录添加到Windows Defender排除项:
479+
480+ ```
481+ C:\Users\你的用户名\AppData\Roaming\npm
482+ C:\Users\你的用户名\.openclaw
483+ ```
484+
485+ ---
486+
487+ ### 初始化配置
488+
489+ 安装完成后,需要运行初始化向导。
490+
491+ #### 启动初始化向导
492+
493+ ``` bash
494+ openclaw onboard --install-daemon
495+ ```
496+
497+ #### 配置AI模型提供商
498+
499+ OpenClaw需要对接AI模型才能工作。
500+
501+ ** 以配置Anthropic Claude(推荐)为例:**
502+
503+ ``` bash
504+ # WSL2或PowerShell
505+ openclaw models auth add anthropic
506+
507+ # 输入API Key: sk-ant-xxx
508+ ```
509+
510+ #### 绑定消息渠道
511+
512+ ** 1. Telegram**
513+
514+ 创建Bot:
515+ 1 . 在Telegram搜索 ` @BotFather `
516+ 2 . 发送 ` /newbot ` 创建机器人
517+ 3 . 保存Bot Token
518+
519+ 配置:
520+
521+ ``` bash
522+ openclaw channels add telegram
523+ openclaw config set channels.telegram.botToken " your-bot-token"
524+ openclaw gateway restart
525+ ```
526+
527+ ** 2. WhatsApp**
528+
529+ ``` bash
530+ # 登录WhatsApp(显示二维码)
531+ openclaw channels login whatsapp
532+
533+ # 用手机WhatsApp扫码
534+ ```
535+
536+ ** 3. 企业微信(国内推荐)**
537+
538+ ``` bash
539+ # 安装企业微信插件
540+ openclaw plugins install @m1heng-clawd/wework
541+
542+ # 配置
543+ openclaw config set channels.wework ' {"enabled":true,"corpId":"xxx","agentSecret":"xxx"}' --json
544+ ```
545+
546+ ** 4. 飞书(国内推荐)**
547+
548+ ``` bash
549+ # 安装飞书插件
550+ openclaw plugins install @m1heng-clawd/feishu
551+
552+ # 配置
553+ openclaw config set channels.feishu ' {"enabled":true,"appId":"cli_xxx","appSecret":"xxx"}' --json
554+ ```
555+
556+ ### Windows常用命令速查
557+
558+ ** 系统管理** :
559+
560+ | 命令 | 功能 |
561+ | ------| ------|
562+ | ` openclaw --version ` | 查看版本 |
563+ | ` openclaw status ` | 查看系统状态 |
564+ | ` openclaw health ` | 健康检查 |
565+ | ` openclaw update ` | 更新OpenClaw |
566+ | ` openclaw doctor ` | 诊断系统问题 |
567+
568+ ** 配置管理** :
569+
570+ | 命令 | 功能 |
571+ | ------| ------|
572+ | ` openclaw onboard ` | 初始化向导 |
573+ | ` openclaw configure ` | 交互式配置 |
574+ | ` openclaw config get <key> ` | 查看配置项 |
575+ | ` openclaw config set <key> <value> ` | 修改配置项 |
576+ | ` openclaw config unset <key> ` | 删除配置项 |
329577
330578---
331579
0 commit comments