Complete step-by-step installation guide for OpenClaw on Windows 10/11 with WSL2, includes common pitfalls and solutions from real installation experience.
OpenClaw Windows (WSL2) 安装指南 / OpenClaw Installation Guide for Windows 10/11 (WSL2)
This installation guide is designed to be used by OpenClaw-like software tools to assist users in installing OpenClaw on Windows WSL2 environment.
本安装指南是供类 OpenClaw 的第三方软件工具调用,辅助用户在 Windows WSL2 环境下安装 OpenClaw。
This guide shares pitfalls and solutions collected from actual installation experience by the author and community contributors.
本指南分享了作者和社区在实际安装过程中遇到的各种坑和解决方法。
Author / 作者: Deepwhite 深白色
Contributor / 贡献者: workfisher
License / 许可: MIT
Introduction / 简介
This is an installation skill designed for AI assistants (such as WorkBuddy, OpenClaw itself, or similar tools) to help users install OpenClaw on Windows WSL2 environment.
这是一个专为 AI 助手(如 WorkBuddy、OpenClaw 本身或类似工具)设计的安装技能,用于帮助用户在 Windows WSL2 环境中安装 OpenClaw。
When to Use / 使用场景
相关技能
Use this guide when you need to install OpenClaw on a Windows 10/11 machine via WSL2.
当你需要在 Windows 10/11 的 WSL2 环境中安装 OpenClaw 时,请使用本指南。
This guide includes the following features:
本指南包含以下功能:
One-click installation to system C: drive
一键安装到系统盘 C 盘
Custom installation to non-system drives (D/E/F)
自定义安装到非系统盘
Comprehensive troubleshooting from real-world experience
来自实际安装经验的完整排错指南
Optimizations for Chinese network environment
针对国内网络环境的优化
Prerequisites / 前置要求
Hardware / Software Requirements / 硬件/软件要求
Operating System:
操作系统:
Windows 10 version 2004+ (build 19041+) or Windows 11 all versions
Windows 10 需要 2004 版本以上,内部版本号≥19041;Windows 11 任意版本都符合
Hardware:
硬件:
CPU supports virtualization (VT-x/AMD-V), RAM ≥ 8GB, ≥ 20GB free disk space
CPU 需要支持虚拟化技术,内存至少 8GB,磁盘剩余空间至少 20GB
Network:
网络:
Access to GitHub or Chinese mirror sources available. If your network connection is unstable, you can pre-download installation files locally before starting.
After downloading the above files, place them in a local folder (e.g., C:\InstallFiles\). During the installation process, when the skill asks you to download files, you can point it to use these local files instead of downloading from the internet.
1.1 Check Windows System Version / 检查 Windows 系统版本
English:
Press Win + R, type winver, press Enter
Verify version:
Windows 10: version 2004+, build number ≥ 19041
Windows 11: any version is OK
If version is too old: Go to Settings → Windows Update → Check for updates, upgrade to latest stable version before continuing
中文:
按下 Win + R,输入 winver,回车
核对版本:
Windows 10 需要 2004 版本以上,内部版本号≥19041
Windows 11 任意版本都符合
如果版本不达标:打开「设置 → Windows 更新 → 检查更新」,升级到最新稳定版再继续
⚠️ Important Lesson from Pitfalls / 重要踩坑经验:
If Windows 10 version is too old, it will lack lxcore.sys and lxss.sys kernel drivers, WSL will never start properly. You must upgrade system to latest version.
如果 Windows 10 版本太老,会缺少 lxcore.sys 和 lxss.sys 内核驱动,WSL 始终无法启动,必须升级系统到最新版本。
1.2 Verify CPU Virtualization is Enabled / 确认 CPU 虚拟化已开启
English:
Press Ctrl + Shift + Esc to open Task Manager
Go to Performance tab → click CPU
Check "Virtualization: Enabled" in bottom-right corner
If not enabled: Reboot → enter BIOS → enable CPU virtualization. Google "your computer model enable virtualization" for tutorial.
中文:
按 Ctrl + Shift + Esc 打开任务管理器
切换到「性能」选项卡,点击「CPU」
在右下角查看「虚拟化:已启用」
如果未启用:重启电脑进 BIOS 开启 CPU 虚拟化,搜索「你的电脑型号 开启虚拟化」获取教程
1.3 Prepare Terminal with Admin Privileges / 准备管理员权限终端
English:
All following operations must be run as administrator:
Press Win + X
Select Windows Terminal (Admin) (on Windows 10, select Windows PowerShell (Admin))
✅ Downloads and installs latest WSL2 Linux kernel / 下载并安装 WSL2 最新 Linux 内核
✅ Downloads and installs default Ubuntu Linux distribution / 下载并安装默认的 Ubuntu Linux 发行版
✅ Automatically sets WSL2 as default version / 自动设置 WSL2 为默认版本
Wait for initialization to complete, follow prompt to create UNIX user account: / 等待初始化完成后,按提示创建 UNIX 用户账户:
# 1. Enter custom username (lowercase ASCII only, no spaces/Chinese, recommend "openclaw")
# 输入自定义用户名(纯英文小写,无空格/中文,推荐 openclaw)
Enter new UNIX username: openclaw
# 2. Enter custom password (no echo on screen, this is normal, remember it!)
# 输入自定义密码(输入时无字符回显,正常输入,务必牢记!)
New password:
# 3. Confirm password by entering again
# 再次输入密码确认
Retype new password:
2.2 Reboot to Activate Components / 重启电脑使组件生效
After command completes, you must reboot or system components won't take effect.
命令执行完成后,必须重启电脑,否则系统组件不会生效。
2.3 Verify Installation Success / 验证安装是否成功
wsl --list --verbose
Success Criteria (all must be true) / 成功标准(必须同时满足):
STATE shows Running / STATE 列显示 Running
VERSION column shows 2 (must be 2, can't be 1) / VERSION 列显示 2(必须为 2,不可为 1)
Distribution name shows Ubuntu / 发行版名称显示 Ubuntu
2.4 System Update & Mirror Configuration / 系统更新与软件源配置
Use Case: C: drive doesn't have enough space, want to install WSL on another drive. 10 steps, ~15 minutes.
适用场景: C 盘空间不足,想把 WSL 安装到其他盘。全程 10 步,15 分钟完成。
Key Note: Official Microsoft wsl --install doesn't support custom install path directly. We use official standard method: "install core → export distro → import to target drive", which is safe.
# Enable WSL core feature / 启用 WSL 核心组件
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# Enable Virtual Machine Platform feature / 启用虚拟机平台组件
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# !! PITFALL WARNING !! System built-in wsl.exe is too old, need manual install latest version
# 这里有坑:系统自带 wsl.exe 版本太旧,需要手动安装最新版
# Download from: https://github.com/microsoft/WSL/releases/latest
# After install, add new WSL to PATH with higher priority:
# $oldPath = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
# [System.Environment]::SetEnvironmentVariable("Path", "C:\Program Files\WSL;" + $oldPath, "Machine")
# Enable all Hyper-V core components (mandatory, otherwise WSL won't start)
# 启用所有 Hyper-V 核心组件(必须,否则 WSL 无法启动)
Enable-WindowsOptionalFeature -Online -FeatureName HypervisorPlatform -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Hypervisor -All -NoRestart
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Services -All -NoRestart
bcdedit /set hypervisorlaunchtype auto
# Set WSL2 as default version / 设置 WSL2 为默认版本
wsl --set-default-version 2
After execution, you must reboot for components to activate.
执行完成后,必须重启电脑,使组件生效。
⚠️ Common Pitfall / 常见坑:
If wsl --set-default-version 2 only prints help text and doesn't execute, that means built-in wsl.exe is too old. You must manually download and install latest WSL MSI package.
Success Criteria / 成功标准: After entering system, prompt shows your created username (e.g. openclaw@...), NOT root. / 进入系统后,命令行前缀显示你创建的用户名(如 openclaw@...),而非 root。
Option 2: Use root directly (simpler, for experienced users) / 方案二:直接使用 root(更简单,适合经验丰富的用户)
If you prefer simplicity and don't want to create a separate user, you can just keep using root. No extra configuration needed.
如果你喜欢简单,不想创建单独用户,可以直接一直用 root 登录,不需要任何额外配置。
Main differences / 主要区别:
✅ Pros: No need to create user, no sudo password required for every command / 优点:不用创建用户,每个命令都不需要输 sudo 密码
⚠️ Notes: Runs everything with full root permissions, less secure than normal user / 注意:所有程序都以完整 root 权限运行,安全性不如普通用户
Both options work fine for installing and running OpenClaw. / 两种方式都能正常安装和运行 OpenClaw,按个人习惯选择即可。
3.10 Verify Install Path & Version / 验证安装路径与版本
wsl --list --verbose
Success Criteria / 成功标准:
STATE column shows Running / STATE 列显示 Running
VERSION column shows 2 / VERSION 列显示 2
LOCATION column shows your target drive path / LOCATION 列显示你设置的目标盘路径
Chapter 4: OpenClaw Specific Environment Optimization / 第四章:OpenClaw 专属环境优化配置
⚠️ Note / 说明: Windows 10 doesn't support mirrored networking mode, it will automatically fall back to NAT mode. This doesn't affect normal OpenClaw usage.
Windows 10 不支持镜像网络模式,会自动回退到 NAT 模式,不影响 OpenClaw 正常使用。
4.3 Install OpenClaw / 安装 OpenClaw
Run after entering WSL: / 进入 WSL 后执行:
curl -fsSL https://molt.bot/install.sh | bash
4.4 Fix PATH Environment Variable / 修复 PATH 环境变量
If after installation it says openclaw command not found, that means npm global bin directory isn't in PATH: / 如果安装完成后提示 openclaw 命令找不到,说明 npm 全局 bin 目录没有加入 PATH:
Follow the wizard prompts to complete configuration. / 按照向导提示完成配置即可。
Chapter 5: LLM Model Configuration / 第五章:LLM 模型配置
After installing OpenClaw, you need to configure your own LLM API key in the setup wizard. The setup wizard will prompt you to select an LLM provider and enter your API key. Please choose a provider based on your needs and budget. Different providers offer varying model capabilities, pricing structures, and free tier options. You may need to research and compare available options to find the best fit for your use case.
安装完成后,你需要在安装向导中配置自己的 LLM API 密钥。安装向导会提示你选择 LLM 服务商并输入 API 密钥。请根据你的需求和预算选择合适的服务商。不同服务商提供的模型能力、价格结构和免费额度各不相同。你可能需要研究并比较可用选项,以找到最适合你使用场景的方案。
Chapter 6: Startup & Verification / 第六章:启动与验证
Start OpenClaw / 启动 OpenClaw:
# 1. From Windows PowerShell
wsl -d Ubuntu
# 2. Inside WSL
openclaw gateway start
Verify Installation / 验证安装:
which openclaw
openclaw --version
openclaw gateway status
Chapter 7: Troubleshooting - Pitfalls & Solutions (Collected from Community Experience) / 第七章:常见问题排查(作者 + 社区踩坑经验汇总)
This section collects troubleshooting experience from Deepwhite 深白色, workfisher, and other community contributors who installed OpenClaw on Windows WSL2.
本节收集了作者 Deepwhite 深白色、workfisher 以及社区其他人在 Windows WSL2 安装 OpenClaw 实际遇到的各种报错和解决方法。
Pitfall 1: System built-in wsl.exe is too old / 坑 1:系统自带 wsl.exe 版本太旧
Symptom / 现象: wsl --update, wsl --set-default-version 2 only prints help text, doesn't execute / wsl --update、wsl --set-default-version 2 只打印帮助文档不执行
Cause / 原因: Windows 10 built-in wsl.exe is very old, doesn't support modern parameters / Windows 10 内置的 wsl.exe 版本很老,不支持现代参数
Cause / 原因: Corrupted WSL installation or third-party security software blocking / WSL 安装损坏,或者第三方安全软件拦截
Solution / 解决:
Disable Core Isolation in Windows Defender: Windows Security → Device Security → Core Isolation → Memory Integrity → Off / 在 Windows Defender 中关闭内核隔离:Windows 安全中心 → 设备安全性 → 内核隔离 → 内存完整性 → 关闭
Reboot and try again / 重启后重试
If that doesn't work, uninstall WSL completely and reinstall / 如果不行,彻底卸载 WSL 重新安装
Pitfall 12: Error: "The requested operation could not be completed due to a virtual disk system limitation" / 坑 12:报错 "由于虚拟磁盘系统限制,无法完成请求的操作"
Symptom / 现象: When importing WSL distro, error about virtual disk size limit / 导入 WSL 发行版时,报虚拟磁盘大小限制错误
Cause / 原因: Target drive is FAT32 format, which doesn't support files larger than 4GB / 目标盘是 FAT32 格式,不支持大于 4GB 的文件
Solution / 解决: Convert drive to NTFS format, or choose another NTFS drive / 将目标盘转换为 NTFS 格式,或者选择另一个 NTFS 格式的磁盘
Pitfall 13: "Function not processed" error when enabling Hyper-V / 坑 13:启用 Hyper-V 时报"该功能无法处理"
Symptom / 现象: Enable-WindowsOptionalFeature fails with error / Enable-WindowsOptionalFeature 执行失败
Cause / 原因: Windows is Home edition, Hyper-V is not supported on Home edition / 你的 Windows 是家庭版,家庭版不支持 Hyper-V
Solution / 解决:
Method 1: Upgrade Windows 10/11 from Home to Pro edition / 方案一:将 Windows 10/11 从家庭版升级到专业版
Method 2: Enable WSL without Hyper-V using third-party scripts (not officially supported, use at your own risk) / 方案二:使用第三方脚本在不开启 Hyper-V 的情况下启用 WSL(非官方支持,风险自负)
Pitfall 14: After Windows update, WSL disappears / 坑 14:Windows 更新后,WSL 消失了
Run wsl -d <distro-name> -u root in Windows terminal to login as root / 在 Windows 终端执行 wsl -d <发行版名称> -u root,以 root 身份进入系统
Run passwd <your-username> to reset password / 执行 passwd <你的用户名>,重新设置密码
Run exit and login with new password / 执行 exit 退出,用新密码登录即可
Issue 4: Mirrored mode not working, IP still starts with 172 / 问题 4:镜像模式不生效,IP 还是 172 开头
Solution / 解决:
Verify .wslconfig is in correct user directory, filename correct (must be .wslconfig, not wslconfig.txt) / 确认 .wslconfig 文件放在正确的用户目录下,文件名正确(必须是 .wslconfig,不是 wslconfig.txt)
Run wsl --shutdown to fully close WSL, wait 10 seconds then restart / 执行 wsl --shutdown 完全关闭 WSL,等待 10 秒后再启动
Run wsl --update to update WSL to latest version / 执行 wsl --update 更新 WSL 到最新版本
Solution / 解决: Check target path for Chinese characters, spaces, special characters. Change to pure ASCII path like D:\WSL\Ubuntu2204, do NOT use paths with spaces/Chinese. / 检查目标路径是否有中文、空格、特殊字符,换成纯英文路径,比如 D:\WSL\Ubuntu2204,不要使用带空格/中文的路径。
Issue 6: Can't access OpenClaw web UI from Windows / 问题 6:从 Windows 无法访问 OpenClaw Web UI