| 項目 | 需求 |
|---|---|
| 作業系統 | Ubuntu 20.04+ / Debian 11+ / 其他 Linux 發行版 |
| Node.js | v22.0.0 或更高版本(必要) |
| 記憶體 | 建議 4GB 以上 |
| 網路 | 需要穩定的網路連線 |
| 其他 | LLM API 金鑰(Gemini / OpenAI / Claude) |
curl -fsSL https://openclaw.ai/install.sh | bash
這個腳本會自動:檢測作業系統、安裝 Node.js 22+、安裝 OpenClaw、設定環境變數
# 1. 下載腳本 curl -fsSL https://openclaw.ai/install.sh -o install.sh # 2. 查看腳本內容(可選,確認安全) cat install.sh # 3. 執行安裝 bash install.sh
如果你已經有 Node.js 22+,這是最穩定的方式:
node -v # 應顯示 v22.x.x 或更高
npm install -g openclaw@latest
openclaw onboard --install-daemon
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash source ~/.bashrc nvm install 22 nvm use 22
openclaw gateway --port 18789 --verbose
# 啟動服務 systemctl --user start openclaw-gateway # 開機自動啟動 systemctl --user enable openclaw-gateway # 查看狀態 systemctl --user status openclaw-gateway
openclaw --version openclaw doctor
由於 LINE Webhook 需要公開的 HTTPS URL,需要使用 ngrok。
sudo snap install ngrok
curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \ | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \ && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" \ | sudo tee /etc/apt/sources.list.d/ngrok.list \ && sudo apt update \ && sudo apt install ngrok
# 註冊帳號後取得 authtoken ngrok config add-authtoken <你的_authtoken> # 啟動 ngrok ngrok http 18789
openclaw plugins install @openclaw/line
# 方法一:使用指令設定 openclaw config set channels.line.channelAccessToken "你的_Token" openclaw config set channels.line.channelSecret "你的_Secret" # 方法二:編輯設定檔 nano ~/.openclaw/openclaw.json
systemctl --user restart openclaw-gateway # 或 openclaw gateway restart
# 將 npm 全域路徑加入 PATH echo 'export PATH="$PATH:$(npm config get prefix)/bin"' >> ~/.bashrc source ~/.bashrc
nvm install 22 nvm use 22 nvm alias default 22