乐于分享
好东西不私藏

openclaw 基础篇 (安装部署)

openclaw 基础篇 (安装部署)

安装部署

本章将详细介绍 OpenClaw 的三种主流部署方案:官方一键脚本安装npm 手动安装 及 Docker 容器化部署,覆盖从新手极速部署到生产环境稳定运行的全场景需求。

方式一:一键安装脚本(推荐)

macOS / Linux / WSL2

curl -fsSL https://openclaw.ai/install.sh | bash

Windows PowerShell

iwr -useb https://openclaw.ai/install.ps1 | iex
若只想安装、不立即进入向导:
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard

方式二:npm 手动安装

# 确保 Node.js 22+node --version# 全局安装 OpenClawnpm install -g openclaw@latest# 运行配置向导(同时安装守护进程)openclaw onboard --install-daemon

方式三:Docker 部署    

docker pull openclaw/openclaw:latestdocker run -d \  --name openclaw \  -p 18789:18789 \  -v ~/.openclaw:/root/.openclaw \  -e ANTHROPIC_API_KEY=sk-ant-xxx \  openclaw/openclaw:latest

安装后验证是否安装成功

openclaw --versionopenclaw doctoropenclaw gateway statusopenclaw dashboard

若是+ openclaw dashboard 能正常打开,说明网关已可用。

常见问题

命令找不到

npm prefix -gexport PATH="$(npm prefix -g)/bin:$PATH"

sharp 编译失败(macOS 常见)

SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest

端口冲突

lsof -i :18789openclaw gateway --port 19000

网关无法启动

openclaw doctoropenclaw doctor --fixopenclaw logs --follow

点赞、转发、加关注

若您喜欢这篇内容,可点击文章末尾的点赞、分享、推荐。这对您无需花费太多时间,却能为我的成长提供很大助力。感谢您的支持!