1. 环境准备
1.1 环境说明
硬件:虚拟机 4C8G 系统:Ubuntu 24.04 LTS 网络:有线/WiFi OpenClaw 版本:2026.3.x
1.2 前置条件
- 已安装 Ubuntu 24.04 LTS 且可联网
- 拥有 sudo 权限
- 有 AI 模型账号(如 OpenAI / Qwen 等)
- 备用设备浏览器(用于 OAuth 授权和访问 Dashboard)
2. 安装操作
2.1 更新系统
sudo apt update && sudo apt upgrade -y
2.2 安装基础配置
sudo apt install -y curl git
3. 安装 Node.js
OpenClaw 要求 Node.js ≥ 22。查询当前系统的 NodeJS 版本,如果未安装请先安装。
3.1 查看当前系统是否安装
node --version
若提示找不到命令,可通过以下软件包安装。
3.2 安装 NodeJS
apt install nodejs npm
3.3 查询安装版本
npm --version
node --version
3.4 升级 Node.js
3.4.1 先卸载旧版本(可选,避免冲突)
apt remove --purge nodejs npm
apt autoremove
3.4.2 添加 NodeSource 官方源(以 v24 为例)
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
3.4.3 安装新版 Node.js
apt install -y nodejs
3.4.4 验证升级
node -v
npm -v
4. 配置 npm 全局安装目录
4.1 创建用户级全局目录
mkdir -p ~/.npm-global
npm config set prefix '~/.npm-global'
4.2 添加 PATH 环境变量
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
4.3 验证配置
npm config get prefix
5. 配置 Git
5.1 配置 Git 使用 HTTPS(避免 SSH 权限问题)
git config --global url.\"https://github.com/\".insteadOf ssh://[email protected]/
git config --global url.\"https://\".insteadOf ssh://
5.2 优化 Git 超时设置
git config --global http.postBuffer 524288000
git config --global http.lowSpeedLimit 0
git config --global http.lowSpeedTime 999999
5.3 配置 npm 使用国内镜像(可选,加速下载)
npm config set registry https://registry.npmmirror.com
注意:如果使用国内镜像后安装出问题,可以切回官方源:
npm config set registry https://registry.npmjs.org/。 或者用这个git config --global url.\"https://mirror.ghproxy.com/https://github.com/\".insteadOf \"https://github.com/\"
5.4 验证 GitHub 连接
ping -c 3 github.com
6. 安装 OpenClaw
6.1 安装命令
curl -fsSL https://openclaw.ai/install.sh | bash
安装过程可能需要几分钟,取决于网络速度。如果出现 EBADENGINE 警告但安装继续,通常可以忽略。
6.2 安装过程
curl -fsSL https://openclaw.ai/install.sh | bash
输出示例:
🦞 OpenClaw Installer I keep secrets like a vault...
✓ Detected: linux
Install plan OS: linux
Install method: npm
Requested version: latest
[1/3] Preparing environment
✓ Node.js v24.14.0 found
Active Node.js: v24.14.0 (/usr/bin/node)
Active npm: 11.9.0 (/usr/bin/npm)
[2/3] Installing OpenClaw
✓ Git already installed
Installing OpenClaw v2026.3.2
✓ OpenClaw npm package installed
✓ OpenClaw installed
[3/3] Finalizing setup
🦞 OpenClaw installed successfully (2026.3.2)!


