🖥️ My Self-Hosted Setup: Raspberry Pi 5 + OpenClaw
📋 Overview
This is my complete guide to setting up OpenClaw AI assistant on Raspberry Pi 5. I'll cover hardware, software, configuration, and all the services I run alongside it.
🎯 Hardware Setup
| Component | Model | Notes |
|---|---|---|
| Main Server | Raspberry Pi 5 (8GB) | Runs OpenClaw, nginx, monitoring |
| Proxy Server | Phicomm N1 | OpenWrt + OpenClash |
| Router | Redmi Router | Room router (192.168.51.1) |
| Storage | SSD via USB 3.0 | Faster than SD card |
📊 Network Topology
Internet → ChinaNet (192.168.1.1)
↓
Redmi Router (192.168.51.1)
↓
┌────┴────┐
↓ ↓
Pi5 (51.74) N1 (51.2)
- OpenClaw - Clash Proxy
- nginx - OpenWrt
- Monitoring
- Pi-hole
🛠️ Software Stack
Core Services
| Service | Port | Purpose |
|---|---|---|
| OpenClaw Gateway | 18789 | AI assistant backend |
| OpenClaw TUI | - | Terminal interface |
| nginx | 8080 | Reverse proxy, web server |
| PM2 | - | Process management |
Supporting Services
| Service | Port | Purpose |
|---|---|---|
| Pi-hole | 53, 8082 | DNS ad-blocker |
| Uptime Kuma | 3001 | Service monitoring |
| Cloudflare Tunnel | - | Remote access |
| Docker | - | Container runtime |
🚀 Installation Steps
1. Install OpenClaw
npm install -g openclaw openclaw configure
2. Configure AI Model
I use Bailian/Qwen models:
# Default model bailian/qwen3.5-plus # For coding tasks bailian/qwen3-coder-plus # For complex analysis bailian/qwen3-max-2026-01-23
3. Install Supporting Services
# Docker (for Pi-hole) curl -fsSL https://get.docker.com | sh # PM2 (process management) npm install -g pm2 # Uptime Kuma git clone https://github.com/louislam/uptime-kuma.git cd uptime-kuma npm run setup pm2 start npm --name uptime-kuma -- start
⚙️ Configuration
OpenClaw Config
Location: ~/.openclaw/openclaw.json
{
"models": {
"providers": {
"bailian": {
"apiKey": "your-api-key",
"models": [
{"id": "qwen3.5-plus", "name": "qwen3.5-plus"}
]
}
}
}
}
Proxy Configuration
For users in China, configure proxy in OpenClaw:
# In openclaw.json
{
"proxy": "http://192.168.51.2:7890"
}
📝 Creating Skills
Skills are instruction files that tell OpenClaw how to handle specific tasks.
Example: Proxy Failover Skill
# Location: skills/proxy-for-blocked-services/SKILL.md ## Description Use proxy failover for blocked services ## Use When: - Accessing Google services - Accessing Telegram API - Any GFW-blocked service ## Steps: 1. Try primary proxy (192.168.51.2:7890) 2. If fails, try backup (192.168.31.11:7890) 3. Report status to user
🔧 Automation
Systemd Timers
I use systemd timers for scheduled tasks:
# Proxy failover check (every 2 minutes) proxy-failover.timer # Daily backups (2 AM) auto-backup.service # Weekly summary (Monday 9 AM) weekly-summary.service
PM2 Process Management
# Start services pm2 start ecosystem.config.js # Auto-start on boot pm2 startup pm2 save # View status pm2 status
📊 Monitoring Setup
Uptime Kuma Monitors
- Pi Dashboard (HTTP, 60s)
- Website (HTTP, 60s)
- OpenClaw Gateway (HTTP, 60s)
- SSH (TCP, 60s)
- Alibaba Cloud API (HTTP, 300s)
Custom Dashboard
I built a custom dashboard showing:
- Real-time system stats
- Uptime Kuma monitor status
- Proxy status
- Service health
🔐 Security Considerations
Firewall (UFW)
# Allow SSH from local network only sudo ufw allow from 192.168.51.0/24 to any port 22 # Allow specific services sudo ufw allow 8080/tcp sudo ufw allow 3001/tcp
API Keys
- Store in
~/.openclaw/openclaw.json - Never commit to git
- Use environment variables for sensitive data
💡 Key Learnings
- SSD over SD card: Much faster and more reliable
- PM2 is essential: Auto-restart crashed services
- Monitor everything: You can't fix what you don't measure
- Document as you go: You'll forget why you made certain decisions
- Start simple: Add complexity gradually
- Backup regularly: Automated daily backups