OpenClaw on Raspberry Pi
Turn a Raspberry Pi 4 or Pi 5 into a dedicated OpenClaw home server: OS setup, Node.js ARM installation, performance tuning, heat management, and running 24/7.
#Why Raspberry Pi?
A Raspberry Pi makes a surprisingly capable always-on OpenClaw server. It's cheap, silent, uses minimal power (5-15W), and sits on your desk or closet shelf running 24/7. Your data stays local, and there are no monthly server bills.
Recommended: Raspberry Pi 5 (4GB+ RAM) or Pi 4 (4GB+ RAM). The Pi 4 with 2GB works but you'll want swap enabled. Pi 3 and older are not recommended — Node.js performance is too limited.
#What You Need
| Item | Notes |
|---|---|
| Raspberry Pi 4 or 5 | 4GB RAM recommended (8GB is overkill for OpenClaw) |
| MicroSD card | 32GB+ Class 10 / A2 rated |
| Power supply | Official USB-C PSU (5V/3A for Pi 4, 5V/5A for Pi 5) |
| Ethernet cable | Recommended over WiFi for reliability |
| Case with fan | Essential for 24/7 operation — Pi 5 runs hot |
| Keyboard/monitor | Only for initial setup (headless after that) |
#Step 1: Flash Raspberry Pi OS
- Download Raspberry Pi Imager on your computer
- Insert your MicroSD card
- Open Raspberry Pi Imager:
- OS: Raspberry Pi OS Lite (64-bit) — no desktop needed for a server
- Storage: Your MicroSD card
- Settings (gear icon):
- Enable SSH
- Set username:
openclaw - Set password
- Configure WiFi (optional, Ethernet preferred)
- Set timezone
- Click Write and wait for it to finish
Use the 64-bit (arm64) version of Raspberry Pi OS, not the 32-bit. Node.js and OpenClaw perform significantly better on 64-bit.
#Step 2: First Boot and SSH
- Insert the MicroSD card into your Pi
- Connect Ethernet and power
- Wait 1-2 minutes for boot
# Find your Pi's IP (from your computer)# Option 1: Check your router's DHCP client list# Option 2: Use mDNSping raspberrypi.local# SSH inssh openclaw@raspberrypi.local# Or: ssh openclaw@192.168.x.x#Initial System Setup
# Update everythingsudo apt update && sudo apt full-upgrade -y# Set a static hostnamesudo hostnamectl set-hostname openclaw-pi# Expand filesystem (if not auto-expanded)sudo raspi-config --expand-rootfs# Reboot to apply changessudo reboot#Step 3: Optimize for 24/7 Operation
#Reduce SD Card Wear
SD cards have limited write cycles. Minimize unnecessary writes:
# Reduce swap writesecho 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf# Disable swap if you have 4GB+ RAM (optional)# sudo dphys-swapconfig swapoff# sudo systemctl disable dphys-swapfile# Or increase swap for 2GB Pi modelssudo nano /etc/dphys-swapfile# Set CONF_SWAPSIZE=2048sudo systemctl restart dphys-swapfile# Move logs to tmpfs (RAM)echo 'tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=50m 0 0' | sudo tee -a /etc/fstabFor maximum SD card longevity, consider booting from a USB SSD instead of MicroSD. Both Pi 4 and Pi 5 support USB boot natively.
#Thermal Management
# Check temperaturevcgencmd measure_temp# Install monitoringsudo apt install -y lm-sensors# Target: under 70°C under load# If consistently over 80°C, improve coolingCooling recommendations:
- Pi 5: Active cooling is essential — use the official active cooler or a case with fan
- Pi 4: A heatsink + fan case is strongly recommended for 24/7 use
- Passive cooling alone is not recommended for always-on operation
#Step 4: Install Node.js (ARM64)
# Install Node.js 22 LTScurl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -sudo apt-get install -y nodejs# Verifynode --version # v22.x.xnpm --version# Also install build tools (needed by some npm packages)sudo apt install -y build-essential#Step 5: Install OpenClaw
# Install globallynpm install -g openclaw# Run setupopenclaw setup#Step 6: systemd Service
sudo nano /etc/systemd/system/openclaw.service[Unit]Description=OpenClaw AI AgentAfter=network-online.targetWants=network-online.target[Service]Type=simpleUser=openclawWorkingDirectory=/home/openclaw/.openclaw/workspaceExecStart=/usr/bin/openclaw gateway start --foregroundRestart=alwaysRestartSec=15StandardOutput=journalStandardError=journalEnvironment=NODE_ENV=production# Limit memory to prevent OOM on low-RAM PisMemoryMax=512M[Install]WantedBy=multi-user.targetsudo systemctl daemon-reloadsudo systemctl enable openclawsudo systemctl start openclawsudo systemctl status openclaw#Performance Tips
#Pi 5 vs Pi 4
| Metric | Pi 4 (4GB) | Pi 5 (4GB) |
|---|---|---|
| Node.js startup | ~3s | ~1.5s |
| Agent response overhead | ~100ms | ~50ms |
| RAM available for OpenClaw | ~3 GB | ~3.5 GB |
| Power consumption | ~5-7W | ~7-12W |
| Overall feel | Capable | Snappy |
#Memory Optimization
# Check memory usagefree -h# Disable unnecessary servicessudo systemctl disable bluetoothsudo systemctl disable avahi-daemonsudo systemctl disable triggerhappy# On Pi OS Lite, most services are already minimal#Accessing Remotely
#From Your Local Network
ssh openclaw@openclaw-pi.local#From Outside Your Network
Options:
- Tailscale (recommended) — Zero-config VPN
bashcurl -fsSL https://tailscale.com/install.sh | shsudo tailscale up
- Port forwarding — Less secure, configure on your router
- Cloudflare Tunnel — Free, no port forwarding needed
#Troubleshooting
#Pi Won't Boot
- Try a different MicroSD card
- Re-flash with Raspberry Pi Imager
- Check power supply — underpowered PSU causes random crashes
#Slow Performance
- Check temperature:
vcgencmd measure_temp - Check if throttled:
vcgencmd get_throttled(0x0 = no throttling) - Add swap if RAM is low: check with
free -h
#Network Drops
- Use Ethernet over WiFi for 24/7 operation
- If WiFi required, disable power management:
bashsudo iw wlan0 set power_save off
#Next Steps
- Your First 24 Hours with OpenClaw — Set up SOUL.md and connect Telegram
- Keeping OpenClaw Running 24/7 — Monitoring and auto-restart
- Security Hardening — Secure your Pi server