使用 Claude Code 对话式全自动部署 OpenClaw AI 助手到 VPS 服务器
中文 | English
一键安装脚本 (install-openclaw.sh)
- 自动安装所有依赖
- 交互式/非交互式配置
- 自动启动服务
- 配置备份和恢复
# 下载脚本
wget https://raw.githubusercontent.com/taielab/openclaw-autopilot/main/install-openclaw.sh
# 赋予执行权限
chmod +x install-openclaw.sh
# 运行安装
./install-openclaw.shexport TELEGRAM_BOT_TOKEN="your-bot-token"
export API_KEY="your-api-key"
# 可选:自定义网关配置
export GATEWAY_BIND="loopback" # 或 0.0.0.0 开放公网
export GATEWAY_PORT="18789"
sudo -E ./install-openclaw.sh -n# 保留配置,仅升级 OpenClaw
sudo ./install-openclaw.sh -u-
准备以下信息:
- VPS 服务器 IP 和 SSH 凭据
- Telegram Bot Token
- AI API 密钥
-
向 Claude Code 发送:
我想在 VPS 上部署 OpenClaw AI 助手: - 服务器:<IP> - 用户:root - 密码:<password> - Telegram Bot Token:<token> - API:云雾 AI,Key:<api-key> 请帮我完成全自动部署。 -
Claude Code 会自动完成所有部署步骤
- 操作系统: Ubuntu 22.04 LTS(推荐)
- 配置: 最低 2 核 2GB 内存
- 网络: 能访问国际网络
- 权限: root 或 sudo 权限
- 15 个顶流 AI 模型(GPT-5.2、Claude Opus 4.5、DeepSeek V3.2 等)
- Telegram Bot 交互界面
- 自动故障转移
- 浏览器自动化
- 多种技能和工具
- AI/ML: Whisper、yt-dlp、Pandas、NumPy
- 开发: GitHub CLI、Git、Node.js、Python3
- 媒体: FFmpeg、ImageMagick
- 系统: jq、ripgrep、fd、bat、curl、wget
- 🐙 GitHub 操作
- 🎞️ 视频处理
- 🌤️ 天气查询
- 🧵 tmux 控制
- 📦 技能创建
在 Telegram 中找到你的 Bot,发送消息:
你好!帮我分析一下 https://github.com/openclaw/openclaw 这个项目
AI 会自动使用 GitHub CLI 工具获取仓库信息并进行分析。
/model
Bot 会显示所有 15 个可用模型,选择你想使用的模型。
帮我下载这个视频并提取关键帧:https://youtube.com/watch?v=xxxxx
AI 会使用 yt-dlp 和 FFmpeg 自动处理。
用 Python 计算前 20 个斐波那契数列
AI 会编写并执行 Python 代码,返回结果。
帮我获取 https://example.com 的主要内容
AI 会使用浏览器自动化工具抓取网页内容。
OpenClaw 支持丰富的技能扩展,以下是社区推荐的优质技能:
-
飞书集成: clawdbot-feishu
https://github.com/m1heng/clawdbot-feishu -
微信集成: OpenClaw-Wechat
https://github.com/dingxiang-me/OpenClaw-Wechat -
钉钉集成: dingtalk-moltbot-connector
https://github.com/DingTalk-Real-AI/dingtalk-moltbot-connector -
国内优化: moltbot-china
https://github.com/BytePioneer-AI/moltbot-china
- Awesome Skills: awesome-openclaw-skills
https://github.com/VoltAgent/awesome-openclaw-skills
💡 提示:安装技能后可大幅扩展 AI 助手的能力,支持更多场景和工作流。
.
├── README.md # 本文件
└── install-openclaw.sh # 一键安装脚本
# 查看服务状态
systemctl --user status openclaw-gateway
# 启动服务
systemctl --user start openclaw-gateway
# 停止服务
systemctl --user stop openclaw-gateway
# 重启服务
systemctl --user restart openclaw-gateway
# 查看日志
journalctl --user -u openclaw-gateway -f# 健康检查
openclaw doctor
# 查看技能
openclaw skills list
# 查看模型
openclaw models list
# 测试配置
openclaw gateway --port 18789# 查看详细错误
openclaw gateway --port 18789
# 检查配置
openclaw doctor
# 查看日志
journalctl --user -u openclaw-gateway -n 50# 测试 Bot Token
curl https://api.telegram.org/bot<YOUR_TOKEN>/getMe
# 检查网络
curl https://api.telegram.org
# 查看 Gateway 日志
journalctl --user -u openclaw-gateway -f# 测试 API 连接
curl -X POST https://yunwu.ai/v1/chat/completions \
-H "Authorization: Bearer <YOUR_KEY>" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.2","messages":[{"role":"user","content":"test"}]}'-
限制访问
- 修改
allowFrom只允许特定用户 - 使用
dmPolicy: "pairing"启用配对模式
- 修改
-
使用防火墙
ufw allow from 127.0.0.1 to any port 18789
-
定期更新
npm update -g openclaw apt-get update && apt-get upgrade -
备份配置
tar -czf openclaw-backup-$(date +%Y%m%d).tar.gz ~/.openclaw
A: 支持 15 个顶流模型:
- OpenAI: GPT-5.2, GPT-5.2 Codex
- Anthropic: Claude Opus 4.5, Claude Sonnet 4.5 (含 Thinking 版本)
- DeepSeek: DeepSeek V3.2 (含 Thinking 版本)
- Google: Gemini 3 Pro, Gemini 3 Pro Image
- 智谱: GLM-4.7 (含 Thinking 版本)
- MiniMax: MiniMax M2.1
- 阿里: Qwen3 Max
- xAI: Grok 4.1
A: 主要费用包括:
- VPS 服务器: 约 $5-10/月(2核2GB配置)
- API 调用: 按使用量计费,使用云雾 AI 代理可降低成本
- Telegram Bot: 免费
A: 可以,但需要:
- 保持电脑长期运行
- 配置端口转发(如果需要外网访问)
- 建议使用 VPS 以获得更好的稳定性
A: 编辑 ~/.openclaw/openclaw.json,在 models.providers 中添加新的 provider 配置,并在 auth-profiles.json 中添加对应的认证信息。详见完整教程。
A: OpenClaw 支持多种通道:
- Telegram(本教程配置)
- Discord
- Slack
- Signal
- iMessage
详见官方文档配置其他通道。
A: 运行以下命令:
npm update -g openclaw
systemctl --user restart openclaw-gatewayA:
2. 运行 openclaw doctor 进行健康检查
3. 查看日志 journalctl --user -u openclaw-gateway -f
4. 在 GitHub 提 Issue
5. 加入 Discord 社区求助
- OpenClaw 官方文档: https://docs.openclaw.ai
- OpenClaw GitHub: https://github.com/openclaw/openclaw
- 本项目 GitHub: https://github.com/taielab/openclaw-autopilot
- Discord 社区: https://discord.gg/clawd
- 云雾 AI: https://yunwu.ai/register?aff=PBpy (推荐 API 服务商)
欢迎提交 Issue 和 Pull Request!
- Fork 本仓库
- 创建特性分支 (
git checkout -b feature/AmazingFeature) - 提交更改 (
git commit -m 'Add some AmazingFeature') - 推送到分支 (
git push origin feature/AmazingFeature) - 开启 Pull Request
- 提交前请确保代码通过测试
- 遵循现有代码风格
- 更新相关文档
- 在 PR 中详细描述更改内容
AI 安全工坊
关注我们获取更多 AI 技术干货:
- 微信公众号搜索:AI安全工坊
- X (Twitter):https://x.com/JackW_AGI
- GitHub:https://github.com/taielab
MIT License
AI 安全工坊
祝你使用愉快!
如有问题,请查看完整教程或在 GitHub 提 Issue。
新增
- 网关绑定自定义:loopback / 0.0.0.0 / 指定 IP
- 网关端口自定义
- 环境变量:
GATEWAY_BIND、GATEWAY_PORT
🚀 脚本功能
- 非交互模式 (
-n) + 环境变量支持 - 更新模式 (
-u) 保留配置升级 - 配置备份 + DELETE 确认机制
- Telegram 白名单配置
- CLI 自动补全安装
⚙️ 配置优化 (93% 覆盖率)
- Agent: timeout(300s), mediaMax(20MB), thinking(low), compaction
- Session: reset(daily/3am), dmScope(per-channel-peer), typingMode
- Telegram: streamMode(partial), groupPolicy(allowlist)
- System: env, cron, web, canvasHost, logging, diagnostics
🔐 安全增强
- 白名单模式自动设置 dmPolicy=pairing
- 配置文件权限 chmod 600
- 会话隔离 per-channel-peer
- 初始版本发布