Debian部署OpenClaw

系统版本Debian12.13

环境准备
创建用户openclaw
adduser openclaw

安装Curl、Unzip、Polkit、CMake、Sudo、Git
apt install curl unzip policykit-1 cmake sudo git

添加用户openclaw到sudo组
usermod -aG sudo openclaw

如果国内的网络环境,建议配置网络代理后进行后续步骤

安装go 1.23

wget https://dl.google.com/go/go1.23.0.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.23.0.linux-amd64.tar.gz
tee -a /etc/profile <<< 'export PATH=$PATH:/usr/local/go/bin' > /dev/null

切换openclaw用户进行后续步骤

安装Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> ~/.profile
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

执行OpenClaw安装脚本(后续版本更新也使用这个脚本)
curl -fsSL https://openclaw.ai/install.sh | bash

版本更新
openclaw update

切换更新渠道

openclaw update --channel beta
openclaw update --channel dev
openclaw update --channel stable

版本降级(升级后出现BUG可以降级到老版本)
查看可用版本
https://www.npmjs.com/package/openclaw?activeTab=versions

npm install -g openclaw@2026.2.9
openclaw gateway restart

安装完成后,执行命令进入设置向导
openclaw onboard --install-daemon

配置系统服务

sudo tee /etc/systemd/system/openclaw-gateway.service << 'EOF'
[Unit]
Description=OpenClaw Gateway
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/openclaw gateway --port 18789
Restart=always
RestartSec=5
Environment=OPENCLAW_GATEWAY_TOKEN=
WorkingDirectory=/home/openclaw
User=openclaw

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now openclaw-gateway.service

标签: none