在 Ubuntu 上快速部署 OpenClaw 完整教程

在 Ubuntu 上快速部署 OpenClaw 完整教程

文章目录

在 Ubuntu 上部署 OpenClaw 完整教程

本文记录我在 Ubuntu 22.04 服务器上从零部署 OpenClaw 并接入飞书的完整过程,包括遇到的坑和解决方法。

环境信息

  • 系统: Ubuntu 22.04 LTS
  • 配置: 4核 8GB 内存,100M 带宽
  • 类型 CPU

一、安装依赖

1.1 更新系统包索引

sudoapt update 

1.2 安装 curl

sudoaptinstall-ycurl

1.3 通过 NodeSource 安装最新稳定 LTS 版本

# 添加 NodeSource 仓库并安装curl-fsSL https://deb.nodesource.com/setup_lts.x |sudo-Ebash - sudoapt-getinstall-y nodejs # 安装完成后,验证版本node-vnpm-v

实际输出:

ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ node-v v24.14.0 ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ npm-v11.9.0 

1.4 设置淘宝镜像(最常用)

npm config set registry https://registry.npmmirror.com # 查询是否配置成功npm config get registry 

验证输出:

ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ npm config get registry https://registry.npmmirror.com 

二、安装 OpenClaw

执行安装脚本(注意:安装过程中要勾选 yes):

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

完整安装日志:

 ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ curl-fsSL https://openclaw.ai/install.sh |bash 🦞 OpenClaw Installer The only crab in your contacts you actually want to hear from. 🦞 ✓ 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 · Configuring npmfor user-local installs ✓ npm configured for user installs · Installing OpenClaw v2026.2.26 ✓ OpenClaw npm package installed ✓ OpenClaw installed [3/3] Finalizing setup !PATH missing npm global bin dir: /home/ubuntu/.npm-global/bin This can make openclaw show as "command not found"in new terminals. Fix (zsh: ~/.zshrc, bash: ~/.bashrc): exportPATH="/home/ubuntu/.npm-global/bin:$PATH" 🦞 OpenClaw installed successfully (2026.2.26)! All done! I promise to only judge your code a little bit. · Starting setup 🦞 OpenClaw 2026.2.26 (bc50708) — Ship fast, log faster. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ ██░▄▄▄░██░▄▄░██░▄▄▄██░▀██░██░▄▄▀██░████░▄▄▀██░███░██ ██░███░██░▀▀░██░▄▄▄██░█░█░██░█████░████░▀▀░██░█░█░██ ██░▀▀▀░██░█████░▀▀▀██░██▄░██░▀▀▄██░▀▀░█░██░██▄▀▄▀▄██ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ 🦞 OPENCLAW 🦞 ┌ OpenClaw onboarding │ ◇ Security ─────────────────────────────────────────────────────────────────────────────────╮ │ │ │ Security warning — please read. │ │ │ │ OpenClaw is a hobby project and still in beta. Expect sharp edges. │ │ By default, OpenClaw is a personal agent: one trusted operator boundary. │ │ This bot can read files and run actions if tools are enabled. │ │ A bad prompt can trick it into doing unsafe things. │ │ │ │ OpenClaw is not a hostile multi-tenant boundary by default. │ │ If multiple users can message one tool-enabled agent, they share that delegated tool │ │ authority. │ │ │ │ If you’re not comfortable with security hardening and access control, don’t run │ │ OpenClaw. │ │ Ask someone experienced to help before enabling tools or exposing it to the internet. │ │ │ │ Recommended baseline: │ │ - Pairing/allowlists + mention gating. │ │ - Multi-user/shared inbox: split trust boundaries (separate gateway/credentials, ideally │ │ separate OS users/hosts). │ │ - Sandbox + least-privilege tools. │ │ - Shared inboxes: isolate DM sessions (`session.dmScope: per-channel-peer`) and keep │ │ tool access minimal. │ │ - Keep secrets out of the agent’s reachable filesystem. │ │ - Use the strongest available model for any bot with tools or untrusted inboxes. │ │ │ │ Run regularly: │ │ openclaw security audit --deep │ │ openclaw security audit --fix │ │ │ │ Must read: https://docs.openclaw.ai/gateway/security │ │ │ ├────────────────────────────────────────────────────────────────────────────────────────────╯ │ ◇ I understand this is personal-by-default and shared/multi-user use requires lock-down. Continue? │ Yes │ ◇ Onboarding mode │ QuickStart │ ◇ QuickStart ─────────────────────────╮ │ │ │ Gateway port: 18789 │ │ Gateway bind: Loopback (127.0.0.1) │ │ Gateway auth: Token (default) │ │ Tailscale exposure: Off │ │ Direct to chat channels. │ │ │ ├──────────────────────────────────────╯ │ ◇ Model/auth provider │ Z.AI │ ◇ Z.AI auth method │ CN │ ◇ How do you want to provide this API key? │ Paste API key now │ ◇ Enter Z.AI API key │ xxx.xxxx │ ◇ Model configured ───────────────╮ │ │ │ Default model set to zai/glm-5 │ │ │ ├──────────────────────────────────╯ │ ◇ Default model │ zai/glm-4.7 │ ◇ 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 │ │ │ ├─────────────────────────────────────────────╯ │ ◇ How channels work ───────────────────────────────────────────────────────────────────────╮ │ │ │ DM security: default is pairing; unknown DMs get a pairing code. │ │ Approve with: openclaw pairing approve <channel><code> │ │ Public DMs require dmPolicy="open" + allowFrom=["*"]. │ │ Multi-user DMs: run: openclaw config set session.dmScope "per-channel-peer"(or │ │ "per-account-channel-peer"for multi-account channels) to isolate sessions. │ │ Docs: channels/pairing │ │ │ │ Telegram: simplest way to get started — register a bot with @BotFather and get going. │ │ WhatsApp: works with your own number; recommend a separate phone + eSIM. │ │ Discord: very well supported right now. │ │ IRC: classic IRC networks with DM/channel routing and pairing controls. │ │ Google Chat: Google Workspace Chat app with HTTP webhook. │ │ Slack: supported (Socket Mode). │ │ Signal: signal-cli linked device;more setup (David Reagans: "Hop on Discord."). │ │ iMessage: this is still a work in progress. │ │ Feishu: 飞书/Lark enterprise messaging with doc/wiki/drive tools. │ │ Nostr: Decentralized protocol; encrypted DMs via NIP-04. │ │ Microsoft Teams: Bot Framework; enterprise support. │ │ Mattermost: self-hosted Slack-style chat;install the plugin to enable. │ │ Nextcloud Talk: Self-hosted chat via Nextcloud Talk webhook bots. │ │ Matrix: open protocol;install the plugin to enable. │ │ BlueBubbles: iMessage via the BlueBubbles mac app + REST API. │ │ LINE: LINE Messaging API bot for Japan/Taiwan/Thailand markets. │ │ Zalo: Vietnam-focused messaging platform with Bot API. │ │ Zalo Personal: Zalo personal account via QR code login. │ │ Synology Chat: Connect your Synology NAS Chat to OpenClaw with full agent capabilities. │ │ Tlon: decentralized messaging on Urbit;install the plugin to enable. │ │ │ ├───────────────────────────────────────────────────────────────────────────────────────────╯ │ ◇ Select channel (QuickStart) │ Skip for now 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? │ Skip for now Config overwrite: /home/ubuntu/.openclaw/openclaw.json (sha256 f763f7d577aba2ed75a863a91e3e9a116eab6ecc856e7731972988b006426453 -> 8eac9ee80087618bf88b5f7a2f1f6bdb4b5abf5dfa646c22bf65f64e92063204, backup=/home/ubuntu/.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 ubuntu. │ │ │ ├─────────────────────────────────────────╯ │ ◇ Gateway service runtime ────────────────────────────────────────────╮ │ │ │ QuickStart uses Node for the Gateway service(stable + supported). │ │ │ ├──────────────────────────────────────────────────────────────────────╯ │ ◐ Installing Gateway service… Installed systemd service: /home/ubuntu/.config/systemd/user/openclaw-gateway.service ◇ Gateway service installed. │ ◇ Agents: main (default) Heartbeat interval: 30m (main) Session store (main): /home/ubuntu/.openclaw/agents/main/sessions/sessions.json (0 entries) │ ◇ Optional apps ────────────────────────╮ │ │ │ Add nodes for extra features: │ │ - macOS app (system + notifications) │ │ - iOS app (camera/canvas) │ │ - Android app (camera/canvas) │ │ │ ├────────────────────────────────────────╯ │ ◇ Control UI ─────────────────────────────────────────────────────────────────────╮ │ │ │ Web UI: http://127.0.0.1:18789/ │ │ Web UI (with token): │ │ http://127.0.0.1:18789/#token=2962e8f5116c63d86ea9c8224bc8d6445cce2e806ed1e183 │ │ Gateway WS: ws://127.0.0.1:18789 │ │ Gateway: reachable │ │ Docs: https://docs.openclaw.ai/web/control-ui │ │ │ ├──────────────────────────────────────────────────────────────────────────────────╯ │ ◇ Start TUI (best option!) ─────────────────────────────────╮ │ │ │ This is the defining action that makes your agent you. │ │ Please take your time. │ │ The more you tell it, the better the experience will be. │ │ We will send: "Wake up, my friend!" │ │ │ ├────────────────────────────────────────────────────────────╯ │ ◇ Token ─────────────────────────────────────────────────────────────────────────────────╮ │ │ │ Gateway token: shared auth for the Gateway + Control UI. │ │ Stored in: ~/.openclaw/openclaw.json (gateway.auth.token) or OPENCLAW_GATEWAY_TOKEN. │ │ View token: openclaw config get gateway.auth.token │ │ Generate token: openclaw doctor --generate-gateway-token │ │ Web UI stores a copy in this browser's localStorage (openclaw.control.settings.v1). │ │ Open the dashboard anytime: openclaw dashboard --no-open │ │ If prompted: paste the token into Control UI settings (or use the tokenized dashboard │ │ URL). │ │ │ ├─────────────────────────────────────────────────────────────────────────────────────────╯ │ ◇ How do you want to hatch your bot? │ Open the Web UI │ ◇ Dashboard ready ────────────────────────────────────────────────────────────────╮ │ │ │ Dashboard link(with token): │ │ http://127.0.0.1:18789/#token=2962e8f5116c63d86ea9c8224bc8d6445cce2e806ed1e183 │ │ Copy/paste this URL in a browser on this machine to control OpenClaw. │ │ No GUI detected. Open from your computer: │ │ ssh-N-L18789:127.0.0.1:18789 [email protected] │ │ Then open: │ │ http://localhost:18789/ │ │ http://localhost:18789/#token=2962e8f5116c63d86ea9c8224bc8d6445cce2e806ed1e183 │ │ Docs: │ │ https://docs.openclaw.ai/gateway/remote │ │ https://docs.openclaw.ai/web/control-ui │ │ │ ├──────────────────────────────────────────────────────────────────────────────────╯ │ ◇ Workspace backup ────────────────────────────────────────╮ │ │ │ Back up your agent workspace. │ │ Docs: https://docs.openclaw.ai/concepts/agent-workspace │ │ │ ├───────────────────────────────────────────────────────────╯ │ ◇ Security ──────────────────────────────────────────────────────╮ │ │ │ Running agents on your computer is risky — harden your setup: │ │ https://docs.openclaw.ai/security │ │ │ ├─────────────────────────────────────────────────────────────────╯ │ ◇ Shell completion ────────────────────────────────────────────────────────╮ │ │ │ Shell completion installed. Restart your shell or run: source ~/.bashrc │ │ │ ├───────────────────────────────────────────────────────────────────────────╯ │ ◇ Web search (optional) ─────────────────────────────────────────────────────────────────╮ │ │ │ If you want your agent to be able to search the web, you’ll need an API key. │ │ │ │ OpenClaw uses Brave Search for the `web_search` tool. Without a Brave Search API key, │ │ web search won’t work. │ │ │ │ Set it up interactively: │ │ - Run: openclaw configure --section web │ │ - Enable web_search and paste your Brave Search API key │ │ │ │ Alternative: set BRAVE_API_KEY in the Gateway environment (no config changes). │ │ Docs: https://docs.openclaw.ai/tools/web │ │ │ ├─────────────────────────────────────────────────────────────────────────────────────────╯ │ ◇ What now ─────────────────────────────────────────────────────────────╮ │ │ │ What now: https://openclaw.ai/showcase ("What People Are Building"). │ │ │ ├────────────────────────────────────────────────────────────────────────╯ │ └ Onboarding complete. Use the dashboard link above to control OpenClaw. ubuntu@gt-ubuntu22-04-cmd-v3-0-8gb-100m:~$ 

三、解决 PATH 问题

安装完成后,如果执行 which openclaw 找不到命令,需要手动配置 PATH:

# 检查 openclaw 是否在 PATH 中which openclaw # 如果找不到,查看 npm 全局安装目录npm prefix -g# 查看当前 shellecho$SHELL# 如果输出 /bin/bash,使用 ~/.bashrc# 如果输出 /bin/zsh,使用 ~/.zshrc# 将 npm 全局 bin 目录添加到 PATHecho'export PATH="$(npm prefix -g)/bin:$PATH"'>> ~/.bashrc # 重新加载配置文件source ~/.bashrc # 验证添加是否成功echo$PATH|grepnpm

四、访问控制界面

4.1 本地ssh连接服务器

在本地电脑执行,按提示输入远程linux云主机密码即可:

ssh-N-L18789:127.0.0.1:18789 ubuntu@你的云主机IP 
在这里插入图片描述

4.2 访问openclaw web ui

携带部署过程中生成的Dashboard link在本地进行访问,如下图:

http://localhost:18789/#token=你的token
在这里插入图片描述

4.3 测试

  1. 询问背后模型,如下图告知是glm4.7,与配置的一致

给AI助手起名为“大衍AI”,如下图,可切换界面等待其生效

在这里插入图片描述


在这里插入图片描述

五、总结

本文详细记录了在 Ubuntu 22.04 服务器上从零部署 OpenClaw 的完整流程,包括:

  • 环境准备:Node.js LTS 安装与 npm 镜像配置
  • OpenClaw 安装:通过官方脚本一键安装,处理 PATH 配置问题
  • 初始化配置:QuickStart 模式、Z.AI 模型接入
  • 远程访问:通过 SSH 隧道访问 Web 控制界面进行问答

六、后续内容预告

OpenClaw 的功能远不止于此,接下来我将在博客和B站频道推出更多深度内容,包括:

  • 🔧 进阶配置:自定义 Skills 技能、Hooks 自动化、多 Agent 管理
  • 🔒 安全加固:生产环境部署、访问控制、审计日志配置
  • 🛠️ 插件开发:自定义飞书工具插件、接入企业内部系统
  • 🤖 模型调优:Prompt 工程、多模型切换、上下文管理
  • 📊 实战案例:搭建团队知识库助手、自动化工作流机器人

六、视频教程

如果您觉得文字教程不够直观,欢迎访问我的 B 站频道观看完整视频版部署教程:

👉 点击观看《Ubuntu 部署 OpenClaw 手把手教学》

视频中我会实时演示每一步操作,详细讲解配置选项的含义,并演示如何在飞书中与机器人进行交互。建议搭配本文一起食用,效果更佳!

Read more

麦麦机器人:QQ群聊AI助手的终极部署指南

麦麦机器人:QQ群聊AI助手的终极部署指南 【免费下载链接】MaiMBot麦麦bot,一款专注于 群组聊天 的赛博网友(非常专注)QQ BOT 项目地址: https://gitcode.com/gh_mirrors/ma/MaiMBot 想要为你的QQ群添加一个智能对话助手吗?麦麦机器人正是你需要的QQ聊天机器人解决方案。这款专注于群组聊天的智能对话助手能够为你的群聊带来前所未有的互动体验。无论你是技术新手还是资深开发者,这份完整教程都能帮助你快速上手这款强大的群聊机器人。 为什么选择麦麦机器人 麦麦机器人区别于传统QQ聊天机器人的核心优势在于其拟人化交互和智能对话能力。它不仅仅是一个简单的自动回复工具,而是真正理解上下文、拥有记忆功能的智能对话助手。通过大语言模型的支持,机器人能够进行有深度的对话,记住群友的偏好,甚至主动发起有趣的话题讨论。 核心功能深度体验 智能对话系统 麦麦机器人的大脑采用先进的大语言模型,能够理解复杂的对话上下文。与传统的规则式回复不同,它能够根据群聊氛围调整回复风格,从严肃讨论到轻松调侃都能轻松应对。 记忆与情感管理 通过src/

By Ne0inhk

Flowise物联网融合:与智能家居设备联动的应用设想

Flowise物联网融合:与智能家居设备联动的应用设想 1. Flowise:让AI工作流变得像搭积木一样简单 Flowise 是一个真正把“AI平民化”落地的工具。它不像传统开发那样需要写几十行 LangChain 代码、配置向量库、调试提示词模板,而是把所有这些能力打包成一个个可拖拽的节点——就像小时候玩乐高,你不需要懂塑料怎么合成,只要知道哪块该拼在哪,就能搭出一座城堡。 它诞生于2023年,短短一年就收获了45.6k GitHub Stars,MIT协议开源,意味着你可以放心把它用在公司内部系统里,甚至嵌入到客户交付的产品中,完全不用担心授权问题。最打动人的不是它的技术多炫酷,而是它真的“不挑人”:产品经理能搭出知识库问答机器人,运营同学能配出自动抓取竞品文案的Agent,连刚学Python两周的实习生,也能在5分钟内跑通一个本地大模型的RAG流程。 它的核心逻辑很朴素:把LangChain里那些抽象概念——比如LLM调用、文档切分、向量检索、工具调用——变成画布上看得见、摸得着的方块。你拖一个“Ollama LLM”节点,再拖一个“Chroma Vector

By Ne0inhk
【花雕学编程】Arduino BLDC 之多机器人网格化协同勘探系统

【花雕学编程】Arduino BLDC 之多机器人网格化协同勘探系统

基于 Arduino 的无刷直流电机(BLDC)多机器人网格化协同勘探系统,是多智能体系统(MAS)与高效机电一体化技术深度融合的尖端应用。该系统通过将未知环境划分为逻辑网格,并利用分布式算法协调多个 BLDC 驱动的机器人节点,实现对目标区域的并行、高效、无遗漏探测。 1、主要特点 分布式协同与网格化任务分配 系统的核心在于多机器人之间的去中心化协作逻辑,通过网格化管理将宏观的勘探任务分解为微观的单元格任务。 Voronoi 图与拍卖算法: 系统通常采用 Voronoi 图分割机制,根据各机器人的实时位置动态划分探索区域,确保每个单元格距离其负责的机器人最近。当发现新的未知区域(前沿)时,通过分布式拍卖算法(Distributed Auction Algorithm)进行协商:各机器人根据自身距离、剩余电量和任务负载出价,最终由“成本”最低的机器人认领该网格,从而避免路径重复和资源浪费。 前沿扩展策略: 每台机器人利用机载传感器(如激光雷达)构建局部地图,识别已知区域与未知区域的边界(即“前沿”)。通过评估前沿的信息增益(Information

By Ne0inhk
windows部署的OpenClaw接入飞书机器人

windows部署的OpenClaw接入飞书机器人

文章目录 * 前言 * 一、创建飞书应用 * 1.登录飞书开放平台 * 2.创建企业自建应用 * 3.发布企业自建应用 * 二、OpenClaw配置接入飞书 * 1.安装飞书插件 * 2.配置飞书事件回调 * 3.使用测试 * 总结 前言 OpenClaw 原生支持的即时通信平台主要是海外的 WhatsApp、Telegram、Discord、Slack、iMessage 等,国内用户不习惯,目前国产即时通信软件大厂也跟进了,现在钉钉,飞书等都已支持接入OpenClaw,本文主要是配置飞书机器人接入 OpenClaw,使大家可以通过飞书即可指挥OpenClaw为我们干活,当然配置钉钉接入也可以作为参考。 * windowsWindows 本地(PowerShell)一键部署 OpenClaw * 飞书账号(有飞书开放平台权限的账号) 一、创建飞书应用 1.登录飞书开放平台 1.1 网页访问,

By Ne0inhk