You bought OpenClaw because the laptop edition was already running half your inbox and you want it to keep running while the laptop is closed. The plan is a small VM on the company’s Virtuozzo Hybrid Server cluster — same hypervisor that runs the rest of the production estate, same SAN, same backup window. The temptation is to drop a curl | bash on a fresh Ubuntu and call it a day. Six weeks later the gateway is bound on 0.0.0.0:18789, the workspace lives under /root/.openclaw/, the daemon dies on the first OOM because the VM was sized for a static blog, and the WhatsApp pairing token sat in ~/.bash_history until somebody noticed.
OpenClaw is a Node.js application that hosts a long-running gateway daemon, listens on TCP 18789 by default, and stores everything that matters — memory, skills, prompts, integration tokens — under a workspace directory (openclaw.ai/install, github.com/openclaw/openclaw). On a hypervisor like Virtuozzo Hybrid Server you get the boring half for free: snapshots, live migration, IOPS isolation. The interesting half is everything above the kernel — sizing the guest, putting the workspace on a disk the backup picks up, running the daemon as a dedicated system user, and keeping the gateway off the public internet.
What’s happening
A production-ready OpenClaw guest on Virtuozzo Hybrid Server is closer to a small application server than a desktop install. The VM template should be Ubuntu 22.04 or 24.04 LTS, two vCPU and 4 GB RAM as a starting point, with a separate qcow2 disk attached at /var/lib/openclaw/ so the workspace can be snapshotted and resized independently of the OS disk (docs.virtuozzo.com — Virtuozzo Hybrid Server). Node.js comes from NodeSource — Node 24 is the recommended runtime per the project’s package metadata (github.com/openclaw/openclaw) — installed system-wide so the daemon does not depend on a per-user nvm shim. The daemon runs as a non-root system user (openclaw) under systemd, never as root and never under your interactive account. The gateway binds on 127.0.0.1:18789; Caddy, Tailscale, or a Cloudflare Tunnel does the public-edge work and gets the TLS terminator. The integration tokens — Telegram bot keys, Spotify OAuth refresh tokens, Anthropic API keys — live in a 0600 env file owned by the openclaw user, never in a YAML that ends up on git, and the systemd unit pulls them via EnvironmentFile=.
Skip any of that and the VM either leaks the daemon to the public internet on a port nobody has heard of, drifts away from the backup policy because the workspace is on the wrong disk, or quietly stops the day Node fails an unattended upgrade because nothing was pinned.
Prerequisites
Before you log in to the VM:
- A Virtuozzo Hybrid Server cluster with a project you can deploy into and the
prlctlCLI on a management host, or operator access to the Virtuozzo Automator panel. - An Ubuntu 22.04 or 24.04 LTS guest template.
- A DNS name you can point at the VM (or a Tailnet — see DNS, TLS, and secure remote access to OpenClaw).
- An LLM provider key (Anthropic, OpenAI, or a local model endpoint) — see the LLM backends section in the OpenClaw README.
- A Stack Harbor account or your own bastion to SSH in from. Direct internet SSH to the VM is not the plan.
How to verify
After the VM is built and OpenClaw is running, the listeners should be exactly these:
ss -lntp | grep -E ':(22|443|18789)\b'
# 0.0.0.0:22 sshd
# 0.0.0.0:443 caddy (or absent, if you're using Cloudflare Tunnel)
# 127.0.0.1:18789 node (openclaw gateway)
The gateway must be on 127.0.0.1, never 0.0.0.0. The systemd unit must be enabled and active:
systemctl status openclaw-gateway.service
journalctl -u openclaw-gateway.service -n 50 --no-pager
The workspace must be on the data disk, not the OS disk:
df -h /var/lib/openclaw/
# Should be on /dev/vdb1 or similar, not /
findmnt /var/lib/openclaw
And openclaw doctor should return green on every check (github.com/openclaw/openclaw — CLI reference):
sudo -u openclaw HOME=/var/lib/openclaw /usr/bin/openclaw doctor
The fix
1. Provision the guest on Virtuozzo Hybrid Server
From a management host with prlctl, create the VM from the Ubuntu 24.04 template and attach a second disk for the workspace. Substitute your own VM name, network, and storage policy:
prlctl create openclaw-prod \
--vmtype vm \
--ostemplate ubuntu-24.04-cloudimg \
--no-hdd
prlctl set openclaw-prod --cpus 2
prlctl set openclaw-prod --memsize 4096
# OS disk
prlctl set openclaw-prod --device-add hdd --size 20480 --image-format qcow2
# Workspace disk — separate so it can be snapshotted independently
prlctl set openclaw-prod --device-add hdd --size 50480 --image-format qcow2
# Attach to the project's private network; public NIC comes from your edge policy
prlctl set openclaw-prod --device-add net --network private-svc
prlctl start openclaw-prod
If you prefer the panel, the equivalent in the Virtuozzo Automator UI is: create VM from template, set CPU/RAM, add a second virtual disk on the same storage policy, attach to the project’s private network, finish the wizard.
For a fully automated build instead of the manual steps below, hand the cloud-init template from A cloud-init template for OpenClaw on a fresh VPS to the VM at first boot — it covers everything in this section non-interactively.
2. Format the workspace disk
SSH in via your bastion. The second disk usually appears as /dev/vdb:
lsblk
# vdb 254:16 0 50G 0 disk
Partition, format, mount, and persist:
sudo parted -s /dev/vdb mklabel gpt mkpart primary ext4 0% 100%
sudo mkfs.ext4 -L openclaw-data /dev/vdb1
sudo mkdir -p /var/lib/openclaw
echo "LABEL=openclaw-data /var/lib/openclaw ext4 defaults,noatime 0 2" \
| sudo tee -a /etc/fstab
sudo mount /var/lib/openclaw
df -h /var/lib/openclaw
For sizing rationale and how the workspace grows with skills and memory, see Sizing storage for OpenClaw memory and skills.
3. Install Node.js 24 from NodeSource
OpenClaw’s package metadata recommends Node 24 (github.com/openclaw/openclaw). Ubuntu’s stock Node is too old, so use NodeSource:
sudo apt-get update
sudo apt-get install -y curl ca-certificates gnupg build-essential
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v # v24.x
npm -v
Hold the package so an apt upgrade cannot pull a new major behind your back:
sudo apt-mark hold nodejs
4. Create the system user and install OpenClaw globally
The daemon runs as a dedicated non-login user with the workspace as its home:
sudo useradd --system --home-dir /var/lib/openclaw --shell /usr/sbin/nologin openclaw
sudo chown -R openclaw:openclaw /var/lib/openclaw
sudo chmod 750 /var/lib/openclaw
Install OpenClaw globally so the openclaw binary lives in /usr/bin/:
sudo npm install -g openclaw@latest
which openclaw
# /usr/bin/openclaw
openclaw --version
The npm package is openclaw (github.com/openclaw/openclaw).
5. Write the env file
Generate or paste your LLM provider key and any integration tokens into a root-owned env file that systemd will pull at start:
sudo install -d -m 0750 -o openclaw -g openclaw /etc/openclaw
sudo tee /etc/openclaw/openclaw.env >/dev/null <<'ENV'
# Anthropic / OpenAI / local model
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Workspace location (overrides $HOME)
OPENCLAW_HOME=/var/lib/openclaw
# Bind the gateway only on loopback; Caddy / Tailscale faces the world
OPENCLAW_GATEWAY_BIND=127.0.0.1
OPENCLAW_GATEWAY_PORT=18789
# Channel integrations — add as you pair them
# TELEGRAM_BOT_TOKEN=
# SIGNAL_NUMBER=
ENV
sudo chown root:openclaw /etc/openclaw/openclaw.env
sudo chmod 0640 /etc/openclaw/openclaw.env
6. Create the systemd unit
sudo tee /etc/systemd/system/openclaw-gateway.service >/dev/null <<'UNIT'
[Unit]
Description=OpenClaw gateway daemon
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=openclaw
Group=openclaw
WorkingDirectory=/var/lib/openclaw
EnvironmentFile=/etc/openclaw/openclaw.env
ExecStart=/usr/bin/openclaw gateway --port 18789
Restart=on-failure
RestartSec=5
StandardOutput=journal
StandardError=journal
# Hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ReadWritePaths=/var/lib/openclaw
ProtectHome=true
ProtectKernelTunables=true
ProtectKernelModules=true
ProtectControlGroups=true
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
RestrictNamespaces=true
LockPersonality=true
MemoryDenyWriteExecute=false
SystemCallArchitectures=native
# Resource limits — adjust if you size up
LimitNOFILE=65536
MemoryMax=3G
[Install]
WantedBy=multi-user.target
UNIT
sudo systemctl daemon-reload
sudo systemctl enable --now openclaw-gateway.service
sudo systemctl status openclaw-gateway.service --no-pager
The unit references openclaw gateway --port 18789 because that’s the documented gateway subcommand on the project (github.com/openclaw/openclaw). The ProtectSystem=strict plus ReadWritePaths=/var/lib/openclaw block stops the daemon from writing anywhere outside its workspace even if a skill tries.
7. Run onboarding once
The first run pairs the gateway with your account and writes ~/.openclaw/openclaw.json (here, /var/lib/openclaw/.openclaw/openclaw.json):
sudo systemctl stop openclaw-gateway.service
sudo -u openclaw HOME=/var/lib/openclaw /usr/bin/openclaw onboard
sudo systemctl start openclaw-gateway.service
Onboarding asks you to confirm the workspace location, pick an LLM provider, and authorize the device. Do this once — the daemon takes over from then on.
8. Put an edge in front
The gateway is on 127.0.0.1:18789. To use it from your phone, you need something the public internet can reach. Three reasonable options, in order of preference:
- Tailscale — the VM joins your tailnet, your phone joins your tailnet, no public ingress. Lowest attack surface. See Private-network architecture for an OpenClaw deployment.
- Cloudflare Tunnel — the VM dials out to Cloudflare, no inbound firewall hole. See DNS, TLS, and secure remote access to OpenClaw.
- Caddy in front of the gateway with Let’s Encrypt — classic reverse-proxy pattern, with the VM exposing
:443only. Same article covers the Caddy config.
For tightening which ports are actually reachable on this VM, see Firewall rules for an OpenClaw IaaS deployment.
9. Wire the workspace into your backup
Virtuozzo Hybrid Server can snapshot the workspace disk independently because you put it on its own qcow2:
prlctl snapshot openclaw-prod -n "pre-skill-update-$(date +%F)"
prlctl snapshot-list openclaw-prod
That’s the fast undo. For an off-host copy, run restic from inside the VM against an S3-compatible target. The cadence and what counts as a tested restore is the topic of Snapshot and backup strategy for cloud-hosted OpenClaw.
10. Sanity check
sudo -u openclaw HOME=/var/lib/openclaw /usr/bin/openclaw doctor
sudo -u openclaw HOME=/var/lib/openclaw /usr/bin/openclaw agent
# Type something, confirm the model answers, exit.
If openclaw doctor complains about the workspace permissions, the most common cause is that the HOME= override is missing — without it, openclaw looks under /root/.openclaw and writes nothing useful.
What you should expect at runtime
The Node process idles at a few hundred MB resident on a quiet day and spikes during long agent runs, browser automation, or local-model inference. The MemoryMax=3G in the unit gives the kernel a hard ceiling and stops a runaway skill from taking the VM down with it. Disk writes are dominated by the memory subsystem and skill artifacts — a single user with heavy chat and a dozen skills typically lands under 10 GB after a few months of use, well under the 50 GB workspace disk this guide provisions.
If the workload outgrows two vCPU, resize on the panel; Virtuozzo Hybrid Server supports hot CPU and RAM additions on Ubuntu 24.04 guests for most configurations (docs.virtuozzo.com). The systemd MemoryMax is the only thing you have to bump by hand after a resize.
Run the production OpenClaw on a Stack Harbor-managed environment with patch cadence, monitoring, and Sev-1 escalation built in: Managed Cloud Ops — or talk to us about an AI deployment if you want this scoped end to end.
Last verified on OpenClaw current.