This site contains affiliate links. If you purchase through them I may earn a commission at no extra cost to you. Full disclosure.
The short answer: Yes, you can absolutely run OpenClaw on a Hostinger VPS. It's a solid choice: clean Ubuntu images, good network, and affordable NVMe storage. The full deployment takes about 30 minutes if you follow this guide exactly. I'll show you the exact commands, configuration files, and pitfalls to avoid.
"Deploying OpenClaw on a VPS is the sweet spot between full self-hosting and cloud convenience. You own the infrastructure but keep the automation. Just don't skip the firewall."
OpenClaw is designed to run on a server you control. A VPS gives you:
Hostinger's KVM plans are particularly good for this: they use KVM virtualization (so you get real isolation), NVMe storage, and include a dedicated IPv4 address.
Before you start, have these ready:
sudo and editing config files.Once your VPS is provisioned, log in as root via SSH:
ssh root@your-vps-ip
First, update everything:
apt update && apt upgrade -y
Set a strong root password (if you haven't already):
passwd
Replace openclaw with your preferred username:
adduser openclaw
usermod -aG sudo openclaw
Switch to that user for the rest of the installation:
su - openclaw
Before we go further, secure SSH. Edit the config:
sudo nano /etc/ssh/sshd_config
Make sure these lines are present (adjust as needed):
Port 2222 # Change from 22 to something else
PermitRootLogin no
PasswordAuthentication no # Only if you use SSH keys
AllowUsers openclaw
Restart SSH:
sudo systemctl restart ssh
Test the new port in a separate terminal before closing your current session:
ssh -p 2222 openclaw@your-vps-ip
sudo apt install -y ufw fail2ban
Allow SSH on your custom port (replace 2222):
sudo ufw allow 2222
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw --force enable
Check status:
sudo ufw status
fail2ban runs by default. Check its status later if you suspect SSH brute force attempts:
sudo fail2ban-client status sshd
OpenClaw needs Node.js LTS. Use NodeSource for an up-to-date version:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
Verify installation:
node --version # should be v20.x
npm --version
Install pm2 globally for process management:
sudo npm install -g pm2
Save pm2 process list so it resurrects on reboot:
pm2 start systemd
pm2 save
This ensures pm2 starts on boot and resurrects your processes:
sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u openclaw --hp /home/openclaw
As the openclaw user, clone the repository:
cd ~
git clone https://github.com/openclaw/openclaw.git
cd openclaw
npm ci --only=production
Run the initial setup (this creates .openclaw/config.json):
npm run setup
Follow the prompts. At minimum, set:
NODE_ENV=productionpm2 start npm --name "openclaw" -- start
pm2 save
Check it's running:
pm2 status
pm2 logs openclaw
Test the web UI locally:
curl http://localhost:3000
Caddy automatically gets SSL certificates from Let's Encrypt. Install it:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/caddy-stable-archive-keyring.gpg] https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main" | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy
Create a Caddyfile pointing to your domain and OpenClaw's port:
sudo nano /etc/caddy/Caddyfile
Content (replace yourdomain.com):
yourdomain.com {
reverse_proxy localhost:3000
encode gzip
file_server
}
Reload Caddy:
sudo systemctl reload caddy
Caddy will automatically obtain and renew SSL certificates.
localhost:3000 and use certbot for SSL.
Review your ~/.openclaw/config.json (or wherever you placed it). Important settings:
{
"port": 3000,
"host": "127.0.0.1", // bind to localhost only
"gatewayToken": "your-gateway-token-if-using-gateway",
"logLevel": "info",
"maxConcurrentAgents": 4,
"defaultModel": "nvidia/stepfun-ai/step-3.5-flash"
}
Mount points: If you use external storage or bind mounts, ensure the openclaw user has read/write permissions.
https://yourdomain.com in your browser.pm2 logs openclaw and sudo journalctl -u caddy -fAnother process is occupying the port. Find it:
sudo lsof -i :3000
sudo systemctl stop conflicting-service
Check the logs. Common causes:
.openclaw directory — run npm run setup again.openclaw user owns its home directory.Caddy needs port 80 and 443 open in the firewall, and your domain's DNS must point to the VPS IP. Verify:
dig yourdomain.com +short # should resolve to VPS IP
sudo ufw status # ports 80, 443 allowed
sudo systemctl status caddy
OpenClaw can be memory-hungry with many agents. Tune:
maxConcurrentAgents in config.pm2 start npm --name openclaw -- start --node-args="--max-old-space-size=512"sudo fallocate -l 1G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfilecd ~/openclaw && git pull && npm ci && pm2 restart openclaw~/.openclaw daily. This contains your agent definitions and secrets.pm2 monit for a quick view, or set up basic Prometheus node exporter for long-term metrics.~/.pm2/logs if needed.Backups are essential. At minimum, back up:
~/.openclaw/ — contains your agent definitions, credentials, and configuration./var/lib or your custom paths).Here's a simple daily backup script that compresses your OpenClaw config and uploads to Backblaze B2 or any S3-compatible storage using rclone:
#!/bin/bash
set -euo pipefail
BACKUP_DIR="/root/backups"
OPENCLAW_HOME="/home/openclaw/.openclaw"
DATE=$(date +%Y-%m-%d)
mkdir -p "$BACKUP_DIR"
tar -czf "$BACKUP_DIR/openclaw-config-$DATE.tar.gz" -C "$OPENCLAW_HOME" .
# Optional: upload with rclone
# rclone copy "$BACKUP_DIR/openclaw-config-$DATE.tar.gz" remote:bucket/backups/
# Optional: delete local backups older than 7 days
find "$BACKUP_DIR" -type f -name "openclaw-config-*.tar.gz" -mtime +7 -delete
Store this script as /usr/local/bin/backup-openclaw.sh, make it executable (chmod +x), and add a cron job:
0 2 * * * /usr/local/bin/backup-openclaw.sh
That runs daily at 2 AM. Adjust as needed.
fail2ban for SSH and OpenClaw's web port.iptables to rate-limit connections to port 3000 from non-localhost if your reverse proxy is on a different server.sudo apt update && sudo apt upgrade -y run weekly.Need a reliable VPS for OpenClaw? The Hostinger KVM 2 plan (2 vCPU / 8 GB RAM / 200 GB NVMe) is a great starting point. It's fast, includes a dedicated IP, and the Ubuntu images are clean. Use my link to get started — you'll support this site at no extra cost.