BestVPSHosting.netVPS hosting compared RU

Updated

Blog · Tutorials

How to install OpenClaw on a VPS, step by step

Short answer: How to install OpenClaw on a VPS: log in as a non-root sudo user on 64-bit Linux with 2 GB RAM, run the official installer (curl -fsSL https://openclaw.ai/install.sh | bash), finish onboarding with openclaw onboard --install-daemon, enable systemd linger, and open the dashboard on port 18789 through an SSH tunnel. 2 GB plans start at $1.85 a month.

This guide shows how to install OpenClaw on a Linux VPS with the official installer and turn it into an always-on assistant: a systemd service that survives logouts and reboots, a Telegram bot as the chat channel, and a gateway that never faces the public internet. Commands follow the OpenClaw docs as of October 2026, and the whole OpenClaw setup takes about 30 minutes.

A server suits a 24/7 assistant because a laptop that sleeps takes the bot offline with it. Local installs on macOS and Windows are covered briefly at the end.

What you need before you install OpenClaw

OpenClaw is light because the model runs elsewhere, at a hosted provider or in a separate runtime. The gateway is a Node.js process that holds your config, sessions and workspace.

Requirement Official figure Notes
RAM 1 GB minimum, 2 GB+ recommended 1 GB works with swap; building the Docker image from source needs 6 GB
CPU 1 core No GPU needed for the gateway
Disk 500 MB free State lives in ~/.openclaw
OS 64-bit Linux (x86_64 or arm64), macOS, Windows ARMv7 is unsupported: no official Node builds
Node.js 24.16+ on the 24.x line, or 26.1+ Node 26 recommended; 24.22.1+ or 26.12.1+ strongly recommended
Network Outbound HTTPS Gateway listens on TCP 18789, bound to loopback
Model access API key, or an existing Claude Code or Codex CLI login Onboarding can reuse either

Node versions matter more than usual right now. Releases v2026.9.34 and v2026.10.6 require Node 24.22.1 or 26.12.1 at minimum, because those Node builds reject public keys compromised in the October 2026 eMudhra incident. Node 22, 23 and 25 are not supported at all.

Any mainstream image works. Ubuntu 24.04 LTS or 26.04 LTS is the usual pick, and 158 of the 192 providers that publish their OS list offer Ubuntu. As of November 30, 2026, the median price of the cheapest 2 GB plan across 196 providers is $10.00 a month. The table shows the top five of our VPS plans ranked for OpenClaw, each with at least 2 GB of RAM:

#ProviderPlanSpecsPrice / monthLocations
1LikeVPSLite+2 vCPU, 2 GB RAM, 40 GB NVMe, unmetered traffic$12.0026
2ContaboCloud VPS 44 vCPU, 8 GB RAM, 100 GB SSD, unmetered traffic$6.09
prepaid annually or longer
10
3OVHcloud VPSVPS-12 vCPU, 4 GB RAM, 40 GB NVMe, unmetered traffic$4.5411
4AlphaVPSC2G2 vCPU, 2 GB RAM, 30 GB NVMe, 3 TB traffic$3.337
5netcupVPS nano G11.5s2 vCPU, 2 GB RAM, 60 GB SSD, unmetered traffic$3.435

Top 5 of 196 providers in our Best VPS for OpenClaw ranking, updated November 30, 2026. Each plan meets the software's published minimum requirements.

ARM servers work too, as long as the OS is 64-bit; 13 providers in our data sell ARM VPS plans.

Step 1: Create a non-root user

Run OpenClaw under its own regular user, never as root (the security section explains why). If you have never prepared a fresh server, our guide on how to set up a VPS covers SSH keys and updates first, and the PuTTY guide covers connecting from Windows.

Log in as root, update the system, create the user, copy your SSH key to it, then reconnect as that user:

ssh [email protected]
apt update && apt upgrade -y
adduser openclaw
usermod -aG sudo openclaw
rsync --archive --chown=openclaw:openclaw ~/.ssh /home/openclaw
exit
ssh [email protected]

Connect directly over SSH rather than switching with su. Systemd user services need a real login session, and a su shell causes the "Failed to connect to bus" error in step 5.

Step 2: Check or install Node.js

The Linux installer provisions Node 24 LTS when Node is missing, so on a clean server you can skip to step 3. If Node is already installed, check the version:

node -v

You need v24.16.0 or newer on the 24.x line, or v26.1.0 or newer. Anything older than 24.22.1 or 26.12.1 triggers the runtime.node_security_patch warning in the security audit, and the latest releases require those versions. To manage Node yourself through NodeSource:

curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs

Upgrade Node before you update OpenClaw, never after. The docs warn that some older Node builds have a SQLite TEXT decoding bug that can truncate data.

Step 3: Run the official installer

The install script detects your OS, installs Node if needed, installs the openclaw CLI and, by default, starts onboarding. Adding --no-onboard lets you run onboarding as a separate, explicit step:

curl -fsSL https://openclaw.ai/install.sh | bash -s -- --no-onboard
openclaw --version

If you prefer npm and already have a supported Node, the Linux docs use:

npm i -g openclaw@latest --allow-scripts=openclaw

Drop --allow-scripts=openclaw on npm 11.15 or earlier. For a fully contained install, install-cli.sh keeps OpenClaw and its own Node under ~/.openclaw instead.

Step 4: Run onboarding and install the service

Onboarding is the guided part of the OpenClaw VPS setup. Start it with the flag that also installs the background service:

openclaw onboard --install-daemon

The prompts change between releases, but the decisions stay the same:

  1. Take the quick path, or the custom setup to see every option. openclaw onboard --classic gives the older step-by-step wizard.
  2. Connect a model: paste an API key from your provider, or reuse a Claude Code or Codex CLI login if one exists on the server.
  3. Keep the gateway on loopback with token authentication. Onboarding generates the token and stores it in ~/.openclaw/openclaw.json.
  4. Skip channels for now if you like; step 7 adds Telegram.
  5. Let it install the gateway service. On Linux this is a systemd user unit called openclaw-gateway.service, with Restart=always and RestartSec=5.

You can change any of this later with openclaw configure.

Step 5: Keep the gateway running after logout

By default, systemd stops a user's services when that user logs out or goes idle, which kills the gateway. Lingering fixes this. Onboarding and openclaw doctor offer to enable it, but confirm it yourself:

sudo loginctl enable-linger "$USER"
loginctl show-user "$USER" | grep Linger
openclaw gateway status

Expected output includes Linger=yes, and the gateway status should show it listening on port 18789. Useful service commands:

openclaw gateway restart
systemctl --user status openclaw-gateway.service
journalctl --user -u openclaw-gateway.service -f

Step 6: Open the dashboard through an SSH tunnel

The Control UI is served by the gateway on 127.0.0.1:18789, so it is not reachable from outside the server. Forward the port from your own computer:

ssh -N -L 18789:127.0.0.1:18789 [email protected]

Leave that terminal open, browse to http://127.0.0.1:18789/ and sign in with the gateway token (or the password, if you set gateway.auth.mode to "password"). Send a test message in the dashboard chat to confirm the model connection works. Tailscale Serve is the documented alternative if you want access from a phone without SSH.

Step 7: Connect a Telegram bot

Telegram is the quickest chat channel to connect because it needs no inbound port: OpenClaw uses long polling by default.

In Telegram, message @BotFather (check the exact username), send /newbot, follow the prompts and copy the token. Then add the channel to ~/.openclaw/openclaw.json. For the default account, setting TELEGRAM_BOT_TOKEN in the service environment works too.

{
  channels: {
    telegram: {
      enabled: true,
      botToken: "123456:ABC-your-token",
      dmPolicy: "pairing",
      groups: { "*": { requireMention: true } },
    },
  },
}

Restart the gateway, send your bot a message, then approve the pairing code it replies with:

openclaw gateway restart
openclaw pairing list telegram
openclaw pairing approve telegram <CODE>

Pairing codes expire after one hour. The pairing DM policy, which is Telegram's default, means strangers who find your bot get a code instead of access to your agent. Other channels such as WhatsApp use the same DM policies; run openclaw channels status --probe if a channel shows warnings.

Step 8: Close the firewall and run the audit

Because the gateway stays on loopback and Telegram polls outward, the only inbound port this server needs is SSH:

sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status verbose
ss -ltnp | grep 18789

The last command should show 127.0.0.1:18789, not 0.0.0.0:18789. Then run OpenClaw's own checks:

openclaw security audit --deep
openclaw security audit --fix

--fix applies safe changes only: it sets 600 permissions on files and 700 on directories in ~/.openclaw, turns open group policies into allowlists and restores log redaction.

OpenClaw VPS security: gateway, tokens, firewall and root

An OpenClaw agent can read files, run tools and act on messages from chat apps, so the server's security is the agent's security. Four rules cover most of the risk.

Keep the gateway private

The default and recommended bind is loopback. If you switch gateway.bind to lan or tailnet, the docs require a shared secret (gateway.auth.token or gateway.auth.password) unless a trusted proxy handles authentication. Putting the Control UI behind a public reverse proxy is possible, but the docs ask you to complete their exposure runbook first. For admin access, the docs suggest joining the VPS to a Tailscale tailnet and then restricting public SSH.

Treat the token like a root password

Anyone with the gateway token can drive your agent. Use a long random value, keep openclaw.json readable only by its owner, and rotate the token if it ever appears in a screenshot or chat log:

openssl rand -hex 32

Paste the result into gateway.auth.token, then run openclaw gateway restart and reconnect the dashboard.

Firewall: SSH only

Never add a UFW rule for 18789: channels and model APIs connect outward, and the dashboard goes through the tunnel. Our VPS security checklist covers SSH keys, fail2ban and updates.

Why not run OpenClaw as root

The gateway runs tools with the permissions of its OS user. As root, one prompt-injected message, a bad skill or a careless command can change anything on the server, including SSH keys and other apps. As a dedicated user, the damage stays inside that user's home directory. The docs go further: one OS user, host or VPS per trust boundary, and a separate runtime for any agent shared by a team. The systemd user unit and lingering are also designed around a regular user. Our page on root access explains the difference in plain terms.

How to update OpenClaw

OpenClaw releases frequently, and security fixes arrive through the same channel, so check for updates regularly:

openclaw update --dry-run
openclaw update
openclaw gateway status --deep

openclaw update detects how you installed (npm, pnpm, Bun or git), checks the new version while the old gateway keeps serving, then activates it. --channel beta, --channel extended-stable or --channel dev switches the release track, and the choice is saved.

Before a major update, take a full backup. Automatic config copies are not one, and package rollbacks do not reverse database migrations:

systemctl --user stop openclaw-gateway.service
tar czf ~/openclaw-backup-$(date +%F).tar.gz -C ~ .openclaw
systemctl --user start openclaw-gateway.service

A provider snapshot is a second safety net; see snapshots vs backups. If the unit is masked, run systemctl --user unmask openclaw-gateway.service first, or the update preflight refuses to run.

Common OpenClaw installation errors

These problems come up most often during an OpenClaw install on a VPS.

Symptom Cause Fix
openclaw: command not found npm's global bin is not on PATH Add export PATH="$(npm prefix -g)/bin:$PATH" to ~/.bashrc, then run hash -r
EACCES during npm install -g Global prefix owned by root npm config set prefix "$HOME/.npm-global" and add $HOME/.npm-global/bin to PATH
Install or update stops with a Node version error Node older than 24.22.1 or 26.12.1 Upgrade Node, then run openclaw doctor --fix
Failed to connect to bus or "user-level systemd is not running" No user session, often a shell opened with su Reconnect over SSH as the user, enable linger, run openclaw gateway install --force
Bot stops replying after you log out Lingering disabled sudo loginctl enable-linger "$USER"
Gateway restarts with exit code 137 Out-of-memory kill on a 1 GB server Add swap or move to 2 GB RAM
sharp build errors on install Conflicting global libvips SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g openclaw@latest
Telegram bot answers with a code only Pairing not approved, or code expired after 1 hour openclaw pairing list telegram, then approve the new code
Dashboard does not load SSH tunnel closed or token mistyped Reopen ssh -N -L 18789:127.0.0.1:18789 … and paste the token again

To add 2 GB of swap on Ubuntu or Debian:

sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

When the cause is not obvious, openclaw doctor prints its findings, and openclaw triage runs read-only health checks that it can hand, sanitized, to a coding agent you pick.

How to install OpenClaw locally instead

A local install uses the same CLI with a few changes:

  • macOS runs the same install.sh, provisions Node 26 if Node is missing and installs a LaunchAgent. Official Node 24+ builds need macOS 13.5 or newer.
  • Windows uses iwr -useb https://openclaw.ai/install.ps1 | iex and a Scheduled Task; the docs call WSL2 the more stable option.
  • openclaw dashboard opens the Control UI directly, with no tunnel.
  • The assistant is online only while the machine is awake and you stay logged in.

You can also keep the gateway on the VPS and pair your laptop or phone as a node for local screen, camera or shell access.

Next steps

With the gateway running as a service, Telegram paired and the firewall closed, the remaining work is choosing what the agent may do. Start with a narrow tool profile, add skills one at a time, and rerun openclaw security audit after each change. If you outgrow a 2 GB server, for example by adding a browser tool or a local model, compare plans in our OpenClaw VPS ranking or look at VPS plans for Ollama for running models yourself.

Frequently asked questions

Can OpenClaw run on a 1 GB VPS?

Yes, if you add swap. The official floor is 1 GB RAM, one core and 500 MB of free disk, and DigitalOcean's guide in the docs uses a 1 GB droplet with swap. 2 GB is the recommended size and avoids out-of-memory kills when the gateway starts or updates. See 2 GB VPS plans.

Do I need a GPU to run OpenClaw?

No. OpenClaw is a gateway: it sends prompts to a model provider such as Anthropic, OpenAI or Gemini, or to a local runtime like Ollama. The gateway itself needs no GPU. Running the model on the same server is a different job that needs far more RAM or a GPU; see our self-hosted LLM guide.

Should I open port 18789 on my VPS firewall?

No. The docs keep the gateway on loopback (127.0.0.1:18789) and reach it through an SSH tunnel or Tailscale. Telegram uses long polling by default, so chat channels work without any inbound port. If you bind to lan or tailnet, a gateway token or password is required.

Can I install OpenClaw with Docker instead?

Yes, the docs have a Docker guide, and the Hetzner guide uses it. Pre-built images run on small servers, but building the image from source needs at least 6 GB of RAM. The native install with a systemd user service is simpler to update with openclaw update.

How do I update OpenClaw on a VPS?

Run openclaw update. It detects whether you installed with npm, pnpm, Bun or git, checks the new version while the old gateway keeps serving, then switches over. Upgrade Node first, back up ~/.openclaw before big releases, and run openclaw doctor --fix if anything fails to load.

Is OpenClaw free?

The software is open source and free to self-host. Your costs are the server and the model: hosted providers bill per token or through a subscription login, while local models cost hardware. Our OpenClaw VPS ranking lists 2 GB plans by price.

Sources

Commands and requirements were checked against these pages on November 30, 2026. Prices and plan tables in the article come from our provider data, updated the same day.

  1. OpenClaw docs: Getting started
  2. OpenClaw docs: Install
  3. OpenClaw docs: Node compatibility
  4. OpenClaw docs: Linux gateway install
  5. OpenClaw docs: Linux server (VPS)
  6. OpenClaw docs: Gateway security
  7. OpenClaw docs: Security audit checks
  8. OpenClaw docs: Telegram channel
  9. OpenClaw docs: Install and updates
  10. OpenClaw on GitHub