你可以不用带私货和魔改的云厂商预装镜像:中国大陆原汁原味 OpenClaw 快速安装指南,通过 Node.js 国内源安装官方原版

你可以不用带私货和魔改的云厂商预装镜像:中国大陆原汁原味 OpenClaw 快速安装指南,通过 Node.js 国内源安装官方原版

     创建:26-03-03 22:53    修改:26-03-08 18:20


最近试玩了几家云厂商的预装小龙虾主机,体验不算理想,记录一下坑点。以 2026年3月初 在阿里云和腾讯云一键安装OpenClaw 2026.2.26版的经历为代表:

预装镜像的几大问题

第一,有些厂商的"一键"名不副实。 在阿里云装完设置完,小龙虾原生的Web界面死活打不开,自己翻日志查文档加上自己猜测才搞定。感觉厂商为了抢红利,上线有点仓促,倒是也可以理解,但相关文档也不太行就有些拉跨了,见下一条。

第二,文档多但杂。 阿里云的网站上,文档不成体系,遇到问题你得自己搜,搜出来,这个问题这篇旧文章说这样改,那篇说那样改,一看都不是最新版。问阿里家自家的AI千问也不能准确回答。阿里家的OpenClaw支持似乎主要靠钉钉群支持用户(而且几个群全部满员),公开文档不太受重视,可能也有推他家钉钉工具、希望能和用户建立连接的特殊考虑吧。官方文档这方面腾讯云做得比阿里云好。

第三,预装镜像小心思太多。 改了不少 OpenClaw 的标准配置,比如很难配其他家大模型API,默认只提供阿里云自家的Coding Plan服务(问题是阿里云的Coding Plan里自家的Qwen 3.5 plus还是很平庸,而GLM5,Kimi 2.5又限流严重不稳定);也没法按OpenClaw官方标准方法去自行修改/安装/升级一些配置(比如我想安装最新版的openclaw-china的企业微信app应用插件),极可能把预装的环境搞坏。这方面也是腾讯云比阿里云要好一些,可以接入其他家大模型,而且配置Skill的安装升级功能呢在应用管理面板上也做得比较方便和开放一些。

第四,无法标准升级,而且提供的升级方法有破坏性。 没法用原版自带的升级功能,得用镜像的升级工具(阿里云好像只给了最破坏性的最新镜像完整重装的方法),但对已经调好的配置和积累的数据好像无法保留。这方面也是腾讯云比阿里云略好一些,有一键升级到新版本功能,虽然也坦白某些配置是会收到破坏影响的。

再说一遍,以上是2026年3月初的一个情况,后面也许各家都会逐渐改进吧。

因为有上述问题,所以我先整理了一套相对快、相对干净的方案,用国内比较正宗的Node.js的CDN源,在Ubuntu上安装原汁原味的官方OpenClaw版本。

安装步骤

首先做安装 Node.js的准备(使用 NodeSource 国内加速)

apt update

安装 curl(如果尚未安装)

apt install curl -y

下载并执行 NodeSource 的安装脚本,设置 Node.js 24.x 的源

curl -fsSL https://deb.nodesource.com/setup_24.x | bash -

安装 Node.js 和 npm

apt-get install -y nodejs

设置 npm 使用淘宝镜像源

npm config set registry https://registry.npmmirror.com

验证配置是否成功

npm config get registry

通过镜像安装原版 OpenClaw

npm install -g openclaw@latest

初始化OpenClaw。

安装好后,运行如下命令,并选择manual模式配置,请见如下示例(示例中,我用了平庸但还算便宜的qwen3.5-plus,首月CodingPlan 7.9元。很多人说Minimax的套餐也是便宜好用的。我公司里用的是Kimi的K2.5,想用GLM5但是抢购状态抢不到)。

openclaw onboard --install-daemon

◇  I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue?
│  Yes
│
◇  Onboarding mode
│  Manual
│
◇  What do you want to set up?
│  Local gateway (this machine)
│
◇  Workspace directory
│  /root/.openclaw/workspace
│
◇  Model/auth provider
│  Custom Provider
│
◇  API Base URL
│  https://coding.dashscope.aliyuncs.com/apps/anthropic
│
◇  How do you want to provide this API key?
│  Paste API key now
│
◇  API Key (leave blank if not required)
│  sk-sp-b0b1122222222222222222222091
│
◇  Endpoint compatibility
│  Anthropic-compatible
│
◇  Model ID
│  qwen3.5-plus
│
◇  Verification successful.
│
◇  Endpoint ID
│  custom-coding-dashscope-aliyuncs-com
│
◇  Model alias (optional)
│  qwen3.5-plus
Configured custom provider: custom-coding-dashscope-aliyuncs-com/qwen3.5-plus
│
◇  Gateway port
│  18789
│
◇  Gateway bind
│  LAN (0.0.0.0)
│
◇  Gateway auth
│  Token
│
◇  Tailscale exposure
│  Off
│
◇  Gateway token (blank to generate)
│
│
◇  Channel status ────────────────────────────╮
│                                             │
│  Telegram: needs token                      │
│  WhatsApp (default): not linked             │
│  Discord: needs token                       │
│  Slack: needs tokens                        │
│  Signal: needs setup                        │
│  signal-cli: missing (signal-cli)           │
│  iMessage: needs setup                      │
│  imsg: missing (imsg)                       │
│  IRC: not configured                        │
│  Google Chat: not configured                │
│  Feishu: install plugin to enable           │
│  Google Chat: install plugin to enable      │
│  Nostr: install plugin to enable            │
│  Microsoft Teams: install plugin to enable  │
│  Mattermost: install plugin to enable       │
│  Nextcloud Talk: install plugin to enable   │
│  Matrix: install plugin to enable           │
│  BlueBubbles: install plugin to enable      │
│  LINE: install plugin to enable             │
│  Zalo: install plugin to enable             │
│  Zalo Personal: install plugin to enable    │
│  Synology Chat: install plugin to enable    │
│  Tlon: install plugin to enable             │
│                                             │
├─────────────────────────────────────────────╯
│
◇  Configure chat channels now?
│  No
Updated ~/.openclaw/openclaw.json
Workspace OK: ~/.openclaw/workspace
Sessions OK: ~/.openclaw/agents/main/sessions
│
◇  Skills status ─────────────╮
│                             │
│  Eligible: 4                │
│  Missing requirements: 40   │
│  Unsupported on this OS: 7  │
│  Blocked by allowlist: 0    │
│                             │
├─────────────────────────────╯
│
◇  Configure skills now? (recommended)
│  No
│
◇  Hooks ──────────────────────────────────────────────────────────────────╮
│                                                                          │
│  Hooks let you automate actions when agent commands are issued.          │
│  Example: Save session context to memory when you issue /new or /reset.  │
│                                                                          │
│  Learn more: https://docs.openclaw.ai/automation/hooks                   │
│                                                                          │
├──────────────────────────────────────────────────────────────────────────╯
│
◇  Enable hooks?
│  🚀 boot-md, 📎 bootstrap-extra-files, 📝 command-logger, 💾 session-memory
│
◇  Hooks Configured ────────────────────────────────────────────────────────────────╮
│                                                                                   │
│  Enabled 4 hooks: boot-md, bootstrap-extra-files, command-logger, session-memory  │
│                                                                                   │
│  You can manage hooks later with:                                                 │
│    openclaw hooks list                                                            │
│    openclaw hooks enable <name>                                                   │
│    openclaw hooks disable <name>                                                  │
│                                                                                   │
├───────────────────────────────────────────────────────────────────────────────────╯
Config overwrite: /root/.openclaw/openclaw.json (sha256 ec2b477d1b63833ca049b5d1c35e61adae83d4b6829dc1d3c630ad0b3a529f19 -> af8ccdcbf563451b42653ad67f89d5c4b219a463e58292c3dcb755fa0687dc10, backup=/root/.openclaw/openclaw.json.bak)
│
◇  Systemd ────────────────────────────────────────────────────────────────────────────────╮
│                                                                                          │
│  Linux installs use a systemd user service by default. Without lingering, systemd stops  │
│  the user session on logout/idle and kills the Gateway.                                  │
│  Enabling lingering now (may require sudo; writes /var/lib/systemd/linger).              │
│                                                                                          │
├──────────────────────────────────────────────────────────────────────────────────────────╯
│
◇  Systemd ─────────────────────────────╮
│                                       │
│  Enabled systemd lingering for root.  │
│                                       │
├───────────────────────────────────────╯
│
◇  Gateway service runtime
│  Node (recommended)
Error: systemctl is-enabled unavailable: Command failed: systemctl --user is-enabled openclaw-gateway.service

OpenClaw 2026.3.2版上面这个--install-daemon命令可能存在一个问题,会报错OpenClaw Gateway服务无法成功安装,如果发生的话,可以运行openclaw doctor,它会发现这个问题并问你是否解决。而且我看2026.3.2以后github上已经有一条代码修正的记录,估计后续的版本不再会有这个问题。

正式使用OpenClaw前,这几件事一般来说不做用不了:

找到openclaw.json(在Windows上可以使用WinSCP工具远程登录上去,找到并打开这个文件,找到如下这个部分),

    "mode": "local",
    "bind": "lan",
"controlUi": {
      "allowedOrigins": [
        "http://你的IP地址:18789",
        "http://127.0.0.1:18789"
      ],
      "allowInsecureAuth": true,
      "dangerouslyDisableDeviceAuth": true
    },
    "auth": {
      "mode": "token",
      "token": "5f1b17a7df6bde3bed00fa474"
    },

如果你希望从公网通过http或https访问OpenClaw的标准控制界面,你得把访问地址(IP地址也好,域名地址也好)放进allowedOrigins部分。

并且,如果你用http访问它,需要在allowedOrigins后面,确保有"allowInsecureAuth": true,"dangerouslyDisableDeviceAuth": true,没有要加上。如果你用https访问它,应该不需要这两行,可删除。

顺便在这个文件中,记录下前面openclaw在onboard过程中为你随机生成的token,然后就可以尝试在浏览器中输入:http://你的IP地址:18789/#token=XXXXX,看看OpenClaw的标准控制界面是否能打开了。

如果由于回环问题,你在公网上无法打开openclow的控制台, 再检查这两项配置是不是正确地被配为: "mode": "local", "bind": "lan"。

最后还有几个和openclaw本身无关的,把防火墙把相应端口,比如默认的18789给打开。

改完后,用openclaw gateway --verbose尝试启动。

这样应该就干净了。后续OpenClaw的升级、配置都可以走官方渠道和标准操作方法,不会被预装镜像的私货绑架。


评论回复



更多文章和博客...