Skip to content

OpenClaw on Ubuntu VPS: Complete Linux Setup Guide

nacre.sh TeamMay 3, 202611 min read

Full guide for setting up OpenClaw on an Ubuntu VPS. Covers user setup, Python installation, systemd service, nginx reverse proxy, and SSL configuration.

openclaw ubuntu vps setupopenclaw linuxopenclaw vpsopenclaw production

Setting up OpenClaw on an Ubuntu VPS is the traditional self-hosting path — a cloud VM gives you full control, 24/7 uptime, and complete access to the underlying Linux system. This guide covers a production-grade Ubuntu 24.04 LTS setup with systemd service management, nginx reverse proxy, and automated TLS certificates.

VPS Requirements

For a single OpenClaw instance with cloud LLM (no local model):

  • 2 vCPU, 2GB RAM minimum
  • 20GB SSD storage
  • Ubuntu 24.04 LTS

Good options: DigitalOcean ($18/mo), Hetzner CX22 ($4.99/mo, excellent value), Vultr ($12/mo), or Linode.

Initial Server Setup

# SSH in as root, then create a dedicated user
adduser openclaw
usermod -aG sudo openclaw
su - openclaw

# Update system
sudo apt update && sudo apt upgrade -y

# Install dependencies
sudo apt install python3.12 python3.12-venv python3-pip git nginx certbot python3-certbot-nginx -y

Install OpenClaw

git clone https://github.com/openclaw/openclaw.git ~/openclaw
cd ~/openclaw
python3.12 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python -m openclaw onboard

Create a systemd Service

sudo nano /etc/systemd/system/openclaw.service
[Unit]
Description=OpenClaw AI Agent
After=network.target

[Service]
Type=simple
User=openclaw
WorkingDirectory=/home/openclaw/openclaw
ExecStart=/home/openclaw/openclaw/venv/bin/python -m openclaw start
Restart=always
RestartSec=10
Environment=PATH=/home/openclaw/openclaw/venv/bin:/usr/bin:/bin

[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclaw

Configure Nginx and TLS

Point your domain's DNS A record to your VPS IP. Then:

sudo certbot --nginx -d yourdomain.com

Certbot automatically configures nginx and schedules automatic renewal.

Edit /etc/nginx/sites-available/openclaw:

server {
    server_name yourdomain.com;
    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
    }
}

Firewall Configuration

sudo ufw allow ssh
sudo ufw allow 'Nginx Full'
sudo ufw enable
sudo ufw status

Monitoring and Logs

# View live logs
journalctl -u openclaw -f

# Check service status
systemctl status openclaw

# Restart after config changes
sudo systemctl restart openclaw

Automated Backups

Add a cron job to back up OpenClaw data daily:

crontab -e
# Add:
0 3 * * * tar czf ~/backups/openclaw-$(date +%%Y%%m%%d).tar.gz ~/.openclaw/ && find ~/backups -name "openclaw-*.tar.gz" -mtime +30 -delete

Frequently Asked Questions

Which VPS provider offers the best value for OpenClaw?

Hetzner's CX22 (2 vCPU, 4GB RAM, €4.35/month) is widely regarded as the best value in 2026, particularly for European and Asian users. DigitalOcean offers excellent support documentation.

How do I update OpenClaw on a VPS?

cd ~/openclaw && git pull && source venv/bin/activate && pip install -r requirements.txt && sudo systemctl restart openclaw

What's the difference between running OpenClaw on VPS vs nacre.sh?

On a VPS you own everything — setup, maintenance, backups, patches, monitoring. nacre.sh handles all of that automatically for $12/month, often cheaper than the true total cost of VPS self-hosting.

nacre.sh

Run OpenClaw without the server headaches

Dedicated instance, automatic TLS, nightly backups, and 290+ LLM integrations. Live in under 90 seconds from $12/month.

Deploy your agent →

Related posts