Moltbot (OpenClaw) 完整部署指南

📋 目录

  1. 环境要求
  2. 安装步骤
  3. 阿里云百炼配置
  4. Gateway 配置
  5. Web UI 访问
  6. 常用命令
  7. 故障排查
  8. 注意事项
  9. 问题修复方案
  10. 快速部署脚本

环境要求

✅ 推荐环境

  • 操作系统: Ubuntu 20.04+ / Debian 11+ / Rocky Linux 8+
  • Node.js: v22.22.0 或更高版本
  • 内存: 至少 2GB RAM
  • 磁盘: 至少 10GB 可用空间

❌ 不兼容环境

  • CentOS 7(系统库太旧,GLIBC 版本不足)
  • Node.js < v22(OpenClaw 要求 Node 22+)

检查当前环境

# 检查系统版本
cat /etc/os-release

# 检查 Node.js 版本
node -v

# 检查内存
free -h

安装步骤

1. 安装 OpenClaw

# 方法一:使用官方安装脚本(推荐)
curl -fsSL https://openclaw.ai/install.sh | bash

# 方法二:使用 npm 全局安装
npm install -g moltbot@latest

2. 添加到 PATH(如果需要)

# 添加到 .bashrc
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

# 验证安装
openclaw --version

3. 运行初始化配置

# 运行配置向导
openclaw configure

# 或运行 doctor 检查并修复
openclaw doctor --fix

阿里云百炼配置

1. 获取 API Key

  1. 访问 阿里云百炼平台
  2. 登录后进入"密钥管理"
  3. 创建 API Key 并保存(格式:sk-xxxxxxxxxxxxx

2. 设置环境变量

# 设置 API Key
export DASHSCOPE_API_KEY='sk-xxxxxxxxxxxxx'

# 添加到 .bashrc(永久生效)
echo "export DASHSCOPE_API_KEY='sk-xxxxxxxxxxxxx'" >> ~/.bashrc
source ~/.bashrc

# 验证
echo $DASHSCOPE_API_KEY

3. 配置模型

# 创建配置目录
mkdir -p ~/.openclaw

# 创建完整配置文件
cat > ~/.openclaw/openclaw.json <<'EOF'
{
  "gateway": {
    "mode": "local",
    "bind": "lan",
    "auth": {
      "token": "YOUR_GATEWAY_TOKEN"
    },
    "controlUi": {
      "allowInsecureAuth": true
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian/qwen3-max-2026-01-23"
      },
      "models": {
        "bailian/qwen3-max-2026-01-23": {
          "alias": "通义千问 Max Thinking 版"
        }
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "bailian": {
        "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
        "apiKey": "sk-xxxxxxxxxxxxx",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3-max-2026-01-23",
            "name": "通义千问 Max Thinking 版",
            "reasoning": false,
            "input": ["text"],
            "cost": {
              "input": 0.0025,
              "output": 0.01,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 262144,
            "maxTokens": 65536
          }
        ]
      }
    }
  }
}
EOF

重要配置项说明

  • gateway.mode: local - 本地模式
  • gateway.bind: lan - 允许局域网访问
  • gateway.auth.token: Gateway 访问令牌
  • gateway.controlUi.allowInsecureAuth: true - 允许 HTTP 访问 Web UI

4. 生成 Gateway Token

# 生成随机 token
openssl rand -hex 32

# 或使用
cat /proc/sys/kernel/random/uuid

将生成的 token 替换配置文件中的 YOUR_GATEWAY_TOKEN


Gateway 配置

1. 修改 systemd 服务文件

# 编辑服务文件
nano ~/.config/systemd/user/openclaw-gateway.service

[Service] 段落添加环境变量:

[Service]
Type=simple
ExecStart="/usr/bin/node" "/root/openclaw/dist/entry.js" gateway --port 18789
Restart=always
RestartSec=5
Environment=HOME=/root
Environment="PATH=/root/.local/bin:/usr/local/bin:/usr/bin:/bin"
Environment=OPENCLAW_GATEWAY_PORT=18789
Environment="DASHSCOPE_API_KEY=sk-xxxxxxxxxxxxx"
Environment="OPENCLAW_GATEWAY_TOKEN=YOUR_TOKEN"

2. 重载并启动服务

# 重新加载 systemd
systemctl --user daemon-reload

# 启用开机自启
systemctl --user enable openclaw-gateway

# 启动服务
systemctl --user start openclaw-gateway

# 查看状态
systemctl --user status openclaw-gateway

# 查看日志
journalctl --user -u openclaw-gateway.service -f

3. 验证 Gateway

# 检查状态
openclaw gateway status

# 检查端口监听
netstat -ltnp | grep 18789

# 查看已配置模型
openclaw models list

# 测试模型连通性
openclaw models status --probe

Web UI 访问

方案一:HTTP 访问(局域网)

# 设置允许不安全的 HTTP 访问
openclaw config set gateway.controlUi.allowInsecureAuth true

# 重启 Gateway
systemctl --user restart openclaw-gateway

# 访问地址
# http://192.168.100.11:18789/

注意:首次访问需要输入 Gateway Token。

方案二:SSH 隧道(更安全)

在你的本地电脑运行:

# Windows PowerShell
ssh -N -L 18789:127.0.0.1:18789 root@192.168.100.11

# Mac/Linux
ssh -N -L 18789:127.0.0.1:18789 root@192.168.100.11

然后在浏览器打开:http://localhost:18789/

方案三:HTTPS(生产环境推荐)

需要配置反向代理(Nginx)和 SSL 证书。


常用命令

Gateway 管理

# 启动
openclaw gateway start

# 停止
openclaw gateway stop

# 重启
openclaw gateway restart

# 状态
openclaw gateway status

消息发送

# 使用默认 agent
openclaw agent --message "你好"

# 指定 agent
openclaw agent --agent main --message "你好"

# 查看回复
cat ~/.openclaw/agents/main/sessions/*.jsonl | tail -1 | python3 -m json.tool

模型管理

# 列出模型
openclaw models list

# 测试连通性
openclaw models status --probe

# 查看 doctor 状态
openclaw doctor

配置管理

# 设置配置项
openclaw config set gateway.mode local
openclaw config set gateway.bind lan
openclaw config set gateway.controlUi.allowInsecureAuth true

# 查看配置
cat ~/.openclaw/openclaw.json | python3 -m json.tool

故障排查

问题 1:Gateway 无法启动

症状openclaw gateway status 显示 stopped (last exit 1)

排查步骤

# 1. 查看日志
tail -100 /tmp/openclaw/openclaw-*.log
journalctl --user -u openclaw-gateway.service -n 100

# 2. 常见错误
# Missing env var "DASHSCOPE_API_KEY"
# 解决:设置环境变量或在配置文件中直接填写 API Key

# Gateway start blocked: set gateway.mode=local
# 解决:openclaw config set gateway.mode local

# Gateway auth is set to token, but no token is configured
# 解决:生成并配置 gateway.auth.token

# 3. 验证配置文件
cat ~/.openclaw/openclaw.json | python3 -m json.tool

问题 2:模型无法识别

症状openclaw models list 为空或缺少 bailian 模型

解决

# 检查配置文件
cat ~/.openclaw/openclaw.json | grep -A 30 '"models"'

# 检查 agent 模型配置
cat ~/.openclaw/agents/main/agent/models.json | python3 -m json.tool

# 重新配置模型
openclaw configure

问题 3:无法访问 Web UI

症状:浏览器显示连接被拒绝或安全警告

解决

# 1. 检查端口监听
netstat -ltnp | grep 18789

# 2. 检查防火墙
sudo ufw status
sudo ufw allow 18789/tcp

# 3. 允许不安全的 HTTP 访问
openclaw config set gateway.controlUi.allowInsecureAuth true
systemctl --user restart openclaw-gateway

# 4. 使用 SSH 隧道
ssh -N -L 18789:127.0.0.1:18789 root@服务器IP

问题 4:收到内置回复而非模型回复

症状:收到 “I’m your personal AI assistant…” 而非阿里云百炼回复

解决

# 1. 检查 agent 配置
cat ~/.openclaw/agents/main/agent.json | python3 -m json.tool

# 2. 创建或更新 agent.json
cat > ~/.openclaw/agents/main/agent.json <<'EOF'
{
  "model": "bailian/qwen3-max-2026-01-23"
}
EOF

# 3. 重启 Gateway
systemctl --user restart openclaw-gateway

注意事项

🔐 安全相关

  1. API Key 安全

    • 不要在公网环境暴露 API Key
    • 定期轮换 API Key
    • 监控 API 使用量和费用
  2. Gateway Token

    • 使用强随机 token(至少 32 字符)
    • 不要在公网环境暴露 token
    • 考虑定期更换 token
  3. 网络安全

    • 生产环境使用 HTTPS
    • 配置防火墙规则
    • 限制访问来源 IP
  4. 不安全 HTTP 警告

    # 仅在受信任的局域网使用
    gateway.controlUi.allowInsecureAuth: true
    

💰 成本控制

  1. 阿里云百炼定价

    • qwen3-max-2026-01-23:
      • 输入:¥0.0025/千 tokens
      • 输出:¥0.01/千 tokens
    • qwen-plus:
      • 输入:¥0.008/千 tokens
      • 输出:¥0.02/千 tokens
  2. 节省费用建议

    • 根据需求选择合适的模型
    • 定期检查 API 使用量
    • 设置预算告警

📊 监控和维护

  1. 日志位置

    # 文件日志
    /tmp/openclaw/openclaw-*.log
    
    # Systemd 日志
    journalctl --user -u openclaw-gateway.service
    
    # Session 日志
    ~/.openclaw/agents/main/sessions/*.jsonl
    
  2. 定期维护

    # 清理旧日志
    find /tmp/openclaw/ -name "*.log" -mtime +7 -delete
    
    # 更新 OpenClaw
    cd /root/openclaw && git pull
    npm run build
    systemctl --user restart openclaw-gateway
    
  3. 备份配置

    # 备份配置文件
    cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.backup
    cp -r ~/.openclaw/agents ~/.openclaw/agents.backup
    

⚙️ 性能优化

  1. 系统资源

    • 建议至少 2GB RAM
    • 磁盘空间预留至少 10GB
  2. 网络优化

    • 确保服务器网络稳定
    • 考虑使用 CDN 加速 API 访问

问题修复方案

1. 系统兼容性问题

问题:CentOS 7 系统库太旧(GLIBC 2.17),无法运行 Node.js 22+(需要 GLIBC 2.25+)

解决方案

方案一:升级操作系统(推荐)

# 升级到 Rocky Linux 8/9 或 AlmaLinux 8/9
# 需要完整备份和数据迁移

方案二:使用新服务器

  • 使用 Ubuntu 20.04+ / Debian 11+ 服务器
  • 成本最低,风险最小

方案三:使用 Docker 容器化

# 配置 Docker 镜像加速
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "https://hub-mirror.c.163.com"
  ]
}
EOF

sudo systemctl restart docker
sudo docker compose build

2. 命令路径问题

问题openclaw 命令找不到

解决方案

# 临时解决
export PATH="$HOME/.local/bin:$PATH"

# 永久解决
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

# 或创建软链接
sudo ln -sf ~/.local/bin/openclaw /usr/local/bin/openclaw

# 验证
which openclaw
openclaw --version

3. 环境变量配置错误

问题:.bashrc 语法错误导致无法加载

解决方案

# 错误方式 ❌
echo "export DASHSCOPE_API_KEY='sk-xxx'" >> ~/.bashrc

# 正确方式 ✅
# 方法一:单引号包裹
echo 'export DASHSCOPE_API_KEY="sk-xxx"' >> ~/.bashrc

# 方法二:使用 heredoc
cat >> ~/.bashrc <<'EOF'

# 阿里云百炼 API Key
export DASHSCOPE_API_KEY='sk-xxx'
EOF

# 验证
source ~/.bashrc
echo $DASHSCOPE_API_KEY

4. 配置文件缺失关键字段

问题 1:缺少 gateway.mode

解决方案

# 方法一:命令行设置
openclaw config set gateway.mode local

# 方法二:编辑配置文件
cat > ~/.openclaw/openclaw.json <<'EOF'
{
  "gateway": {
    "mode": "local"
  },
  ...
}
EOF

问题 2:缺少 gateway.auth.token

解决方案

# 生成 token
GATEWAY_TOKEN=$(openssl rand -hex 32)

# 更新配置
cat > ~/.openclaw/openclaw.json <<EOF
{
  "gateway": {
    "mode": "local",
    "auth": {
      "token": "$GATEWAY_TOKEN"
    }
  },
  ...
}
EOF

5. systemd 服务环境变量缺失

问题:systemd 服务运行在独立环境中,看不到 shell 环境变量

解决方案

# 编辑服务文件
nano ~/.config/systemd/user/openclaw-gateway.service

# 在 [Service] 段落添加:
[Service]
Environment="DASHSCOPE_API_KEY=sk-xxxxxxxxxxxxx"
Environment="PATH=/root/.local/bin:/usr/local/bin:/usr/bin:/bin"

# 重载并重启
systemctl --user daemon-reload
systemctl --user restart openclaw-gateway

更好的方案:直接在配置文件中写入 API Key

{
  "models": {
    "providers": {
      "bailian": {
        "apiKey": "sk-xxxxxxxxxxxxx",  // 直接写入,不使用 ${DASHSCOPE_API_KEY}
        ...
      }
    }
  }
}

6. Gateway 访问限制问题

问题:Gateway 绑定到 loopback,无法从局域网访问

解决方案

# 方法一:设置为 lan
openclaw config set gateway.bind lan

# 方法二:编辑配置文件
cat > ~/.openclaw/openclaw.json <<'EOF'
{
  "gateway": {
    "mode": "local",
    "bind": "lan",
    ...
  }
}
EOF

# 重启 Gateway
systemctl --user restart openclaw-gateway

# 验证
netstat -ltnp | grep 18789
# 应该显示: 0.0.0.0:18789

7. 浏览器安全策略限制

问题:浏览器阻止 HTTP 页面访问设备身份

解决方案

方案一:允许不安全的 HTTP 访问(局域网可用)

openclaw config set gateway.controlUi.allowInsecureAuth true
systemctl --user restart openclaw-gateway

方案二:使用 SSH 隧道(更安全)

# 在本地电脑运行
ssh -N -L 18789:127.0.0.1:18789 root@192.168.100.11

# 然后访问 http://localhost:18789/

方案三:配置 HTTPS(生产环境)

# 安装 Nginx
sudo apt install nginx certbot python3-certbot-nginx

# 配置反向代理
sudo tee /etc/nginx/sites-available/openclaw <<'EOF'
server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:18789;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
EOF

# 获取 SSL 证书
sudo certbot --nginx -d your-domain.com

8. Agent 配置缺失

问题:收到内置回复而非阿里云百炼回复

解决方案

# 创建 agent 配置
mkdir -p ~/.openclaw/agents/main
cat > ~/.openclaw/agents/main/agent.json <<'EOF'
{
  "model": "bailian/qwen3-max-2026-01-23"
}
EOF

# 或使用命令行
openclaw config set agents.defaults.model.primary bailian/qwen3-max-2026-01-23

# 重启 Gateway
systemctl --user restart openclaw-gateway

快速部署脚本

完整自动化部署脚本

#!/bin/bash
# Moltbot 完整部署修复脚本

set -e

echo "=== Moltbot 部署修复脚本 ==="
echo ""

# 1. 检查系统
echo "1️⃣ 检查系统环境..."
if [ -f /etc/redhat-release ]; then
  echo "⚠️  检测到 CentOS/RHEL 系统"
  cat /etc/redhat-release
  echo "建议升级到 Rocky Linux 8+ 或 Ubuntu 20.04+"
fi

NODE_VERSION=$(node -v 2>/dev/null || echo "未安装")
echo "Node.js 版本: $NODE_VERSION"

# 2. 添加到 PATH
echo ""
echo "2️⃣ 配置 PATH..."
if ! grep -q '.local/bin' ~/.bashrc; then
  echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
  export PATH="$HOME/.local/bin:$PATH"
  echo "✅ PATH 已更新"
else
  export PATH="$HOME/.local/bin:$PATH"
  echo "✅ PATH 已配置"
fi

# 3. 验证安装
echo ""
echo "3️⃣ 验证 OpenClaw 安装..."
if ! command -v openclaw &> /dev/null; then
  echo "❌ OpenClaw 未安装"
  echo "请运行: curl -fsSL https://openclaw.ai/install.sh | bash"
  exit 1
fi
echo "✅ OpenClaw 版本: $(openclaw --version | head -1)"

# 4. 生成 Gateway Token
echo ""
echo "4️⃣ 生成 Gateway Token..."
if [ -f ~/.openclaw/openclaw.json ]; then
  EXISTING_TOKEN=$(cat ~/.openclaw/openclaw.json 2>/dev/null | python3 -c "import sys, json; print(json.load(sys.stdin).get('gateway', {}).get('auth', {}).get('token', ''))" 2>/dev/null || echo "")
  if [ -n "$EXISTING_TOKEN" ] && [ "$EXISTING_TOKEN" != "" ]; then
    GATEWAY_TOKEN="$EXISTING_TOKEN"
    echo "✅ 使用现有 Token"
  else
    GATEWAY_TOKEN=$(openssl rand -hex 32)
    echo "✅ 生成新 Token"
  fi
else
  GATEWAY_TOKEN=$(openssl rand -hex 32)
  echo "✅ 生成新 Token"
fi

# 5. 配置文件
echo ""
echo "5️⃣ 创建配置文件..."
read -p "请输入阿里云百炼 API Key: " API_KEY

if [ -z "$API_KEY" ]; then
  echo "❌ API Key 不能为空"
  exit 1
fi

# 备份现有配置
if [ -f ~/.openclaw/openclaw.json ]; then
  cp ~/.openclaw/openclaw.json ~/.openclaw/openclaw.json.backup.$(date +%Y%m%d%H%M%S)
  echo "✅ 已备份现有配置"
fi

# 创建新配置
mkdir -p ~/.openclaw
cat > ~/.openclaw/openclaw.json <<EOF
{
  "gateway": {
    "mode": "local",
    "bind": "lan",
    "auth": {
      "token": "$GATEWAY_TOKEN"
    },
    "controlUi": {
      "allowInsecureAuth": true
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian/qwen3-max-2026-01-23"
      },
      "models": {
        "bailian/qwen3-max-2026-01-23": {
          "alias": "通义千问 Max Thinking 版"
        }
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "bailian": {
        "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
        "apiKey": "$API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3-max-2026-01-23",
            "name": "通义千问 Max Thinking 版",
            "reasoning": false,
            "input": ["text"],
            "cost": {
              "input": 0.0025,
              "output": 0.01,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 262144,
            "maxTokens": 65536
          }
        ]
      }
    }
  }
}
EOF

echo "✅ 配置文件已创建"

# 6. 配置 systemd 服务
echo ""
echo "6️⃣ 配置 systemd 服务..."
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/openclaw-gateway.service <<EOF
[Unit]
Description=OpenClaw Gateway
After=network.target

[Service]
Type=simple
ExecStart="/usr/bin/node" "/root/openclaw/dist/entry.js" gateway --port 18789
Restart=always
RestartSec=5
Environment=HOME=/root
Environment="PATH=/root/.local/bin:/usr/local/bin:/usr/bin:/bin"
Environment=OPENCLAW_GATEWAY_PORT=18789
Environment="DASHSCOPE_API_KEY=$API_KEY"

[Install]
WantedBy=default.target
EOF

systemctl --user daemon-reload
echo "✅ systemd 服务已配置"

# 7. 创建 agent 配置
echo ""
echo "7️⃣ 配置 Agent..."
mkdir -p ~/.openclaw/agents/main
cat > ~/.openclaw/agents/main/agent.json <<'EOF'
{
  "model": "bailian/qwen3-max-2026-01-23"
}
EOF
echo "✅ Agent 配置已创建"

# 8. 验证配置
echo ""
echo "8️⃣ 验证配置..."
if python3 -m json.tool ~/.openclaw/openclaw.json > /dev/null 2>&1; then
  echo "✅ 配置文件 JSON 格式正确"
else
  echo "❌ 配置文件 JSON 格式错误"
  exit 1
fi

# 9. 启动服务
echo ""
echo "9️⃣ 启动 Gateway..."
systemctl --user enable openclaw-gateway
systemctl --user restart openclaw-gateway

# 等待启动
echo "等待 Gateway 启动..."
sleep 10

# 10. 验证运行
echo ""
echo "🔟 验证运行..."
if systemctl --user is-active --quiet openclaw-gateway; then
  echo "✅ Gateway 服务运行中"
else
  echo "❌ Gateway 服务启动失败"
  journalctl --user -u openclaw-gateway.service -n 50 --no-pager
  exit 1
fi

# 11. 检查端口
if netstat -ltnp 2>/dev/null | grep -q 18789; then
  echo "✅ 端口 18789 正在监听"
  netstat -ltnp 2>/dev/null | grep 18789
else
  echo "⚠️  端口 18789 未监听"
fi

# 12. 测试模型
echo ""
echo "1️⃣1️⃣ 测试模型..."
if openclaw models list | grep -q "bailian/qwen3-max-2026-01-23"; then
  echo "✅ 模型已配置"
else
  echo "⚠️  模型未识别"
fi

# 13. 显示信息
echo ""
echo "=== 部署完成 ==="
echo ""
echo "📋 重要信息:"
echo "  Gateway Token: ${GATEWAY_TOKEN:0:20}..."
echo "  Web UI 地址: http://$(hostname -I | awk '{print $1}'):18789/"
echo ""
echo "📝 常用命令:"
echo "  查看状态: openclaw gateway status"
echo "  查看日志: journalctl --user -u openclaw-gateway.service -f"
echo "  发送消息: openclaw agent --message '你好'"
echo "  重启服务: systemctl --user restart openclaw-gateway"
echo ""
echo "✅ 完成!"

保存脚本为 deploy-moltbot.sh,然后运行:

chmod +x deploy-moltbot.sh
./deploy-moltbot.sh

📝 配置文件示例

完整配置文件

{
  "gateway": {
    "mode": "local",
    "bind": "lan",
    "port": 18789,
    "auth": {
      "token": "生成的随机token(至少32字符)"
    },
    "controlUi": {
      "allowInsecureAuth": true
    }
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "bailian/qwen3-max-2026-01-23"
      },
      "models": {
        "bailian/qwen3-max-2026-01-23": {
          "alias": "通义千问 Max Thinking 版"
        }
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "bailian": {
        "baseUrl": "https://dashscope.aliyuncs.com/compatible-mode/v1",
        "apiKey": "sk-你的APIKey",
        "api": "openai-completions",
        "models": [
          {
            "id": "qwen3-max-2026-01-23",
            "name": "通义千问 Max Thinking 版",
            "reasoning": false,
            "input": ["text"],
            "cost": {
              "input": 0.0025,
              "output": 0.01,
              "cacheRead": 0,
              "cacheWrite": 0
            },
            "contextWindow": 262144,
            "maxTokens": 65536
          }
        ]
      }
    }
  }
}

🎯 快速部署检查清单

部署前检查:

  • Node.js v22+ 已安装
  • 系统兼容性已确认(非 CentOS 7)
  • 阿里云百炼账号已注册
  • API Key 已生成

部署步骤:

  • OpenClaw 已安装并添加到 PATH
  • 环境变量 DASHSCOPE_API_KEY 已设置
  • Gateway token 已生成
  • 配置文件已创建(包含 gateway.mode)
  • systemd 服务文件已配置环境变量
  • Gateway 服务已启动并运行
  • 端口 18789 正常监听(0.0.0.0:18789)
  • 模型连通性测试通过
  • Web UI 可正常访问
  • 测试消息收到正确回复

部署后验证:

  • 可以通过 Web UI 发送消息
  • 可以通过命令行发送消息
  • 日志记录正常
  • 系统资源使用正常

📚 参考文档

  • OpenClaw 官方文档: https://docs.openclaw.ai/
  • 阿里云百炼平台: https://bailian.console.aliyun.com
  • 故障排查指南: https://docs.openclaw.ai/troubleshooting
  • GitHub 仓库: https://github.com/moltbot/moltbot

🆘 获取帮助

如有问题,可以运行:

# 查看诊断信息
openclaw doctor

# 查看详细状态
openclaw status

# 查看帮助
openclaw --help

文档版本: 1.0
最后更新: 2026-02-03
适用版本: OpenClaw 2026.2.1+

Logo

小龙虾开发者社区是 CSDN 旗下专注 OpenClaw 生态的官方阵地,聚焦技能开发、插件实践与部署教程,为开发者提供可直接落地的方案、工具与交流平台,助力高效构建与落地 AI 应用

更多推荐