WSL2安装OpenClaw并使用阿里云百炼和QQ
OpenClaw火热,各家大厂都推出了一键安装服务,但需要支付虚拟机的费用和大模型的流量费用。但实际上OpenClaw完全可以安装到本地,只购买大厂大模型接口就行了。本文购买了阿里云百炼 Coding Plan 的 Lite 基础套餐,每月40元,可请求18000次。控制OpenClaw使用QQ的机器人,目前免费。OpenClaw可以直接装到Windows下,也可以装到Windows的WSL2下,本文选择安装到WSL2下。 安装WSL2方法不再赘述,安装后安装一个Linux,如Ubuntu-24,并将其设置为默认启动。 启动wsl,设置管理员用户密码。登录后sudo su为root用户。 使用“curl -fsSL https://openclaw.ai/install.sh | bash”安装OpenClaw(参考https://docs.openclaw.ai/zh-CN/install)。 安装时会检测NodeJS等组件,没有会自动下载,正常情况下不用翻墙,如果联网失败,就多试几次。安装完成后,提示继续设置。(参考https://bailian.console.aliyun.com/cn-beijing/?tab=doc#/doc/?...) Onboarding mode选择QuickStart。 Model/auth provider选择Skip for now。 Filter models by provider选择All providers。 Default model选择Keep current。 Select channel选择Skip for now。 Search provider选择Skip for now。 Configure skills now选择No。 Enable hooks选择Skip for now。 How do you want to hatch your bot选择Hatch in TUI。 配置完成后,可以看到提示信息。 此时没有将gateway安装为服务,使用“openclaw onboard --install-daemon”安装为服务,执行过程中会回顾之前的配置。 然后可以用“openclaw dashboard”启动dashboard。并记录下这里的Token。 使用浏览器打开“http://localhost:18789/”。如果浏览器无法连接这恶鬼地址,说明gateway没有启动,需要手工启动gateway。这里已经以服务形式启动了,所以提示端口已占用。 购买阿里云百炼CodingPlan服务,Lite版每月40元就够用了。 在腾讯官方网站上(https://q.qq.com/qqbot/openclaw/index.html),创建机器人。需要手机QQ扫码登录。创建后会产生AppID和AppSecret。 配置绑定当前QQ机器人,使用命令openclaw channels add --channel qqbot --token "AppID:AppSecret",其中AppID、AppSecret需替换为实际值。 最后重启动gateway,命令为“openclaw gateway restart”。 此时,可以通过之前扫码登录的QQ上,会出现机器人,通过与机器人对话,可以控制主机上的OpenClaw。 因为OpenClaw是装在WSL中的,不能直接控制Windows的浏览器需要安装插件。使用“openclaw browser extension install”安装插件,使用“openclaw browser extension path”获取插件的路径。 在 Edge/Chrome 中加载扩展:浏览器打开 edge://extensions(或 chrome://extensions),开启"开发者模式",点击"加载解压缩的扩展",选择上面命令输出的路径,把扩展固定到工具栏。配置扩展:点击扩展图标,打开选项页,设置 Gateway token(如果没配置过,OpenClaw 会自动生成)。使用:打开你想让OpenClaw控制的标签页,点击扩展图标(徽章显示 ON 表示已连接),OpenClaw就可以帮你操作那个标签页了。1 简介
2 安装WSL2
C:\Users\Administrator>wsl --install -d Ubuntu-24.04
正在下载: Ubuntu 24.04 LTS
正在安装: Ubuntu 24.04 LTS
已成功安装分发。它可通过 “wsl.exe -d Ubuntu-24.04” 启动
C:\Users\Administrator>wsl --list --verbose
NAME STATE VERSION
* docker-desktop Stopped 2
Ubuntu-24.04 Stopped 2
C:\Users\Administrator>wsl --set-default Ubuntu-24.04
操作成功完成。
C:\Users\Administrator>wsl --list --verbose
NAME STATE VERSION
* Ubuntu-24.04 Stopped 2
docker-desktop Stopped 2C:\Users\Administrator>wsl
Provisioning the new WSL instance Ubuntu-24.04
This might take a while...
Create a default Unix user account: administrator
New password:
Retype new password:
passwd: password updated successfully
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 24.04.4 LTS (GNU/Linux 5.15.167.4-microsoft-standard-WSL2-20251029 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Thu Mar 12 17:42:08 CST 2026
System load: 0.16 Processes: 32
Usage of /: 0.1% of 1006.85GB Users logged in: 0
Memory usage: 5% IPv4 address for eth0: 172.27.70.29
Swap usage: 0%
This message is shown once a day. To disable it please create the
/home/administrator/.hushlogin file.
administrator@Thinkpad:/mnt/c/Users/Administrator$ sudo su -
[sudo] password for administrator:
root@Thinkpad:/mnt/c/Users/Administrator#
root@Thinkpad:/home/administrator# cd
root@Thinkpad:~# pwd
/root
root@Thinkpad:~#3 安装OpenClaw
root@Thinkpad:~# curl -fsSL https://openclaw.ai/install.sh | bash
🦞 OpenClaw Installer
Shell yeah—I'm here to pinch the toil and leave you the glory.
✓ Detected: linux
Install plan
OS: linux
Install method: npm
Requested version: latest
[1/3] Preparing environment
✓ Node.js v22.22.1 found
· Active Node.js: v22.22.1 (/usr/bin/node)
· Active npm: 10.9.4 (/usr/bin/npm)
[2/3] Installing OpenClaw
✓ Git already installed
· Installing OpenClaw v2026.3.12
✓ OpenClaw npm package installed
✓ OpenClaw installed
[3/3] Finalizing setup
🦞 OpenClaw installed successfully (OpenClaw 2026.3.12 (6472949))!
cracks claws Alright, what are we building?
· Starting setup
🦞 OpenClaw 2026.3.12 (6472949) — If you can describe it, I can probably automate it—or at least make it funnier.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░██
██░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░██
██░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
🦞 OPENCLAW 🦞◇ I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?
│ Yes◇ Onboarding mode
│ QuickStart◇ Model/auth provider
│ Skip for now◇ Filter models by provider
│ All providers◇ Default model
│ Keep current (default: anthropic/claude-opus-4-6)◇ Select channel (QuickStart)
│ Skip for now◇ Search provider
│ Skip for now◇ Configure skills now? (recommended)
│ No◇ Enable hooks?
│ Skip for now◇ How do you want to hatch your bot?
│ Hatch in TUI (recommended)openclaw tui - ws://127.0.0.1:18789 - agent main - session main
session agent:main:main
Wake up, my friend!root@Thinkpad:~# openclaw onboard --install-daemon
🦞 OpenClaw 2026.3.12 (6472949) — Powered by open source, sustained by spite and good documentation.
…………
…………
…………
◓ Installing Gateway service…
Installed systemd service: /root/.config/systemd/user/openclaw-gateway.service
Previous unit backed up to: /root/.config/systemd/user/openclaw-gateway.service.bak
◇ Gateway service installed.
…………
…………
…………root@Thinkpad:~# openclaw dashboard
🦞 OpenClaw 2026.3.12 (6472949) — I don't just autocomplete—I auto-commit (emotionally), then ask you to review (logically).
Dashboard URL: http://127.0.0.1:18789/#token=f47ac10b58cc4372a5670e02b2c3d4795df418813aed3515
Copy to clipboard unavailable.
No GUI detected. Open from your computer:
ssh -N -L 18789:127.0.0.1:18789 root@<host>
Then open:
http://localhost:18789/
http://localhost:18789/#token=f47ac10b58cc4372a5670e02b2c3d4795df418813aed3515
Docs:
https://docs.openclaw.ai/gateway/remote
https://docs.openclaw.ai/web/control-ui
root@Thinkpad:~# openclaw onboard --install-daemonroot@Thinkpad:~# openclaw gateway run
🦞 OpenClaw 2026.3.12 (6472949) — Making 'I'll automate that later' happen now.
14:49:47 Gateway failed to start: gateway already running (pid 596); lock timeout after 5000ms
If the gateway is supervised, stop it with: openclaw gateway stop
14:49:47 Port 18789 is already in use.
14:49:47 - pid 596 root: openclaw-gateway (127.0.0.1:18789)
14:49:47 - Gateway already running locally. Stop it (openclaw gateway stop) or use a different port.
14:49:47 Gateway service appears enabled. Stop it first.
14:49:47 Tip: openclaw gateway stop
14:49:47 Or: systemctl --user stop openclaw-gateway.service4 配置OpenClaw
使用浏览器打开“http://localhost:18789/”。保存Token后会自动跳转到面板页面。在Web UI的左侧菜单栏中选择配置 > RAW(或Config > RAW)。首次配置:复制以下内容到Raw JSONS输入框,替换已有内容。已有配置:若需保留已有配置,请勿直接全量替换,详见已有配置如何安全修改?将YOUR_API_KEY替换为Coding Plan 专属 API Key。(内容参考https://bailian.console.aliyun.com/cn-beijing/?tab=doc#/doc/?...){
"models": {
"mode": "merge",
"providers": {
"bailian": {
"baseUrl": "https://coding.dashscope.aliyuncs.com/v1",
"apiKey": "YOUR_API_KEY",
"api": "openai-completions",
"models": [
{
"id": "qwen3.5-plus",
"name": "qwen3.5-plus",
"reasoning": false,
"input": ["text", "image"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 1000000,
"maxTokens": 65536,
"compat": {
"thinkingFormat": "qwen"
}
},
{
"id": "qwen3-max-2026-01-23",
"name": "qwen3-max-2026-01-23",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 262144,
"maxTokens": 65536,
"compat": {
"thinkingFormat": "qwen"
}
},
{
"id": "qwen3-coder-next",
"name": "qwen3-coder-next",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 262144,
"maxTokens": 65536
},
{
"id": "qwen3-coder-plus",
"name": "qwen3-coder-plus",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 1000000,
"maxTokens": 65536
},
{
"id": "MiniMax-M2.5",
"name": "MiniMax-M2.5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 196608,
"maxTokens": 32768
},
{
"id": "glm-5",
"name": "glm-5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 202752,
"maxTokens": 16384,
"compat": {
"thinkingFormat": "qwen"
}
},
{
"id": "glm-4.7",
"name": "glm-4.7",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 202752,
"maxTokens": 16384,
"compat": {
"thinkingFormat": "qwen"
}
},
{
"id": "kimi-k2.5",
"name": "kimi-k2.5",
"reasoning": false,
"input": ["text", "image"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 262144,
"maxTokens": 32768,
"compat": {
"thinkingFormat": "qwen"
}
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "bailian/qwen3.5-plus"
},
"models": {
"bailian/qwen3.5-plus": {},
"bailian/qwen3-max-2026-01-23": {},
"bailian/qwen3-coder-next": {},
"bailian/qwen3-coder-plus": {},
"bailian/MiniMax-M2.5": {},
"bailian/glm-5": {},
"bailian/glm-4.7": {},
"bailian/kimi-k2.5": {}
}
}
},
"gateway": {
"mode": "local"
}
}
保存并更新后,可以在面板的对话界面进行测试,如果AI可以回答问题了,说明配置成功。5 配置QQ机器人
在WLS中安装qqbot插件。命令为“openclaw plugins install @tencent-connect/openclaw-qqbot@latest”root@Thinkpad:~# openclaw plugins install @tencent-connect/openclaw-qqbot@latest
🦞 OpenClaw 2026.3.12 (6472949) — Half butler, half debugger, full crustacean.
Downloading @tencent-connect/openclaw-qqbot@latest…
Extracting /tmp/openclaw-npm-pack-upu88E/tencent-connect-openclaw-qqbot-1.5.7.tgz…
……
……
……
Installing to /root/.openclaw/extensions/openclaw-qqbot…
Installing plugin dependencies…
15:05:00 [plugins] plugins.allow is empty; discovered non-bundled plugins may auto-load: openclaw-qqbot (/root/.openclaw/extensions/openclaw-qqbot/index.ts). Set plugins.allow to explicit trusted ids.
Config overwrite: /root/.openclaw/openclaw.json (sha256 161846249db5f18e688d9d4038bdda9343ed504144da154a713a2ca35d1a04c6 -> 5157ac1b0126623a322d119bdb965570fa6fea6b1c70665d4e5b60246d1aba1a, backup=/root/.openclaw/openclaw.json.bak)
Installed plugin: openclaw-qqbot
Restart the gateway to load plugins.root@Thinkpad:~# openclaw channels add --channel qqbot --token "278327832:a5670e02b2c3d479"
🦞 OpenClaw 2026.3.12 (6472949) — I'll do the boring stuff while you dramatically stare at the logs like it's cinema.
……
……
……
Config overwrite: /root/.openclaw/openclaw.json (sha256 5157ac1b0126623a322d119bdb965570fa6fea6b1c70665d4e5b60246d1aba1a -> 529ee83c14e2204063a5c9497694332008e8eaa6fe922c5506a5736e1a5a3683, backup=/root/.openclaw/openclaw.json.bak)
Added QQ Bot account "default".root@Thinkpad:~# openclaw gateway restart
🦞 OpenClaw 2026.3.12 (6472949) — Alexa, but with taste.
……
……
……
Restarted systemd service: openclaw-gateway.service
6 控制浏览器
root@Thinkpad:~# openclaw browser extension install
🦞 OpenClaw 2026.3.12 (6472949) — Half butler, half debugger, full crustacean.
……
……
~/.openclaw/browser/chrome-extension
Copy to clipboard unavailable.
Next:
- Chrome → chrome://extensions → enable “Developer mode”
- “Load unpacked” → select: ~/.openclaw/browser/chrome-extension
- Pin “OpenClaw Browser Relay”, then click it on the tab (badge shows ON)
Docs: docs.openclaw.ai/tools/chrome-extension
root@Thinkpad:~# openclaw browser extension path
🦞 OpenClaw 2026.3.12 (6472949) — Built by lobsters, for humans. Don't question the hierarchy.
~/.openclaw/browser/chrome-extension
……
……