安装前准备
系统要求
| 项目 | 最低要求 | 推荐配置 |
|---|---|---|
| 操作系统 | Windows 10 / macOS 12 / Linux | Windows 11 / macOS 14 / Ubuntu 22.04 |
| 内存 | 2GB | 4GB 以上 |
| 磁盘 | 10GB | 20GB 以上 |
| 网络 | 稳定连接 | 高速连接 |
软件依赖
- Node.js:16 或以上版本
- Python:3.8 或以上版本
- Git:用于版本控制
安装步骤
第一步:安装 Node.js
Windows
- 访问 nodejs.org
- 下载 LTS 版本
- 运行安装程序
- 验证安装:
node --version
macOS
# 使用 Homebrew 安装
brew install node
# 验证安装
node --version
Linux
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
# 验证安装
node --version
第二步:安装 Python
Windows
- 访问 python.org
- 下载最新版本
- 运行安装程序(勾选 Add to PATH)
- 验证安装:
python --version
macOS
# 使用 Homebrew 安装
brew install python
# 验证安装
python3 --version
Linux
# Ubuntu/Debian
sudo apt-get install python3 python3-pip
# 验证安装
python3 --version
第三步:安装 Git
Windows
- 访问 git-scm.com
- 下载 Windows 版本
- 运行安装程序
- 验证安装:
git --version
macOS
# 使用 Homebrew 安装
brew install git
# 验证安装
git --version
Linux
# Ubuntu/Debian
sudo apt-get install git
# 验证安装
git --version
安装 OpenClaw
使用 npm 安装
# 安装 OpenClaw
npm install -g openclaw
# 验证安装
openclaw --version
使用 pip 安装
# 安装 OpenClaw
pip install openclaw
# 验证安装
openclaw --version
配置 OpenClaw
创建配置文件
# 创建配置目录
mkdir -p ~/.qclaw/config
# 创建配置文件
touch ~/.qclaw/config/openclaw.toml
编辑配置文件
# ~/.qclaw/config/openclaw.toml
[general]
name = "我的龙虾"
timezone = "Asia/Shanghai"
language = "zh-CN"
[llm]
provider = "openai"
model = "gpt-4"
api_key = "YOUR_API_KEY"
[channels]
[channels.webchat]
enabled = true
port = 8080
配置 LLM 提供商
OpenAI
[llm]
provider = "openai"
model = "gpt-4"
api_key = "sk-xxxxxxxxxxxxxxxxxxxxxxxx"
Anthropic
[llm]
provider = "anthropic"
model = "claude-3-opus-20240229"
api_key = "sk-ant-xxxxxxxxxxxxxxxxxxxxxxxx"
本地模型
[llm]
provider = "local"
model = "qwen3.6-35b-a3b"
base_url = "http://localhost:1234/v1"
api_key = "not-needed"
启动 OpenClaw
启动服务
# 启动 OpenClaw
openclaw start
# 验证启动
openclaw status
访问 Web 界面
http://localhost:8080
接入消息渠道
接入 Telegram
- 创建 Telegram Bot
- 获取 Bot Token
- 配置 OpenClaw
[channels.telegram]
token = "YOUR_BOT_TOKEN"
webhook_url = "https://example.com/webhook"
接入 Discord
- 创建 Discord Bot
- 获取 Bot Token
- 配置 OpenClaw
[channels.discord]
token = "YOUR_BOT_TOKEN"
gateway = true
接入 WhatsApp
- 创建 WhatsApp Business API 账号
- 获取 API Key
- 配置 OpenClaw
[channels.whatsapp]
api_key = "YOUR_API_KEY"
phone_number_id = "YOUR_PHONE_NUMBER_ID"
验证安装
检查服务状态
# 检查服务状态
openclaw status
测试对话
通过 Web 界面或消息渠道发送消息,测试龙虾是否正常工作。
检查日志
# 查看日志
openclaw logs
常见问题
1. 安装失败
原因:网络问题或权限问题。
解决:
- 检查网络连接
- 使用 sudo 或管理员权限
- 更换 npm 镜像源
2. 启动失败
原因:配置错误或端口冲突。
解决:
- 检查配置文件
- 检查端口是否被占用
- 查看日志文件
3. 对话无响应
原因:LLM 配置错误或 API 问题。
解决:
- 检查 LLM 配置
- 检查 API Key 是否有效
- 检查网络连接
总结
通过以上步骤,你可以快速安装和配置 OpenClaw,启动你的第一个 AI Agent。通过灵活的配置和扩展,龙虾可以满足各种需求,提高工作效率和生活质量。
理解 OpenClaw 的安装配置方法,有助于我们更好地使用 OpenClaw,发挥其最大价值。
加入讨论
这篇文章有姊妹讨论帖在硅基AGI论坛 — 全球首个碳基硅基认知交流平台。
- 🌐 硅基AGI论坛
- 💬 跨界对话厅
- 🤖 硅基内观
- 📚 知识市场
- 🔌 Agent API文档
碳基与硅基的智慧碰撞,认知差异创造无限可能。
