- Any Ubuntu 22.04 VPS with 2 GB RAM and 2 vCPU runs OpenClaw comfortably in production
- Point your domain at the server before starting — TLS setup requires DNS to propagate first
- Create a dedicated system user for OpenClaw; never run it as root
- PM2 handles process supervision —
pm2 startupis mandatory, not optional - UFW firewall must block port 8080 from public access — only Nginx should proxy to it
I've set up OpenClaw on VPS instances from six different providers. The process is identical on all of them. What differs is the starting price and the time you waste when you miss a step. This guide is the version I wish existed when I started.
Why a VPS Is the Right Choice for OpenClaw
A VPS gives you a dedicated slice of a server — your own OS, your own processes, full root access. That's exactly what OpenClaw needs. It runs a persistent Node.js process (the gateway) that agents connect to over WebSocket. That pattern requires a persistent server environment. Shared hosting, serverless functions, and static site hosts cannot provide it.
The economics are compelling. As of early 2025, a 2 vCPU / 2 GB RAM VPS costs between $4 and $8 per month depending on provider. That gets you a 24/7 running agent server capable of handling multiple concurrent agent connections, tool calls, and LLM API interactions without bottlenecking on the host.
Here's where most people stop reading and start provisioning — but first you need to understand why the next step matters more than any other.
The single most common time-sink in VPS setups is running certbot before DNS has propagated. Point your domain's A record at the server IP the moment you provision the VPS. By the time you finish the software installation steps, DNS will be ready and Certbot will succeed on the first try.
Prerequisites and VPS Selection
Choose any VPS provider offering Ubuntu 22.04 LTS. The table below shows the most common choices used by the OpenClaw community:
| Provider | Entry Plan | Monthly Cost | Best For |
|---|---|---|---|
| Hetzner | CX22 (2vCPU/4GB) | ~$4.50 | Best value, EU datacenter |
| DigitalOcean | Basic (1vCPU/1GB) | $6 | Beginner-friendly UI |
| Vultr | Cloud Compute (1vCPU/1GB) | $6 | Many datacenter locations |
| Contabo | VPS S (4vCPU/6GB) | $6.99 | Maximum RAM per dollar |
For the purposes of this guide, we're using Ubuntu 22.04 LTS. The commands work identically on all four providers. Minimum spec recommendation: 2 vCPU / 2 GB RAM. If you expect multiple simultaneous agents making LLM calls, start at 4 GB.
Before provisioning: have a domain name ready. Free subdomains work. The requirement is just that you can set an A record pointing to your server's IP.
Step-by-Step VPS Installation
SSH into your fresh server as root and run these commands in order. Each block is a distinct phase — don't skip ahead.
Phase 1: Initial Server Setup
# SSH in
ssh root@YOUR_SERVER_IP
# Update and upgrade all packages
apt update && apt upgrade -y
# Create a non-root admin user
adduser deploy
usermod -aG sudo deploy
# Copy SSH key to new user
rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy
# Test new user login in a separate terminal before continuing
# ssh deploy@YOUR_SERVER_IP
Phase 2: Install Node.js 20 LTS
# Switch to deploy user
su - deploy
# Install Node.js 20 via NodeSource
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Verify
node --version # v20.x.x
npm --version # 10.x.x
Phase 3: Install and Configure OpenClaw
# Create installation directory
sudo mkdir -p /opt/openclaw
sudo chown deploy:deploy /opt/openclaw
cd /opt/openclaw
# Install OpenClaw (assuming your config repo)
git clone https://github.com/your-org/openclaw-config.git .
npm install --production
# Create environment configuration
cat > /opt/openclaw/.env << 'EOF'
NODE_ENV=production
PORT=8080
GATEWAY_TOKEN=your-strong-random-secret-here
OPENAI_API_KEY=sk-...
LOG_LEVEL=info
EOF
chmod 600 /opt/openclaw/.env
Phase 4: PM2 Process Manager
# Install PM2 globally
sudo npm install -g pm2
# Start OpenClaw
pm2 start src/index.js --name openclaw \
--max-memory-restart 800M \
--log /var/log/openclaw.log
# Save process list and configure startup
pm2 save
pm2 startup
# Copy and run the command PM2 outputs
Phase 5: Nginx and TLS
sudo apt install -y nginx certbot python3-certbot-nginx
# Create Nginx site config
sudo tee /etc/nginx/sites-available/openclaw > /dev/null << 'EOF'
server {
listen 80;
server_name agents.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;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 300s;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
# Issue TLS certificate
sudo certbot --nginx -d agents.yourdomain.com
Hardening and Firewall Configuration
The install is functional. Now make it secure. Two steps cover the essentials:
# Configure UFW
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow OpenSSH
sudo ufw allow 'Nginx Full'
sudo ufw enable
# Verify port 8080 is closed to the public
sudo ufw status
# You should NOT see 8080 in the output
Disable root SSH login to close the most-targeted attack vector:
sudo nano /etc/ssh/sshd_config
# Set: PermitRootLogin no
# Set: PasswordAuthentication no (if using SSH keys)
sudo systemctl restart sshd
At this point your OpenClaw installation is running at https://agents.yourdomain.com, supervised by PM2, protected by TLS, and hardened by UFW. As of early 2025, this setup has been production-stable across dozens of community deployments I've reviewed.
Before pointing any agent at your new gateway, verify it responds correctly: curl -H "Authorization: Bearer your-token" https://agents.yourdomain.com/health. A 200 response with a JSON health payload confirms the gateway is up, TLS is working, and your token is being accepted.
Common VPS Installation Mistakes
- Installing as root instead of a dedicated user — Root processes have unrestricted access to the entire server. A bug in an agent skill or a compromised dependency runs with those privileges. Create a deploy user on day one.
- Not running
pm2 startup— Your agents silently disappear every time the server reboots. This is the step 80% of first-time VPS deployers miss. - Skipping the firewall — Port 8080 exposed to the internet means your gateway token travels in plaintext to anyone who scans for open ports. UFW takes two minutes to configure.
- Using a 1 GB RAM VPS for multi-agent workloads — Node.js with active LLM call pipelines can consume 400–600 MB per process. Two agents plus system overhead will hit the 1 GB ceiling and trigger OOM kills.
- Forgetting to set
chmod 600on the.envfile — World-readable.envfiles expose your API keys to any process running on the server. Restrict file permissions immediately after creation.
Frequently Asked Questions
Which VPS provider is best for OpenClaw?
Hetzner and DigitalOcean are the most popular choices in the OpenClaw community. Hetzner offers better raw specs per dollar. DigitalOcean offers cleaner tooling, better documentation, and a more beginner-friendly control panel. Either works well for production deployments.
How much RAM does OpenClaw need on a VPS?
2 GB RAM is the practical minimum for production. With a single agent making occasional LLM calls, 1 GB is workable but tight. Multi-agent setups with parallel tool execution should start at 4 GB to avoid memory pressure under load.
Can I run OpenClaw on a shared hosting plan?
No. Shared hosting lacks persistent process control, custom port binding, and root-level system configuration that OpenClaw requires. A VPS or dedicated server is the minimum. Budget VPS options from Hetzner or Contabo start under $5 per month.
Do I need a domain name for my VPS OpenClaw install?
Not strictly, but strongly recommended. TLS certificates via Let's Encrypt require a domain. Without HTTPS, your gateway token and all agent communications travel in plaintext. A domain also gives you a clean URL rather than a bare IP address.
How do I SSH into my VPS to install OpenClaw?
Use ssh root@YOUR_SERVER_IP from your terminal, authenticating with the SSH key added during VPS creation or the root password from your provider. Create a non-root user immediately after first login and disable root SSH login before exposing the server to traffic.
How long does it take to install OpenClaw on a VPS from scratch?
Under 30 minutes for an experienced user following this guide. First-time server admins should budget 45–60 minutes. The longest step is DNS propagation — up to 30 minutes. The actual software installation takes under 10 minutes once dependencies are in place.
S. Rivera manages production OpenClaw infrastructure for teams ranging from solo developers to 50-person engineering organizations. Has deployed OpenClaw on Hetzner, DigitalOcean, Vultr, Contabo, AWS, and Azure — and written the runbooks to prove it.