ssh username@your-server-ip.hostinger.com
# 首次連線會詢問是否信任此主機,輸入 yes
# 接著輸入你的 SSH 密碼
# 成功連線後會看到類似以下的提示符:
username@server:~$sudo apt update && sudo apt upgrade -ycurl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejsnode -v
npm -v# 切換到你想放置專案的目錄(例如家目錄)
cd ~
# 從 GitHub Clone OpenClaw 專案
git clone https://github.com/openclaw/openclaw.git
# 進入專案資料夾
cd openclaw
# 查看專案結構
ls -lanpm installnpm config set registry https://registry.npmmirror.com 即可大幅提升下載速度。cp .env.example .env
nano .env# OpenClaw 環境設定
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxx
PORT=3000
NODE_ENV=development
# 資料庫設定(選用)
# DATABASE_URL=postgresql://user:password@localhost:5432/openclaw
# 其他選用設定
# LOG_LEVEL=info
# MAX_TOKENS=2000Ctrl + X,然後按 Y 確認儲存,最後按 Enter 離開編輯器。務必確認 API 金鑰填寫正確,否則 AI 功能將無法運作。npm run devnpm startOpenClaw AI Assistant Starting...
✓ Environment variables loaded
✓ Database connection established
✓ AI model initialized
✓ Server running on port 3000
→ Ready to accept connections at http://localhost:3000http://your-server-ip:3000npm install -g pm2pm2 start npm --name openclaw -- run devpm2 startup
pm2 savepm2 status
pm2 logs openclawpm2 list
pm2 statuspm2 restart openclaw
pm2 reload openclawpm2 stop openclaw
pm2 delete openclawpm2 logs openclaw
pm2 logs --lines 100npm config set registry https://registry.npmmirror.com
npm cache clean --force
npm installsudo ufw allow 3000/tcp
sudo ufw reload
sudo ufw statusexport NODE_OPTIONS="--max-old-space-size=4096"
pm2 restart openclaw