AI Agent

Optimizing OpenClaw Installation for Raspberry Pi and SD Card

Today we are going to learn how to install OpenClaw from scratch on a Raspberry Pi using an SD card.

Logo OpenClaw

Step 1: Flash the SD card with Raspberry Pi Imager

Do not use the normal Windows or Mac formatter. Use Raspberry Pi Imager (the official tool).

Step 2: Update the system on first boot

Don’t update anything until you plug the SD card into the Pi and connect over SSH:

sudo apt update && sudo apt upgrade -y

Step 3: Install Node.js (the right version)

To avoid installing version v24 or experimental versions, we’ll use the official installer for the stable v22 (LTS):

# We download the script from version 22 curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - # Install Node.js sudo apt-get install -y nodejs 

Confirm that everything is okay with node -v. It should say v22.x.x.

Step 4: Install log2ram to protect the SD card

This will save your SD card: we are going to install a utility that stores logs in RAM and only writes them to the SD card once a day.

sudo apt install git -y git clone https://github.com/azlux/log2ram.git cd log2ram chmod +x install.sh sudo ./install.sh # Hay que reiniciar para que se active sudo reboot

Step 5: Install OpenClaw

Now that the system is clean and optimized so it doesn’t wear out the SD card, install OpenClaw:

sudo npm install -g openclaw

And now we can configure OpenClaw.

Step 6: Fix IPv6 issues

vi ~/.profile

Go to the end of the file and paste this line:

export NODE_OPTIONS="--dns-result-order=ipv4first"

Save and then apply the change:

source ~/.profile

Leave a Comment