Deploy OpenClaw on Hetzner VPS
⏱️ ~10 minutes · 💰 €3.99/month
Hetzner Cloud is our top pick for OpenClaw hosting. This guide takes you from zero to a running OpenClaw agent with 24/7 uptime, auto-restart, and basic security hardening.
Create Your Hetzner Account & Server
Sign up at hetzner.com and create a new project. Then create a server:
- Location: Falkenstein (EU) or Ashburn (US) — pick closest to you
- Image: Ubuntu 24.04 LTS
- Type: CX22 (2 vCPUs, 4GB RAM, 40GB NVMe) — €3.99/mo
- SSH Key: Add your public key (or use password — less secure)
- Name: Something memorable like
openclaw-prod
ssh-keygen -t ed25519 on your local machine.Connect to Your Server
Once the server is created (takes ~30 seconds), connect via SSH:
ssh root@YOUR_SERVER_IP
First time? You'll be asked to confirm the server fingerprint. Type yes.
Create a Non-Root User
Never run OpenClaw as root. Create a dedicated user:
# Create user and add to sudo group
adduser openclaw
usermod -aG sudo openclaw
# Copy SSH key to new user
mkdir -p /home/openclaw/.ssh
cp /root/.ssh/authorized_keys /home/openclaw/.ssh/
chown -R openclaw:openclaw /home/openclaw/.ssh
# Switch to new user
su - openclaw
Install Node.js 22 LTS
# Install Node.js via NodeSource
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# Verify installation
node --version # Should show v22.x.x
npm --version # Should show 10.x.x
Install OpenClaw
# Install globally
sudo npm install -g openclaw
# Verify
openclaw --version
Configure OpenClaw
# Run the setup wizard
openclaw init
# This will ask you for:
# - Your LLM provider (Anthropic, OpenRouter, etc.)
# - API key
# - Channel (Telegram, Discord, etc.)
# - Other preferences
Set Up Auto-Start with systemd
Make OpenClaw start automatically on boot and restart on crashes:
# Create systemd service
sudo tee /etc/systemd/system/openclaw.service > /dev/null <<'EOF'
[Unit]
Description=OpenClaw AI Agent
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=openclaw
WorkingDirectory=/home/openclaw
ExecStart=/usr/bin/openclaw gateway start --foreground
Restart=always
RestartSec=10
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
# Enable and start
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
# Check status
sudo systemctl status openclaw
Basic Security Hardening
# Update system
sudo apt update && sudo apt upgrade -y
# Set up firewall
sudo ufw allow ssh
sudo ufw allow 443/tcp
sudo ufw enable
# Disable root SSH login
sudo sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
sudo systemctl restart sshd
You're Live! 🎉
Your OpenClaw agent is now running 24/7 on Hetzner. It will auto-restart on crashes and boot automatically after server reboots.
Useful commands:
# Check OpenClaw status
sudo systemctl status openclaw
# View logs
sudo journalctl -u openclaw -f
# Restart OpenClaw
sudo systemctl restart openclaw
# Update OpenClaw
sudo npm update -g openclaw
sudo systemctl restart openclaw
Don't have a Hetzner account yet?
Get the CX22 (2 vCPUs, 4GB RAM, 40GB NVMe) for just €3.99/month.
Create Hetzner Account →Or compare all providers: Best VPS for OpenClaw →