Install openclaw.ai on WSL2
Get the best of both worlds: Run Linux-native openclaw.ai on Windows using WSL2 (Windows Subsystem for Linux).
Why WSL2?
WSL2 runs a real Linux kernel with near-native performance, full system call compatibility, and seamless Windows integration. No dual-booting or VMs required.
đ Prerequisites
Enable WSL2 on Windows
Open PowerShell as Administrator (right-click Start â "Windows Terminal (Admin)" or search for PowerShell and run as admin):
# Install WSL with Ubuntu (Windows 10 2004+ / Windows 11)
wsl --install
This single command enables the WSL feature, downloads the Linux kernel, sets WSL2 as the default, and installs Ubuntu. Restart your computer when prompted.
Manual Installation
If wsl --install doesn't work (older Windows builds), enable the features manually:
# Enable WSL feature
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# Enable Virtual Machine Platform
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# Restart your computer, then set WSL2 as default
wsl --set-default-version 2
Install Ubuntu from Microsoft Store
If Ubuntu wasn't installed automatically by wsl --install, install it manually:
- Open the Microsoft Store
- Search for "Ubuntu 22.04 LTS"
- Click Get / Install
- Once installed, click Open (or search "Ubuntu" in the Start menu)
On first launch, Ubuntu will ask you to create a Unix username and password. This is your Linux user account (separate from your Windows login).
# Or install via PowerShell
wsl --install -d Ubuntu-22.04
Configure WSL2 Settings
Verify WSL2 is being used and optionally configure resource limits:
# Verify WSL version (run in PowerShell)
wsl -l -v
# Should show Ubuntu with VERSION 2
# If it shows VERSION 1, convert it:
wsl --set-version Ubuntu-22.04 2
Optionally, create a .wslconfig file to control memory and CPU allocation. Open PowerShell and run:
# Create WSL2 configuration file
notepad "$env:USERPROFILE\.wslconfig"
Add the following content and save:
[wsl2]
memory=4GB
processors=2
swap=2GB
Resource Tip
By default WSL2 can use up to 50% of your system RAM. The .wslconfig file lets you set a hard cap. 4 GB is recommended for openclaw.ai.
Update Ubuntu Inside WSL
Open your Ubuntu terminal (search "Ubuntu" in Start menu) and update all packages:
sudo apt update && sudo apt upgrade -y
Install Node.js 22
openclaw.ai requires Node.js 22 or higher. Install it from the official NodeSource repository inside WSL:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version # Should show v22.x.x
Install openclaw.ai
Run the official one-line installer inside your WSL Ubuntu terminal:
curl -fsSL https://openclaw.ai/install.sh | bash
Run Onboarding
Launch the interactive onboarding wizard. The --install-daemon flag automatically configures openclaw.ai to run as a background service:
openclaw onboard --install-daemon
The wizard will walk you through:
- Authentication setup (API keys for your LLM provider)
- Gateway configuration (port, allowed origins)
- Optional channel setup (Slack, Discord, etc.)
Verify Installation
Confirm everything is running correctly:
# Check system configuration
openclaw doctor
# Verify the gateway is healthy
openclaw health
# Open the web dashboard
openclaw dashboard
# Dashboard available at http://localhost:18789
localhost Access
WSL2 automatically forwards ports to Windows. You can access the dashboard from your Windows browser at http://localhost:18789 â no extra configuration needed.
Auto-Start openclaw.ai on Boot
WSL2 doesn't start automatically when Windows boots. Here are two methods to ensure openclaw.ai starts with your computer:
Method 1: Enable systemd in WSL (Recommended)
Modern WSL2 supports systemd natively. Enable it by editing /etc/wsl.conf inside Ubuntu:
# Edit wsl.conf inside Ubuntu
sudo tee /etc/wsl.conf <<EOF
[boot]
systemd=true
EOF
# Restart WSL from PowerShell (run in PowerShell)
# wsl --shutdown
# Then reopen Ubuntu
With systemd enabled, the openclaw-gateway service (set up by --install-daemon) will start automatically when WSL launches.
Method 2: Windows Task Scheduler
To start WSL automatically at Windows login, create a scheduled task:
- Open Task Scheduler (search in Start menu)
- Click Create Basic Task
- Name:
Start WSL openclaw - Trigger: When I log on
- Action: Start a program
- Program:
wsl.exe - Arguments:
-d Ubuntu-22.04 -- bash -c "openclaw gateway start" - Click Finish
After setting this up, check the gateway status:
# Check gateway status
openclaw gateway status
# Or check via systemd (if systemd is enabled)
systemctl --user status openclaw-gateway
đ§ Troubleshooting
Download and install the WSL2 Linux kernel update package from Microsoft:
- Go to Microsoft WSL2 Kernel Update
- Download and run the
wsl_update_x64.msiinstaller - Restart your computer and try again
Port forwarding usually works automatically, but if not:
# Inside WSL, check the gateway is listening
ss -tlnp | grep 18789
# Get the WSL2 IP address
hostname -I
# Try accessing via the WSL IP directly in your browser:
# http://<wsl-ip>:18789
If Windows Firewall is blocking the connection, add an inbound rule for port 18789 in Windows Defender Firewall â Advanced Settings.
By default WSL2 can consume up to 50% of system RAM. Create or edit the .wslconfig file to set limits:
# In PowerShell, create/edit the config
notepad "$env:USERPROFILE\.wslconfig"
# Add these lines:
# [wsl2]
# memory=4GB
# swap=2GB
# Then restart WSL
wsl --shutdown
WSL2 requires hardware virtualization. To enable it:
- Restart your computer and enter BIOS/UEFI (usually by pressing F2, F12, Del, or Esc during boot)
- Find the virtualization setting â it's called Intel VT-x, Intel Virtualization Technology, AMD-V, or SVM Mode depending on your hardware
- Enable it, save, and restart
You can verify it's enabled by opening Task Manager â Performance â CPU and checking for "Virtualization: Enabled".
Was this tutorial helpful?