五分钟拥有你的第一个数字员工
在开始安装 OpenClaw 之前,让我们先确保你的环境满足基本要求。好消息是:OpenClaw 的资源需求非常友好,大多数现代设备都能轻松运行。
| 组件 | 最低要求 | 推荐配置 | 说明 |
|---|---|---|---|
| CPU | 双核处理器 | 四核及以上 | 如果使用本地 AI 模型,需要更强的 CPU |
| 内存 | 4 GB | 8 GB+ | 基础运行 2GB 足够,建议留有余量 |
| 存储 | 10 GB 可用空间 | 50 GB+ | 用于安装、日志、记忆数据存储 |
| 网络 | 稳定互联网连接 | 宽带连接 | 用于 API 调用和通信渠道 |
| 操作系统 | 支持版本 | 备注 |
|---|---|---|
| macOS | macOS 10.15 (Catalina) 及以上 | 推荐 macOS 12+,完美支持 Apple Silicon |
| Windows | Windows 10 及以上 | 需要 PowerShell 5.1+ 或 Windows Terminal |
| Linux | Ubuntu 18.04+, Debian 10+, CentOS 7+ 等主流发行版 | 需要 systemd 支持(用于后台服务) |
| Docker | Docker 20.10+ | 跨平台统一体验,推荐生产环境使用 |
OpenClaw 的安装脚本会自动处理大部分依赖,但了解这些依赖有助于故障排查:
OpenClaw 需要一个 AI 模型作为"大脑"来驱动。你需要提前准备至少一个模型的 API Key:
| 服务商 | 推荐模型 | 特点 | 获取方式 |
|---|---|---|---|
| Anthropic | Claude 3.5 Sonnet / Claude 3 Opus | 最强推理能力,最适合复杂任务 | console.anthropic.com |
| OpenAI | GPT-4 Turbo / GPT-4o | 生态丰富,工具调用能力强 | platform.openai.com |
| MiniMax(国内) | MiniMax M2.5 | 免费额度多,中文优化,访问快 | api.minimax.chat |
| Kimi(国内) | Kimi Chat API | 长上下文处理,国产优选 | platform.moonshot.cn |
| 智谱 AI(国内) | GLM-4 | 性价比高,企业级服务 | open.bigmodel.cn |
| 本地模型 | Llama 3 / Qwen2.5 等 | 完全离线,隐私最佳,需要较强硬件 | Ollama / LM Studio |
OpenClaw 通过你常用的通信工具与你交互。选择一个你最常用的平台:
OpenClaw 提供了多种安装方式,从一键安装到源码编译,满足不同用户的需求。我们将从最简单的方式开始。
这是最简单、最快的安装方式,适合 90% 的用户。安装脚本会自动检测你的系统,安装所有必要的依赖。
# 打开终端,执行以下命令:
curl -fsSL https://openclaw.ai/install.sh | bash
# 以管理员身份打开 PowerShell,执行:
irm https://openclaw.ai/install.ps1 | iex
🦞 OpenClaw installed successfully!
Next steps:
1. Run 'openclaw onboard' to set up your assistant
2. Choose your AI model provider
3. Connect your preferred chat app
4. Start chatting!
如果你已经安装了 Node.js 和 npm/pnpm,可以直接通过包管理器安装。
# 全局安装 OpenClaw
npm install -g openclaw
# 验证安装
openclaw --version
# 启动 onboarding
openclaw onboard
# 全局安装
pnpm add -g openclaw
# 验证安装
openclaw --version
# 启动 onboarding
openclaw onboard
Docker 方式提供一致的运行环境,适合服务器部署和多实例管理。
# 拉取最新镜像
docker pull openclaw/openclaw:latest
# 创建数据卷(持久化存储)
docker volume create openclaw-data
# 运行容器
docker run -d \
--name openclaw \
-v openclaw-data:/app/data \
-p 3000:3000 \
-e OPENCLAW_DATA_DIR=/app/data \
--restart unless-stopped \
openclaw/openclaw:latest
# 查看日志
docker logs -f openclaw
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
volumes:
- ./data:/app/data
- ./config:/app/config
ports:
- "3000:3000"
environment:
- OPENCLAW_DATA_DIR=/app/data
- NODE_ENV=production
restart: unless-stopped
如果你想参与开发或使用最新版本,可以从源码安装。
# 克隆仓库
git clone https://github.com/openclaw/openclaw.git
cd openclaw
# 安装依赖
pnpm install
# 构建项目
pnpm run build
# 启动 onboarding
pnpm run openclaw onboard
# 或者链接到全局
pnpm link --global
openclaw onboard
让我们深入了解一键安装脚本都做了些什么:
npm config set registry https://registry.npmmirror.com安装完成后,运行以下命令验证:
# 检查版本号
openclaw --version
# 应该输出类似:openclaw/1.2.3 darwin-arm64 node-v20.11.0
# 检查帮助信息
openclaw --help
# 检查配置目录
ls -la ~/.openclaw
# 应该看到:
# config.json
# data/
# logs/
# skills/
安装完成后,我们需要进行初始配置。OpenClaw 提供了一个友好的交互式 onboarding 流程,引导你完成所有必要设置。
在终端中运行:
openclaw onboard
这会启动一个交互式的配置向导。你将看到欢迎界面:
🦞 Welcome to OpenClaw!
This setup will help you configure your personal AI assistant.
Let's get started!
Press ENTER to continue...
Onboarding 会首先让你选择 AI 模型提供商:
? Choose your AI model provider:
❯ Anthropic (Claude) - Best for complex tasks
OpenAI (GPT-4) - Great tool ecosystem
MiniMax - Free tier available, fast in China
Kimi (Moonshot) - Long context, Chinese optimized
Zhipu AI (GLM) - Cost-effective
Local Model (Ollama) - Fully offline
Skip for now (configure later)
根据你的偏好选择,然后输入对应的 API Key:
? Enter your Anthropic API Key: sk-ant-...
✓ API Key validated successfully!
✓ Claude 3.5 Sonnet selected as your default model
接下来选择你想通过哪个平台与 OpenClaw 交流:
? Choose your communication channel:
❯ Telegram - Easy setup, powerful features
Discord - Great for developers
WhatsApp - Most popular globally
Slack - Best for teams
Signal - Maximum privacy
iMessage - Apple ecosystem (macOS only)
Skip for now (use CLI only)
以 Telegram 为例,配置流程如下:
? You chose Telegram! Let's set it up.
Step 1: Open Telegram and search for @BotFather
Step 2: Send /newbot command
Step 3: Follow BotFather's instructions to create a bot
Step 4: Copy the Bot Token (looks like: 123456:ABC-DEF...)
? Enter your Bot Token: [hidden]
✓ Bot token validated!
✓ Your bot is ready to use
Now, start a chat with your bot in Telegram:
1. Search for your bot's username
2. Send /start
3. Come back here and press ENTER
? Have you started chatting with your bot? Yes
✓ Telegram channel configured successfully!
给你的 AI 助手起个名字,并定义它的个性:
? What would you like to name your assistant?
Default: Claw
> Jarvis
? Describe your assistant's personality in a few words:
Default: Helpful, efficient, and professional
> Friendly, proactive, and detail-oriented. Like a helpful colleague.
? What's your name?
> Alex
✓ Persona configured!
Your assistant Jarvis knows:
- Your name is Alex
- Should be friendly, proactive, and detail-oriented
- Will act like a helpful colleague
设置 OpenClaw 的系统访问权限:
? Choose security level:
❯ Balanced (Recommended) - Good balance of power and safety
Maximum Security - Sandboxed execution, limited access
Full Access - Complete system control (advanced users only)
You chose: Balanced
With this setting, OpenClaw can:
✓ Read and write files in your home directory
✓ Execute safe shell commands
✓ Access the internet
✓ Control your browser
But cannot:
✗ Modify system files
✗ Install software without confirmation
✗ Access other users' files
? Is this okay? Yes
配置持久化记忆功能:
? Enable persistent memory? (Recommended)
This allows Jarvis to remember:
- Your preferences and habits
- Context from previous conversations
- Important information you share
- Completed tasks and ongoing projects
? Enable memory? Yes
? Memory retention period:
❯ Keep everything (unlimited)
Keep last 6 months
Keep last 30 days
Keep last 7 days
You chose: Keep everything
✓ Memory system enabled!
设置主动任务检查频率:
? Enable heartbeat (proactive checks)?
Heartbeat allows Jarvis to:
- Check for pending tasks every 30 minutes
- Send you reminders and updates
- Proactively suggest actions
- Run scheduled tasks
? Enable heartbeat? Yes
? Heartbeat interval:
❯ Every 30 minutes (Recommended)
Every hour
Every 2 hours
Only when I ask
You chose: Every 30 minutes
Active hours (when heartbeat runs):
Default: 08:00 - 22:00 (your local timezone)
? Adjust active hours? No
✓ Heartbeat configured!
最后,onboarding 会显示配置摘要:
🎉 Setup complete! Here's your configuration summary:
Assistant Name: Jarvis
Your Name: Alex
AI Model: Claude 3.5 Sonnet (Anthropic)
Communication: Telegram (@JarvisAlexBot)
Security Level: Balanced
Memory: Enabled (unlimited)
Heartbeat: Every 30 minutes (08:00-22:00)
Configuration saved to: ~/.openclaw/config.json
What's next?
1. Send a message to your bot on Telegram
2. Try: "Hi Jarvis, what can you do?"
3. Check out the documentation: docs.openclaw.ai
Need help? Join our community: discord.gg/openclaw
Happy clawing! 🦞
Onboarding 完成后,你的配置会保存在 ~/.openclaw/config.json。让我们看看这个文件的结构:
{
"assistant": {
"name": "Jarvis",
"persona": "Friendly, proactive, and detail-oriented. Like a helpful colleague.",
"user_name": "Alex"
},
"models": {
"default": "anthropic",
"providers": {
"anthropic": {
"enabled": true,
"api_key": "sk-ant-...",
"default_model": "claude-3-5-sonnet-20241022"
}
}
},
"channels": {
"telegram": {
"enabled": true,
"bot_token": "123456:ABC-DEF...",
"webhook_url": "https://your-domain.com/webhook/telegram"
}
},
"security": {
"level": "balanced",
"allowed_paths": ["/Users/alex"],
"blocked_commands": ["sudo", "rm -rf /"]
},
"memory": {
"enabled": true,
"retention_days": null,
"encryption": true
},
"heartbeat": {
"enabled": true,
"interval_minutes": 30,
"active_hours": {
"start": "08:00",
"end": "22:00"
}
},
"logging": {
"level": "info",
"file": "~/.openclaw/logs/openclaw.log"
}
}
openclaw reload 使更改生效。
配置完成后,让我们进行一些测试,确保一切正常工作。
打开你配置的通信渠道(以 Telegram 为例),发送第一条消息:
You: Hi Jarvis, what can you do?
Jarvis: Hi Alex! 👋 I'm your personal AI assistant. Here's what I can help you with:
📋 Task Management
- Create and manage to-do lists
- Set reminders and deadlines
- Track your progress
📧 Email & Communication
- Read and organize emails
- Draft responses
- Manage subscriptions
📁 File Operations
- Search and organize files
- Convert formats
- Extract information from documents
🌐 Web Tasks
- Browse websites
- Extract data
- Monitor changes
💻 Development
- Write and review code
- Run tests
- Manage Git repositories
And much more! Just ask me to do something, and I'll take care of it.
What would you like me to help you with today?
让我们测试几个核心功能:
You: What's the weather like today?
Jarvis: Let me check that for you...
[Checks weather API]
Today in San Francisco:
🌤️ Partly cloudy
🌡️ Temperature: 18°C (64°F)
💨 Wind: 15 km/h NW
💧 Humidity: 65%
Perfect weather for a walk! Would you like me to remind you to go outside this afternoon?
You: Can you show me my recent documents?
Jarvis: Sure! Here are your recently modified documents:
📄 Project_Proposal.docx - 2 hours ago
📊 Q1_Report.pdf - yesterday
📝 Meeting_Notes.txt - 2 days ago
📈 Budget_2026.xlsx - 3 days ago
Would you like me to open any of these or search for something specific?
You: Remind me to call John tomorrow at 3pm
Jarvis: ✓ Reminder created!
📅 Task: Call John
⏰ Time: Tomorrow at 3:00 PM
🔔 Notification: I'll remind you via Telegram 10 minutes before
Anything else you'd like me to remember?
You: What are the top stories on Hacker News?
Jarvis: Let me fetch that for you...
[Browses news.ycombinator.com]
Top stories on Hacker News right now:
1. OpenClaw becomes #1 trending project on GitHub
523 points | 187 comments
2. Show HN: I built a tool to automate my entire workflow
412 points | 98 comments
3. The Future of AI Agents
389 points | 156 comments
Want me to summarize any of these articles?
等待 30 分钟(或者在你配置的下一个心跳时间),你应该会收到主动消息:
Jarvis: 🔔 Afternoon Check-in
Hi Alex! Just checking in. Here's what I noticed:
✅ Completed today:
- Responded to 12 emails
- Organized your Downloads folder
- Created 3 reminders
⏰ Upcoming:
- Call with John in 10 minutes (as requested)
- Team meeting at 4:00 PM
💡 Suggestion:
I noticed you have several unread newsletters. Would you like me to summarize them for you?
Just let me know if you need anything!
除了聊天界面,OpenClaw 还提供了强大的 CLI 工具:
# 查看助手状态
openclaw status
# 输出:
🦞 OpenClaw Status
━━━━━━━━━━━━━━━━━━━━━
Assistant: Jarvis (running)
Model: Claude 3.5 Sonnet
Uptime: 2h 34m
Memory Usage: 423 MB
Tasks Today: 15
Last Activity: 2 minutes ago
# 查看任务列表
openclaw tasks list
# 创建新任务
openclaw tasks add "Review PR #123" --due "tomorrow 10am"
# 查看日志
openclaw logs --tail 50
# 重新加载配置
openclaw reload
# 停止助手
openclaw stop
# 启动助手
openclaw start
如果测试过程中遇到问题,可以按照以下步骤排查:
# 查看 OpenClaw 是否在运行
ps aux | grep openclaw
# 或者使用 systemctl(Linux)
systemctl status openclaw
# 实时查看日志
tail -f ~/.openclaw/logs/openclaw.log
# 或者使用 CLI
openclaw logs --level error
# 测试 AI 模型连接
openclaw test-model
# 测试通信渠道
openclaw test-channel telegram
# 完全重启
openclaw restart
# 或者手动
openclaw stop
openclaw start
对于有特殊需求的用户,OpenClaw 提供了更多高级安装和配置选项。
你可以运行多个 OpenClaw 实例,用于不同的用途(如工作/个人分离):
# 创建工作实例
OPENCLAW_HOME=~/.openclaw-work openclaw onboard
# 配置时命名为 "Work Assistant"
# 配置工作相关的通信渠道和权限
# 启动工作实例
OPENCLAW_HOME=~/.openclaw-work openclaw start
# 启动个人实例(默认)
openclaw start
# 查看运行中的实例
openclaw instances
# 输出:
🦞 Running Instances
━━━━━━━━━━━━━━━━━━━━━━━━━
1. default (~/.openclaw) - Personal
Status: running, Uptime: 5h 23m
2. work (~/.openclaw-work) - Work
Status: running, Uptime: 2h 11m
如果你需要从源码定制构建:
# 克隆仓库
git clone https://github.com/openclaw/openclaw.git
cd openclaw
# 复制配置模板
cp .env.example .env
# 编辑 .env 文件,自定义配置
cat > .env << EOF
NODE_ENV=development
OPENCLAW_PORT=3000
OPENCLAW_DATA_DIR=~/.openclaw-custom
LOG_LEVEL=debug
ENABLE_DEBUG_TOOLS=true
CUSTOM_SKILLS_PATH=~/my-skills
EOF
# 安装依赖
pnpm install
# 自定义构建
pnpm run build:custom
# 运行
pnpm run dev
将 OpenClaw 部署到云服务器,实现 24/7 在线:
# SSH 连接到服务器
ssh user@your-server.com
# 一键安装
curl -fsSL https://openclaw.ai/install.sh | bash
# 配置 systemd 服务
sudo nano /etc/systemd/system/openclaw.service
# 添加以下内容:
[Unit]
Description=OpenClaw AI Assistant
After=network.target
[Service]
Type=simple
User=your-user
WorkingDirectory=/home/your-user
ExecStart=/usr/bin/openclaw start
Restart=always
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
# 启用并启动服务
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
# 查看状态
sudo systemctl status openclaw
# 在云服务商控制台创建容器实例
# 以 AWS ECS 为例:
# 创建任务定义
cat > task-definition.json << EOF
{
"family": "openclaw",
"networkMode": "awsvpc",
"requiresCompatibilities": ["FARGATE"],
"cpu": "1024",
"memory": "2048",
"containerDefinitions": [
{
"name": "openclaw",
"image": "openclaw/openclaw:latest",
"portMappings": [
{
"containerPort": 3000,
"protocol": "tcp"
}
],
"environment": [
{
"name": "NODE_ENV",
"value": "production"
}
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/openclaw",
"awslogs-region": "us-east-1",
"awslogs-stream-prefix": "ecs"
}
}
}
]
}
EOF
# 注册任务定义
aws ecs register-task-definition --cli-input-json file://task-definition.json
# 创建服务
aws ecs create-service --cluster openclaw-cluster --service-name openclaw --task-definition openclaw --desired-count 1
如果你希望完全离线运行,可以集成本地 AI 模型:
# 安装 Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# 拉取模型
ollama pull llama3.1:8b
# 配置 OpenClaw 使用 Ollama
openclaw config models add ollama \
--base-url http://localhost:11434 \
--model llama3.1:8b
# 设置为默认模型
openclaw config models default ollama
# 测试
openclaw test-model
# 下载并安装 LM Studio
# 下载喜欢的模型(如 Qwen2.5-7B-Instruct)
# 启动本地服务器(默认端口 1234)
# 配置 OpenClaw
openclaw config models add lmstudio \
--base-url http://localhost:1234/v1 \
--model qwen2.5-7b-instruct
# 启用
openclaw config models default lmstudio
对于企业环境,还需要考虑以下方面:
# 企业级 Docker Compose 示例
version: '3.8'
services:
openclaw-1:
image: openclaw/openclaw:latest
deploy:
replicas: 3
environment:
- NODE_ENV=production
- REDIS_URL=redis://redis:6379
volumes:
- shared-data:/app/data
depends_on:
- redis
- postgres
redis:
image: redis:7-alpine
volumes:
- redis-data:/data
postgres:
image: postgres:15-alpine
environment:
- POSTGRES_PASSWORD=${DB_PASSWORD}
volumes:
- postgres-data:/var/lib/postgresql/data
nginx:
image: nginx:alpine
ports:
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./ssl:/etc/nginx/ssl
volumes:
shared-data:
redis-data:
postgres-data:
OpenClaw 资源需求友好,大多数现代设备都能运行。推荐使用 macOS 12+、Windows 10+ 或主流 Linux 发行版,至少 4GB 内存和 10GB 存储空间。
提供四种安装方式:一键安装(推荐)、npm/pnpm 安装、Docker 安装、源码安装。新手建议使用一键安装脚本,5 分钟即可完成。
通过交互式 onboarding 向导,依次配置 AI 模型、通信渠道、助手人格、权限级别、记忆系统和心跳机制。整个过程大约需要 10 分钟。
通过首次对话、基础功能、心跳机制、CLI 工具四个维度验证安装是否成功。遇到问题时,按照故障排查步骤逐步检查。
支持多实例部署、自定义构建、云服务器部署、本地模型集成、企业级部署等高级功能,满足不同场景需求。
新手推荐 MiniMax 或 Kimi(免费额度多、国内访问快),追求性能选择 Claude 3.5 Sonnet,注重隐私选择本地模型。
通过本章学习,你应该已经能够:
现在你已经拥有了一个正常运行的 OpenClaw 助手!在下一章中,我们将深入探讨 OpenClaw 的内部架构,理解它是如何工作的。你将学习:
理解原理后,你将能够更高效地使用和定制 OpenClaw!让我们继续深入!🦞