Install
openclaw skills install openclaw-win-install-ai-assistComplete step-by-step installation guide for OpenClaw on Windows 10/11 with WSL2, includes common pitfalls and solutions from real installation experience.
openclaw skills install openclaw-win-install-ai-assistThis 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
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。
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:
本指南包含以下功能:
Operating System:
操作系统:
Hardware:
硬件:
Network:
网络:
If your network connection is unstable or slow, you can pre-download the following installation files before starting.
如果你的网络连接不稳定或速度较慢,可以在开始安装前预先下载以下安装文件。
Recommended Pre-Download Files:
建议预下载文件:
How to Use Pre-Downloaded Files:
如何使用预下载的文件:
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.
下载上述文件后,将它们放在本地文件夹中(例如 C:\InstallFiles\)。在安装过程中,当技能要求下载文件时,您可以指定使用这些本地文件而不是从互联网下载。
This approach is especially useful for users with unstable internet connections or those who need to install OpenClaw in an offline environment.
这种方法对于网络连接不稳定的用户或需要在离线环境中安装 OpenClaw 的用户特别有用。
1.1 Check Windows System Version / 检查 Windows 系统版本
English:
中文:
⚠️ 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:
中文:
1.3 Prepare Terminal with Admin Privileges / 准备管理员权限终端
English:
All following operations must be run as administrator:
中文:
后续所有操作必须以管理员身份运行终端:
Use Case / 适用场景: C: drive has ≥ 20GB free space, want fastest installation. 4 steps total, 5 minutes to complete.
C 盘剩余空间 ≥ 20GB,想最快速度完成安装,选择这个方案。全程仅需 4 步,5 分钟完成。
wsl --install
This is official Microsoft one-click install, it automatically does: / 这是微软官方一键安装,会自动完成:
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:
After command completes, you must reboot or system components won't take effect.
命令执行完成后,必须重启电脑,否则系统组件不会生效。
wsl --list --verbose
Success Criteria (all must be true) / 成功标准(必须同时满足):
Run inside WSL: / 进入 WSL 后执行:
sudo apt update
sudo apt upgrade -y
sudo apt install -y curl wget git
For users in China: Recommended to replace with Aliyun mirror for faster speed / 国内用户推荐替换阿里云镜像源加速:
sudo sed -i 's|http://archive.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list
sudo sed -i 's|http://security.ubuntu.com/ubuntu|https://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list
sudo apt update && sudo apt upgrade -y
After completing, skip to Chapter 4. / 完成后跳转到第四章继续。
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.
核心说明: 微软官方 wsl --install 没有直接指定安装路径的参数,因此采用「装核心组件 → 导出发行版 → 导入到目标盘」的官方标准方案,安全无风险。
Run these commands one-by-one in admin terminal:
在管理员终端中依次执行:
# 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.
如果 wsl --set-default-version 2 只打印帮助文档不执行,说明系统自带的 wsl.exe 太旧,必须手动下载安装最新版 WSL MSI 包。
After reboot, open admin terminal again, install Ubuntu 22.04 LTS (stable): / 重启后再次打开管理员终端,安装 Ubuntu 22.04 LTS 稳定版:
wsl --install -d Ubuntu-22.04
After installation, DO NOT open Ubuntu app (it will auto-initialize on C: drive), just run: / 安装完成后,绝对不要打开 Ubuntu 应用(否则会自动初始化占用 C 盘),直接执行:
wsl --terminate Ubuntu-22.04
Open File Explorer, on target drive (e.g. D:), create: / 打开文件资源管理器,在目标盘(如 D 盘)创建:
❗ Critical Pitfall Avoidance / 关键避坑:
Directory path MUST NOT contain Chinese characters, spaces, or special characters, otherwise import will fail.
目录路径绝对不要有中文、空格、特殊字符,否则会导致导入失败。
# Format: wsl --export <distro-name> <full-export-path>
# 命令格式:wsl --export 发行版名称 导出文件完整路径
wsl --export Ubuntu-22.04 D:\WSL\backup\ubuntu2204.tar
Wait for export to complete, takes 1-3 minutes depending on disk speed. No error means success. / 等待导出完成,根据磁盘速度约 1-3 分钟,无报错即为成功。
# Format: wsl --unregister <distro-name>
# 命令格式:wsl --unregister 发行版名称
wsl --unregister Ubuntu-22.04
After execution, the C: drive distro files are completely removed. / 执行后,C 盘的发行版文件会被完全删除。
# Format: wsl --import <custom-distro-name> <target-install-dir> <exported-tar-path> --version 2
# 命令格式:wsl --import 自定义发行版名称 目标安装目录 导出 tar 文件路径 --version 2
wsl --import Ubuntu-22.04 D:\WSL\Ubuntu2204 D:\WSL\backup\ubuntu2204.tar --version 2
Parameter Explanation / 参数说明:
After import, default login is root. You can choose: / 导入完成后默认会以 root 身份登录,你有两种选择:
First enter the imported Ubuntu system: / 先进入导入的 Ubuntu 系统:
wsl -d Ubuntu-22.04
Run these commands in order (replace openclaw with your username): / 进入系统后依次执行(替换 openclaw 为你的用户名):
# 1. Create user, auto-create home dir, set default shell to bash
# 创建用户,自动创建家目录,设置默认 shell 为 bash
useradd -m -s /bin/bash openclaw
# 2. Set password for user (no echo on screen, normal behavior, remember it!)
# 给用户设置密码(输入时无回显,务必牢记)
passwd openclaw
# 3. Add user to sudo group for admin privileges
# 给用户赋予 sudo 管理员权限
usermod -aG sudo openclaw
# 4. Configure WSL default login to be the newly created user
# 配置 WSL 默认登录用户为刚创建的用户
echo -e "[user]\ndefault = openclaw" >> /etc/wsl.conf
# 5. (Recommended) Configure passwordless sudo to avoid repeated typing during install
# 配置 sudo 免密(推荐,避免安装过程频繁输入密码)
echo "openclaw ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
After complete, type exit to leave WSL, back to Windows terminal. / 执行完成后,输入 exit 退出 WSL,回到 Windows 终端。
# Terminate distro / 终止发行版
wsl --terminate Ubuntu-22.04
# Re-enter system, verify default user / 重新进入系统,验证默认用户
wsl -d Ubuntu-22.04
Success Criteria / 成功标准: After entering system, prompt shows your created username (e.g. openclaw@...), NOT root. / 进入系统后,命令行前缀显示你创建的用户名(如 openclaw@...),而非 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 / 主要区别:
Both options work fine for installing and running OpenClaw. / 两种方式都能正常安装和运行 OpenClaw,按个人习惯选择即可。
wsl --list --verbose
Success Criteria / 成功标准:
Mirror networking mode needs global configuration: / 镜像网络模式需要全局配置:
C:\Users\<your-username>\ / 打开文件资源管理器,导航到:C:\Users\<你的用户名>\.wslconfig (note the leading dot) / 创建名为 .wslconfig 的文件(注意前面的点号)[wsl2]
# Enable mirrored networking mode - THIS IS THE MOST IMPORTANT CONFIG
# 启用镜像网络模式 - 这是最重要的配置
networkingMode=mirrored
# Enable DNS tunneling, prevents DNS resolution failure under VPN
# 启用 DNS 隧道,防止 VPN 环境下域名解析失效
dnsTunneling=true
# Force WSL to use Windows HTTP proxy settings
# 强制 WSL 使用 Windows 的 HTTP 代理设置
autoProxy=true
# Enable integrated firewall support
# 启用集成防火墙支持
firewall=true
[experimental]
# Gradually auto-reclaim unused memory, improves performance
# 自动回收闲置内存,优化性能
autoMemoryReclaim=gradual
# Enable host loopback access support
# 支持主机回环地址访问
hostAddressLoopback=true
wsl --shutdown
In mirrored networking mode, need to allow OpenClaw port access: / 镜像网络模式下,需要允许 OpenClaw 端口访问:
New-NetFirewallRule -DisplayName "OpenClaw-Service" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 18789
⚠️ 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 正常使用。
Run after entering WSL: / 进入 WSL 后执行:
curl -fsSL https://molt.bot/install.sh | bash
If after installation it says openclaw command not found, that means npm global bin directory isn't in PATH: / 如果安装完成后提示 openclaw 命令找不到,说明 npm 全局 bin 目录没有加入 PATH:
echo 'export PATH="/home/openclaw/.npm-global/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Verify: / 验证:
which openclaw
openclaw --version
openclaw setup
Follow the wizard prompts to complete configuration. / 按照向导提示完成配置即可。
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 密钥。请根据你的需求和预算选择合适的服务商。不同服务商提供的模型能力、价格结构和免费额度各不相同。你可能需要研究并比较可用选项,以找到最适合你使用场景的方案。
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
This section collects troubleshooting experience from Deepwhite 深白色, workfisher, and other community contributors who installed OpenClaw on Windows WSL2.
本节收集了作者 Deepwhite 深白色、workfisher 以及社区其他人在 Windows WSL2 安装 OpenClaw 实际遇到的各种报错和解决方法。
curl -fSL https://ghproxy.com/https://github.com/microsoft/WSL/releases/download/2.3.26/wsl.2.3.26.0.x64.msi -o wsl-install.msi
sudo tee /etc/wsl.conf << 'EOF'
[boot]
systemd=true
EOF
Then run in Windows PowerShell: / 然后在 Windows PowerShell 执行:
wsl --shutdown
Restart WSL then start OpenClaw again / 重启 WSL 后再启动 OpenClaw。
openclaw gateway install
systemctl --user start openclaw-gateway.service
Then check status: / 然后检查状态:
openclaw gateway status
# Change ownership of npm directory to current user
sudo chown -R $USER:$USER ~/.npm-global
Then re-run install / 然后重新运行安装命令。
# Run in Windows PowerShell
wsl --shutdown
Restart WSL, time will sync automatically / 关闭 WSL 再重新启动,时间会自动同步。
[wsl2]
swap=0
Install Chrome extension for quick access:
安装 Chrome 扩展方便快捷连接:
https://chromewebstore.google.com/detail/openclaw-browser-relay/nglingapjinhecnfejdcpihlpneeadjp
To create a desktop shortcut for quickly launching WSL Ubuntu, follow these steps:
要创建用于快速启动 WSL Ubuntu 的桌面快捷方式,请按照以下步骤操作:
Step 1: Create the shortcut file / 步骤 1:创建快捷方式文件
Open WSL terminal and run:
打开 WSL 终端并运行:
# Create desktop directory if not exists
# 如果不存在,创建桌面目录
mkdir -p ~/Desktop
# Create the desktop entry file
# 创建桌面入口文件
cat > ~/Desktop/ubuntu-wsl.desktop << 'EOF'
[Desktop Entry]
Name=Ubuntu WSL
Name[zh_CN]=Ubuntu WSL
Comment=Launch Ubuntu WSL
Comment[zh_CN]=启动 Ubuntu WSL
Exec=powershell.exe -Command "wsl -d Ubuntu-22.04"
Icon=/usr/share/icons/hicolor/scalable/apps/ubuntu.svg
Type=Application
Terminal=false
Categories=System;Utility;
EOF
Step 2: Make the shortcut executable / 步骤 2:使快捷方式可执行
chmod +x ~/Desktop/ubuntu-wsl.desktop
Step 3: Enable desktop icons (if needed) / 步骤 3:启用桌面图标(如需要)
If using GNOME desktop environment:
如果使用的是 GNOME 桌面环境:
gsettings set org.gnome.desktop.interface show-battery-percentage true
gsettings set org.gnome.shell.extensions.ding show-home true
For other desktop environments, refer to their specific documentation.
对于其他桌面环境,请参考各自的文档。
To create a desktop shortcut for quickly launching OpenClaw Gateway:
要创建用于快速启动 OpenClaw Gateway 的桌面快捷方式:
Step 1: Create the shortcut file / 步骤 1:创建快捷方式文件
cat > ~/Desktop/openclaw-gateway.desktop << 'EOF'
[Desktop Entry]
Name=OpenClaw Gateway
Name[zh_CN]=OpenClaw 网关
Comment=Start OpenClaw Gateway Service
Comment[zh_CN]=启动 OpenClaw 网关服务
Exec=bash -c "source ~/.bashrc && openclaw gateway start"
Icon=/usr/share/icons/hicolor/scalable/apps/terminal.svg
Type=Application
Terminal=true
Categories=Network;Development;
EOF
Step 2: Make executable and copy to applications / 步骤 2:设为可执行并复制到应用目录
chmod +x ~/Desktop/openclaw-gateway.desktop
# Optional: Copy to system applications directory for all users
# 可选:复制到系统应用目录供所有用户使用
sudo cp ~/Desktop/openclaw-gateway.desktop /usr/share/applications/
Step 3: Create a combined launcher (Optional) / 步骤 3:创建组合启动器(可选)
To launch both WSL Ubuntu and start OpenClaw Gateway with one click:
要一键启动 WSL Ubuntu 并启动 OpenClaw Gateway:
cat > ~/Desktop/openclaw-full.desktop << 'EOF'
[Desktop Entry]
Name=OpenClaw Full Launch
Name[zh_CN]=OpenClaw 完整启动
Comment=Launch WSL Ubuntu and Start OpenClaw Gateway
Comment[zh_CN]=启动 WSL Ubuntu 并启动 OpenClaw 网关
Exec=powershell.exe -Command "Start-Process wsl -ArgumentList '-d','Ubuntu-22.04','-e','bash','-c','source ~/.bashrc && openclaw gateway start' -Wait"
Icon=/usr/share/icons/hicolor/scalable/apps/ubuntu.svg
Type=Application
Terminal=false
Categories=System;Network;Development;
EOF
chmod +x ~/Desktop/openclaw-full.desktop
To create Windows desktop shortcuts for quick access:
要在 Windows 桌面创建快捷方式以便快速访问:
Method 1: Manual Shortcut Creation / 方法 1:手动创建快捷方式
Right-click on desktop → New → Shortcut 右键点击桌面 → 新建 → 快捷方式
For WSL Ubuntu, enter location: 对于 WSL Ubuntu,输入位置:
wsl -d Ubuntu-22.04
For OpenClaw Gateway, enter location: 对于 OpenClaw Gateway,输入位置:
wsl -d Ubuntu-22.04 -e bash -c "openclaw gateway start"
Name your shortcut and click Finish 命名你的快捷方式并点击完成
Method 2: PowerShell Script / 方法 2:PowerShell 脚本
Run the following in PowerShell to create shortcuts automatically:
在 PowerShell 中运行以下命令自动创建快捷方式:
# Create WSL Ubuntu shortcut
# 创建 WSL Ubuntu 快捷方式
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$env:USERPROFILE\Desktop\WSL Ubuntu.lnk")
$Shortcut.TargetPath = "wsl.exe"
$Shortcut.Arguments = "-d Ubuntu-22.04"
$Shortcut.IconLocation = "%SystemRoot%\System32\SHELL32.dll,13"
$Shortcut.Save()
# Create OpenClaw Gateway shortcut
# 创建 OpenClaw Gateway 快捷方式
$Shortcut2 = $WshShell.CreateShortcut("$env:USERPROFILE\Desktop\OpenClaw Gateway.lnk")
$Shortcut2.TargetPath = "wsl.exe"
$Shortcut2.Arguments = "-d Ubuntu-22.04 -e bash -c 'openclaw gateway start'"
$Shortcut2.IconLocation = "%SystemRoot%\System32\SHELL32.dll,21"
$Shortcut2.Save()
Write-Host "Shortcuts created successfully!" -ForegroundColor Green
Write-Host "快捷方式创建成功!" -ForegroundColor Green
These desktop shortcuts provide convenient one-click access to your WSL Ubuntu environment and OpenClaw Gateway service.
这些桌面快捷方式提供了一键访问 WSL Ubuntu 环境和 OpenClaw Gateway 服务的便利方式。
If you need Feishu integration, create app in Feishu Developer Portal and configure required permissions: / 如果你需要飞书集成,在飞书开发后台创建应用,并配置好相应权限:
https://open.feishu.cn/?lang=zh-CN
After configuration, run inside WSL: / 配置完成后,在 WSL 中执行:
openclaw pairing approve feishu <your-code>
Start OpenClaw / 启动 OpenClaw:
# 1. From Windows PowerShell
wsl -d Ubuntu
# 2. Inside WSL
openclaw gateway start
Shutdown WSL / 关闭 WSL:
wsl --shutdown
This guide is a complete step-by-step installation experience summary based on actual installation of OpenClaw on Windows WSL2, collected and organized by the author and workfisher. We hope it helps more people successfully install OpenClaw on Windows.