从零到一部署私有AI助手Clawdbot完整实践指南保姆级教程

教程37分钟前更新 admin
2 0 0
网心云广告也精彩

什么是 Clawdbot

Clawdbot 开源自托管的个人 AI 助手使WhatsAppTelegramDiscordiMessage

从零到一部署私有AI助手Clawdbot完整实践指南保姆级教程

Moltbot

核心特性

  • 本地优先
  • 多渠道支持 WhatsAppTelegramDiscordSlackSignaliMessage 12+
  • 持久记忆
  • 主动服务 AI
  • 系统级操作Shell

适用场景

  • Web

系统要求

硬件要求

  • 处理器
  • 内存 2GB RAM
  • 存储空间 1GB

软件要求

  • 操作系统

macOS 12.0

LinuxUbuntu 20.04+ / Debian 11+

Windows 10/11 WSL2

  • Node.jsv22.17.0 必须
  • 包管理器npm pnpm

网络要求

  • 访 GitHub clawd.bot

安装方式选择

Clawdbot

npm/pnpm 便
Docker

通过第三方云云直接安装配置

现在各大平台都已经支持这个智能体,如果不想安装在本机,可以一键部署云上Moltbot

云产品福利专区,Clawdbot建议使用 2C4G:https://curl.qcloud.com/74iJUr08

我们可以使用阿里云的轻量级服务器安装:https://www.aliyun.com/activity/ecs/clawdbot

方法一:官方推荐安装(npm/pnpm)

步骤 1:安装 Node.js v22+

检查 Node.js 版本

node --version

v22

使用 nvm(推荐)

# 安装 nvm(如果尚未安装)

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

# 重新加载 shell 配置

source ~/.bashrc # 或 source ~/.zshrc

# 安装 Node.js v22

nvm install 22

nvm use 22

直接下载(macOS/Linux)

访 nodejs.org v22+

步骤 2:全局安装 Clawdbot

使用 npm

npm install -g clawdbot@latest

使用 pnpm(推荐,更快)

# 先安装 pnpm(如果尚未安装)

npm install -g pnpm

# 使用 pnpm 安装 Clawdbot

pnpm add -g clawdbot@latest

步骤 3:验证安装

clawdbot --version

方法二:安装脚本(一键安装)

macOS / Linux 安装

curl -fsSL https://clawd.bot/install.sh | bash

  • Linux/Node.js/Git
  • Clawdbot

Windows 安装(PowerShell)

iwr -useb https://clawd.bot/install.ps1 | iex

注意Windows 使 WSL2

方法三:从源码安装(开发者)

步骤 1:克隆仓库

git clone https://github.com/clawdbot/clawdbot.git

cd clawdbot

步骤 2:安装依赖

使用 pnpm(官方推荐)

# 安装 pnpm(如果尚未安装)

npm install -g pnpm

# 安装项目依赖

pnpm install

步骤 3:构建项目

# 构建 UI(首次运行会自动安装 UI 依赖)

pnpm ui:build

# 构建项目

pnpm build

步骤 4:运行向导

pnpm clawdbot onboard --install-daemon

方法四:Docker 安装

使用官方镜像

docker run -d \

 --name clawdbot \

 -p 18789:18789 \

 -v $(pwd)/config:/app/config \

 -v $(pwd)/data:/app/data \

 clawdbot/clawdbot:latest

使用 docker-compose

docker-compose.yml

version: '3.8'
services:
 clawdbot:
 image: clawdbot/clawdbot:latest
 container_name: clawdbot
 ports:
 - "18789:18789"
 - "18793:18793"
 environment:
 - NODE_ENV=production
 - CLAWD_CONFIG_PATH=/app/config
 volumes:
 - ./config:/app/config
 - ./data:/app/data
 restart: unless-stopped
 healthcheck:
 test: ["CMD", "curl", "-f", "http://localhost:18789/health"]
 interval: 30s
 timeout: 10s
 retries: 3

docker-compose up -d

docker exec -it clawdbot bash

clawdbot onboard

初始化配置

clawdbot onboard --install-daemon

--install-daemon Clawdbot macOS launchd Linux systemd

向导会引导你完成以下配置:

1. 网关模式选择

选择网关运行位置:

- [1] 本地(local)- 推荐,在当前机器上运行

- [2] 远程(remote)- 在远程服务器上运行

新手建议 local

2. AI 模型配置

Clawdbot

支持的模型提供商:

  • Anthropic (Claude) -
  • OpenAI (GPT)
  • API

配置方式:

方式 A:OAuth 认证(推荐)

# 向导会引导你通过浏览器完成 OAuth 授权

# 支持的订阅:

# - Anthropic Claude Pro/Max

# - OpenAI ChatGPT Plus

方式 B:API Key

# 输入你的 API Key

# 例如:sk-ant-xxxxx(Anthropic)

# 或:sk-xxxxx(OpenAI)

获取 API Key:

Anthropic https://console.anthropic.com/
OpenAI https://platform.openai.com/api-keys

 

3. 安全提示

⚠️ 安全提示

Clawdbot agents 可以运行命令、读写文件,

并通过你配置的工具访问任何渠道。

请阅读安全文档:https://docs.clawd.bot/security

是否同意并继续? [Y/n]

Y

4. 启动模式

选择启动模式:

- [1] Quick Start(快速启动)- 推荐新手

- [2] Custom(自定义)- 高级用户

Quick Start 会自动配置:

  • Gateway 18789
  • loopback (127.0.0.1)
  • token
  • Tailscale

Quick Start

5. 聊天渠道配置

选择要配置的聊天渠道:

- [1] Telegram

- [2] WhatsApp

- [3] Discord

- [4] iMessage(仅 macOS)

- [5] 跳过

建议先配置一个渠道进行测试,推荐 Telegram(最简单)。

连接聊天平台

配置 Telegram Bot

步骤 1:创建 Telegram Bot

  1. Telegram @BotFather
  2. /newbot

Bot MyClawdBot

Bot bot myclawdbot

  1. BotFather Token123456789:ABCdefGHIjklMNOpqrsTUVwxyz
  2. 复制这个 Token

步骤 2:配置 Clawdbot

clawdbot channels add telegram --token=你的_BOT_TOKEN

步骤 3:首次配对

  1. Telegram Bot
  2. hello
  3. Bot Pairing code: 1234

clawdbot pairing approve telegram 1234

  1. Bot

配置 WhatsApp

步骤 1:登录 WhatsApp

clawdbot channels login

二维码

步骤 2:扫码连接

  1. WhatsApp
  2. 设置 → 已连接设备
  3. 连接设备

步骤 3:配对设备

Clawdbot

# 查看待批准的配对请求

clawdbot pairing list whatsapp

# 批准配对(替换为实际号码)

clawdbot pairing approve whatsapp +86123456789

配置 Discord

步骤 1:创建 Discord Application

  1. 访 Discord Developer Portal
  2. New Application
  3. Bot Add Bot
  4. Bot Token

步骤 2:启用必要的权限

Bot

  • Message Content Intent
  • Server Members Intent

步骤 3:邀请 Bot 到服务器

  1. OAuth2 → URL Generator
  2. Scopesbot
  3. Bot PermissionsSend MessagesRead Messages/View Channels
  4. URL

步骤 4:配置 Clawdbot

clawdbot channels add discord --token=你的_BOT_TOKEN

配置 iMessage(仅 macOS)

iMessage

# 安装依赖(如果尚未安装)

brew install imessage

# 配置 iMessage 渠道

clawdbot channels add imessage

注意iMessage macOS 使

安全配对

查看待批准的配对请求

# 列出所有渠道的待批准请求

clawdbot pairing list

# 列出特定渠道的待批准请求

clawdbot pairing list telegram

clawdbot pairing list whatsapp

clawdbot pairing list discord

批准配对

# 批准 Telegram 用户的配对(替换配对码)

clawdbot pairing approve telegram 1234

# 批准 WhatsApp 号码的配对(替换手机号)

clawdbot pairing approve whatsapp +86123456789

查看已批准的用户列表

clawdbot pairing list --approved

启动网关

Clawdbot Gateway 进程

如果在向导中安装了服务

Gateway

检查服务状态

# macOS

brew services list | grep clawdbot

# Linux

systemctl --user status clawdbot

手动启动 Gateway

# 启动 Gateway(默认端口 18789)

clawdbot gateway

# 启动并显示详细日志

clawdbot gateway --verbose

# 指定端口

clawdbot gateway --port 18789

# 绑定到 tailnet(用于远程访问)

clawdbot gateway --bind tailnet --token 你的令牌

检查 Gateway 健康状态

clawdbot health

✅ Gateway: Running

✅ Model: Connected

✅ Channels: Connected

访问控制面板

Clawdbot Control UI

访问地址

本地访问:

http://127.0.0.1:18789/
# 或
http://localhost:18789/

控制面板功能

  • 📊 Dashboard
  • 💬 Chat AI
  • Config
  • 📝 Sessions
  • 🔧 Tools
  • 📱 Nodes

远程访问(可选)

访使

方法 A:SSH 隧道

# 在远程机器上建立 SSH 隧道

ssh -L 18789:127.0.0.1:18789 your-server

# 然后在浏览器访问 http://localhost:18789

方法 B:Tailscale Serve

# 配置 Tailscale Serve(tailnet 访问)
clawdbot gateway --bind tailnet --token 你的令牌

Web Surfaces

常见问题排查

问题 1:Node.js 版本过低

错误信息:

Error: Node.js version must be v22 or higher

解决方法:

# 使用 nvm 升级 Node.js
nvm install 22
nvm use 22

问题 2:端口 18789 被占用

错误信息:

Error: Port 18789 is already in use

解决方法:

查找占用进程:

# macOS/Linux

lsof -i :18789

# 或

netstat -tuln | grep 18789

终止进程:

# 替换 PID 为实际进程 ID

kill -9 PID

或使用其他端口:

clawdbot gateway --port 19001

问题 3:API Key 无效

错误信息:

Error: Invalid API key or authentication failed

解决方法:

  1. API Key
  2. API Key
  3. API Key

重新配置模型:

clawdbot onboard

# 或手动编辑配置文件

问题 4:Bot 不响应消息

可能原因:

  1. Gateway
  2. pairing
  3. Bot Token

解决方法:

检查 Gateway 状态:

clawdbot health

检查配对状态:

clawdbot pairing list

查看 Gateway 日志:

# 如果 Gateway 是手动启动的,查看终端输出

# 或查看系统日志

journalctl --user -u clawdbot -f # Linux

log stream --predicate 'process == "clawdbot"' # macOS

问题 5:WhatsApp 连接失败

错误信息:

Error: WhatsApp connection failed

解决方法:

`bash

clawdbot channels logout whatsapp

clawdbot channels login

`

问题 6:Telegram Bot 配对失败

解决方法:

  1. Bot Token
  2. Telegram Bot
`bash

clawdbot pairing approve telegram 

`

问题 7:Windows WSL2 问题

症状:

解决方法:

  1. 使 WSL2
`powershell

wsl --update

`
  1. WSL2
  2. 使 Docker Desktop WSL2

诊断工具

使

clawdbot doctor

  • Gateway

安全注意事项

1. 提示词注入风险

Clawdbot 恶意文件可能触发提示词注入攻击

防护措施:

  • Clawdbot
  • 使sandbox

2. 数据隐私

优点:

注意:

  • API AnthropicOpenAI
  • 使 Ollama

3. 权限控制

默认安全策略:

  • pairing
  • @

配置白名单:

~/.clawdbot/clawdbot.json

// json

{

 "channels": {

 "whatsapp": {

 "allowFrom": ["+86123456789", "+86987654321"],

 "groups": {

 "*": { "requireMention": true }

 }

 },

 "telegram": {

 "allowFrom": [123456789, 987654321]

 }

 }

}

4. API 成本注意

Clawdbot 使 API ClaudeGPT消耗的 Token 会计费

成本预估:

  • 使$10-30/
  • 使$30-70/
  • 使$70-150/

建议:

  • API 使
  • 使 Ollama

进阶配置

配置本地模型(Ollama)

Clawdbot 使

  1. Ollamahttps://ollama.ai/
`bash

ollama pull llama2

`
  1. Clawdbot
`bash

clawawdbot model add ollama

`

Ollama Provider

配置多个 AI 模型

Clawdbot failover

~/.clawdbot/clawdbot.json

// json

{

 "agents": {

 "defaults": {

 "model": {

 "primary": "anthropic/claude-opus-4-5",

 "fallbacks": [

 "anthropic/claude-sonnet-4-5",

 "openai/gpt-4-turbo"

 ]

 }

 }

 }

}

安装技能(Skills)

Clawdbot

浏览技能仓库:

  • https://clawdhub.com/

安装技能:

# 安装技能

clawdbot skills install skill-name

# 列出已安装技能

clawdbot skills list

# 更新技能

clawdbot skills update skill-name

配置定时任务(Cron)

Clawdbot

cron

// json

{

 "cron": {

 "daily_summary": {

 "schedule": "0 8 * * *",

 "message": "Give me a daily summary of my schedule"

 }

 }

}

升级和更新

检查更新

clawdbot update --check

执行更新

clawdbot update

切换开发通道

# 切换到 beta 通道

clawdbot update --channel beta

# 切换回 stable 通道

clawdbot update --channel stable

Updating Guide

卸载

停止服务

# macOS

brew services stop clawdbot

# Linux

systemctl --user stop clawdbot

systemctl --user disable clawdbot

卸载 CLI

# 如果使用 npm

npm uninstall -g clawdbot

# 如果使用 pnpm

pnpm remove -g clawdbot

删除配置和数据(可选)

# 删除配置目录

rm -rf ~/.clawdbot

# 删除数据目录

rm -rf ~/clawd

警告

获取帮助

官方资源

  • 📖 官方文档https://docs.clawd.bot/
  • 💻 GitHub 仓库https://github.com/clawdbot/clawdbot
  • 💬 Discord 社区https://discord.gg/clawd
  • 🐦 Twitter@clawdbot

常用命令速查

# 安装

npm install -g clawdbot@latest

# 初始化配置

clawdbot onboard --install-daemon

# 启动 Gateway

clawdbot gateway --port 18789 --verbose

# 健康检查

clawdbot health

# 诊断

clawdbot doctor

# 连接聊天渠道

clawdbot channels login # WhatsApp

clawdbot channels add telegram --token=TOKEN

# 配对管理

clawdbot pairing list

clawdbot pairing approve telegram 1234

# 发送测试消息

clawdbot message send --target +1234567890 --message "Hello"

# 更新

clawdbot update

总结

Clawdbot

  1. Telegram/WhatsApp/Discord AI

下一步建议:

AI 🦞

最后更新:2026年1月30日

© 版权声明
广告也精彩

相关文章

暂无评论

暂无评论...