DEV Community

hakiimi
hakiimi

Posted on

How to Set Up an OpenClaw Agent on a VPS (Step-by-Step)

Running an OpenClaw agent on a VPS unlocks 24/7 automation without keeping your laptop on. This is the setup I use for my content agents. Here is the exact path.

Why a VPS

A VPS gives your agents a permanent home: always-on, stable IP, no sleep mode, and room for multiple agents and scheduled jobs. Any basic Linux VPS (2GB RAM) is enough to start.

1. Spin up the server

  • Choose a Linux distro (Ubuntu 22.04 LTS is the easiest start).
  • Connect over SSH.
  • Update everything: sudo apt update && sudo apt upgrade -y.

2. Install Node.js (required for OpenClaw)

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
Enter fullscreen mode Exit fullscreen mode

3. Install OpenClaw

npm i -g openclaw
openclaw --version
Enter fullscreen mode Exit fullscreen mode

Configure the gateway token and keep it bound to loopback or behind a reverse proxy.

4. Run as a service (survives reboots)

Create /etc/systemd/system/openclaw.service, enable and start it, and your gateway comes back automatically after any reboot.

5. Connect from anywhere

With the agent headless on the server, connect a chat channel (Telegram, Slack, Discord) and schedule jobs on the server clock.

Security checklist

  • Keep the gateway bound to 127.0.0.1 or behind HTTPS reverse proxy.
  • Use a strong auth token.
  • Never expose raw ports publicly.

Wrap up

That is the whole flow: server, Node, OpenClaw, systemd, remote access. Once it is running, your agent works around the clock - the entire point of a VPS.

Top comments (0)