Skip to content

How to Run a Persistent OpenClaw Gateway on a Raspberry Pi

I hate paying monthly fees for cloud servers. It feels wrong to pay $6 every month just to keep a simple bot or personal assistant alive. I usually end up with a pile of half-finished projects because I don’t want to deal with recurring costs or the hassle of managing a remote VPS.

I found that the best way to handle this is to use a Raspberry Pi. It stays on 24/7, sits on my desk, and costs almost nothing to run after the initial purchase. If you want a personal AI assistant or a home automation hub that doesn’t disappear when you close your laptop, this is the way to go.

  • Raspberry Pi 4 or 5 (2GB+ RAM recommended)
  • MicroSD card (16GB+) or a USB SSD for better performance
  • Power supply (official Pi PSU recommended)
  • Network connection (Ethernet or WiFi)
  • ~30 minutes of time

This path gets you up and running in about five minutes once your hardware is ready.

I recommend Raspberry Pi OS Lite (64-bit). You don’t need a desktop interface for a headless server.

  1. Open Raspberry Pi Imager.
  2. Choose Raspberry Pi OS Lite (64-bit).
  3. Click the gear icon to set your hostname to gateway-host, enable SSH, and configure your WiFi.
  4. Flash it to your SD card or USB drive, then boot your Pi.

SSH into your Pi from your main computer:

Terminal window
ssh user@gateway-host
# or use the IP address
ssh user@192.168.x.x

Once you’re in, update the system and install the basics:

Terminal window
sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl build-essential
sudo timedatectl set-timezone America/Chicago # Use your actual timezone

OpenClaw needs Node.js. Use the NodeSource script to get version 22:

Terminal window
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs

If you have 2GB of RAM or less, you need a swap file to prevent crashes.

Terminal window
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
echo 'vm.swappiness=10' | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Run the automated installer:

Terminal window
curl -fsSL https://openclaw.ai/install.sh | bash

Then start the onboarding wizard to set up your gateway and channels:

Terminal window
openclaw onboard --install-daemon

I suggest choosing “Local” mode and using Telegram for your first channel since it’s the easiest to configure on a Pi.

Since the Pi is headless, you can view the dashboard by creating an SSH tunnel from your laptop:

Terminal window
# Run this on your laptop/desktop
ssh -L 18789:localhost:18789 user@gateway-host

Now you can open http://localhost:18789 in your browser.

If the app crashes, check your memory with free -h. You might need to add more swap or stop other services running on the Pi.

If things feel sluggish, I recommend switching from an SD card to a USB SSD. You can also disable the GPU and Bluetooth to save resources:

Terminal window
# Disable GPU memory
echo 'gpu_mem=16' | sudo tee -a /boot/config.txt
# Disable Bluetooth
sudo systemctl disable bluetooth

Check the logs to see what went wrong:

Terminal window
journalctl -u openclaw --no-pager -n 100

If you used the “hackable” git install, try running npm run build again.

If you see an “exec format error,” a skill might be trying to run a tool that isn’t built for ARM64. You can try building that specific tool from source or look for an ARM64 version.

For a headless Pi, WiFi power management can sometimes cause drops. You can turn it off with:

Terminal window
sudo iwconfig wlan0 power off

If you hit a wall or need help with a specific hardware error, check out the AI Setup Assistant.

  • Linux guide — General Linux setup tips
  • DigitalOcean guide — If you decide you want the cloud after all
  • Tailscale — For secure remote access without SSH tunnels
  • Nodes — How to connect your other devices to this Pi gateway
OpenClaw

OpenClaw Expert

Still stuck?

If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.