OpenClaw 安装文档(Ubuntu 20.04 适配版)
文档说明
本文档基于 Ubuntu 20.04 系统,整理了 OpenClaw 完整安装流程、安装过程中遇到的核心问题及针对性解决方法,适配国内网络环境,可直接参考操作。
一、环境准备
1. 基础依赖安装
# 更新系统源
sudo apt update && sudo apt upgrade -y
# 安装基础编译/网络工具
sudo apt install -y git build-essential curl wget libssl-dev libuv1-dev pkg-config zlib1g-dev
2. Node.js 环境安装(OpenClaw 依赖 Node.js ≥18)
# 添加 Node.js 22.x 源
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
# 安装 Node.js
sudo apt install -y nodejs
# 验证版本(需 ≥22.x)
node --version
npm --version
二、OpenClaw 安装步骤
步骤 1:配置国内加速(解决 GitHub/NPM 网络问题)
# 1. NPM 切换国内镜像
npm config set registry https://mirrors.cloud.tencent.com/npm/
# 2. Git 配置 GitHub 加速(自动替换 SSH 为 HTTPS + 镜像)
git config --global url."https://github.com/".insteadOf "[email protected]:"
git config --global url."https://ghproxy.com/https://github.com/".insteadOf "https://github.com/"
# 3. 修复 NPM 全局安装权限
sudo chown -R $USER:$USER ~/.npm
sudo chown -R $USER:$USER /usr/local/lib/node_modules
步骤 2:升级 CMake(解决 llama.cpp 编译依赖)
Ubuntu 20.04 默认 CMake 3.16.3 低于 OpenClaw 要求的 3.19+,需手动升级:
apt remove -y cmake
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
| /etc/apt/sources.list.d/kitware.list >/dev/null
apt update
apt install -y cmake
cmake --version

