566 字
3 分钟
OpenClaw部署-openEuler24.03
环境信息
- 操作系统:openEuler 24.03 LTS SP3
- 用户:root
- 服务器 IP:192.168.0.18
一、基础依赖
# 更新系统sudo dnf update -y
# 编译工具与常用依赖sudo dnf groupinstall -y "Development Tools"sudo dnf install -y python3 python3-pip make gcc-c++ openssl-devel sqlite-devel screen二、安装 Node.js
使用官方预编译二进制包,无需本地编译。
cd /usr/localwget https://nodejs.org/dist/v22.14.0/node-v22.14.0-linux-x64.tar.xztar -xf node-v22.14.0-linux-x64.tar.xzmv node-v22.14.0-linux-x64 node
# 加入 PATHecho 'export PATH=/usr/local/node/bin:$PATH' >> /etc/profilesource /etc/profile
# 验证node --version # v22.14.0npm --version # 10.9.2
# 切换国内源npm config set registry https://registry.npmmirror.com/三、安装 OpenClaw
npm i -g openclawopenclaw --version四、初始化(Onboarding)
交互式配置助手名称、聊天平台、API 密钥:
openclaw onboard完成后终端会输出 Dashboard 访问链接。
五、启动网关服务
5.1 前台启动(调试)
openclaw gateway网关监听 0.0.0.0:18789。
5.2 screen 后台运行
sudo dnf install screenscreen -S openclawopenclaw gateway# Ctrl+A, D 脱离会话5.3 注册为 systemd 服务(推荐)
创建 /etc/systemd/system/openclaw.service:
[Unit]Description=OpenClaw GatewayAfter=network.target
[Service]Type=simpleUser=rootWorkingDirectory=/rootExecStart=/usr/local/node/bin/openclaw gatewayRestart=on-failureRestartSec=10Environment="PATH=/usr/local/node/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
[Install]WantedBy=multi-user.target启用服务:
systemctl daemon-reloadsystemctl enable --now openclaw六、远程访问 Dashboard
6.1 问题现象
从其他设备访问 http://192.168.0.18:18789,日志提示:
origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins)6.2 配置 allowedOrigins
编辑 /root/.openclaw/openclaw.json:
{ "gateway": { "controlUi": { "allowedOrigins": [ "http://192.168.0.18:18789", "http://localhost:18789" ] } }}仅测试环境可设为 ["*"]。保存后重启网关。
6.3 SSH 隧道访问(推荐)
客户端执行:
ssh -N -L 18789:127.0.0.1:18789 root@192.168.0.18浏览器访问 http://localhost:18789 即可。
6.4 启用 SSH 端口转发
编辑 /etc/ssh/sshd_config:
AllowTcpForwarding yesGatewayPorts clientspecifiedPermitTunnel yes重启服务:
sudo sshd -tsudo systemctl restart sshd6.5 SSH 客户端简化配置
编辑 ~/.ssh/config:
Host openclaw-server HostName 192.168.0.18 User root Port 22 LocalForward 18789 localhost:18789 ServerAliveInterval 60 IdentityFile ~/.ssh/id_ed25519之后只需 ssh openclaw-server。
七、验证部署
openclaw status # 服务状态openclaw logs # 实时日志openclaw doctor # 健康检查八、常用命令
| 命令 | 说明 |
|---|---|
openclaw gateway | 启动网关(前台) |
openclaw gateway --force | 强制启动,清理占用端口 |
openclaw status | 查看服务状态 |
openclaw logs | 查看实时日志 |
openclaw doctor | 系统健康检查 |
openclaw reset | 重置本地配置 |
openclaw configure | 重新运行配置向导 |
九、注意事项
- 防火墙需放行 SSH(22);如需直连 18789,需同时配置
allowedOrigins - 生产环境建议通过 SSH 隧道或 VPN 访问控制界面,避免管理端口暴露公网
GatewayPorts建议用clientspecified,比yes更安全- 更多文档:https://docs.openclaw.ai
OpenClaw部署-openEuler24.03
https://blog.xeu.asia/posts/openclaw-openeuler/