Install OpenClaw on Ubuntu Server: A Working Setup

·

·

To install OpenClaw on Ubuntu Server, use root only to bootstrap: update the system, install Node 24, run the installer with --no-onboard, and create a dedicated openclaw user. As that user, run onboarding so the Gateway installs as a systemd user service. The docs put the job at about 20 minutes [6].

What do you need before you install OpenClaw on Ubuntu Server?

You need a clean Ubuntu LTS server (the docs use 24.04 LTS), a small VPS with at least 1 GB of RAM plus swap, and a supported Node version, which the installer can provide.

The docs state that "the Gateway is fully supported on Linux," with Node as the recommended runtime [1]. Canonical’s Ubuntu release cycle page lists these LTS dates (checked November 24, 2026) [7]:

Ubuntu release Released Standard security maintenance until
26.04 LTS April 2026 May 2031
24.04 LTS April 2024 May 2029
22.04 LTS April 2022 May 2027

The OpenClaw guides name Ubuntu 24.04 LTS and, on the pages read, say nothing about 26.04 LTS [6]. For the documented path, pick 24.04 LTS.

For hardware, OpenClaw’s own DigitalOcean setup guide uses "1 vCPU / 1 GB RAM / 25 GB SSD" and quotes "~$6/month for the 1 GB Basic plan" (the docs’ figure as of November 24, 2026, not checked at DigitalOcean) [6]. That leaves little headroom, which is why the guide adds swap. If you are still choosing a provider, see this comparison of the cheapest VPS options for OpenClaw.

The same guide warns: "Use a clean base image (Ubuntu 24.04 LTS). Avoid third-party Marketplace 1-click images unless you have reviewed their startup scripts and firewall defaults." [6]

OpenClaw needs Node 24.16.0+ on the 24.x line, or 26.1.0+; the docs "strongly recommend" 24.22.1+ or 26.12.1+ for security [2][3]. The current npm package is openclaw 2026.11.8, and release v2026.11.8 was published on GitHub on November 24, 2026 [4][5].

One trap: some distro Node packages link the system SQLite library. The recommended installer checks the Node and SQLite combination and switches to a user-space Node runtime when the distro build is unsafe, without removing the distro package [3]. Two Node versions on the box afterwards is therefore expected, not a broken install.

How do you install OpenClaw on Ubuntu Server step by step?

Log in as root, run a short bootstrap, then hand everything else to a non-root openclaw user who owns the Gateway and its state. These commands come from the official DigitalOcean guide, which works for any Ubuntu server [6].

Step 1: Bootstrap the system as root

Connect over SSH as root and update the packages first:

apt update && apt upgrade -y

Add the NodeSource repository for Node 24 and install Node:

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

Install OpenClaw, but skip onboarding for now:

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

The --no-onboard flag keeps this setup clean. Onboarding creates your config, Gateway token and systemd service. If it ran now, all of that would belong to root.

Step 2: Create the openclaw user

Still as root, create the user, give it sudo rights, and enable lingering:

adduser openclaw
usermod -aG sudo openclaw
loginctl enable-linger openclaw

adduser asks for a password. Set a strong one, since this account can use sudo.

Why root is only used for bootstrap

The docs say to "use the root shell only for system bootstrap" and run OpenClaw as the openclaw user, so state lives under /home/openclaw/.openclaw/ and the Gateway installs as that user’s systemd --user service [6].

Three reasons sit behind that rule. Ownership: config, tokens and workspace live in one home directory, where backups and updates expect them. The service model: the managed unit is a systemd user unit by default [1], and a user unit needs a real user. Containment: an agent that can call tools on your server should not do so as root.

Lingering makes the user service work on a server. OpenClaw’s own Raspberry Pi guide, which installs the same systemd user service, says to enable lingering "so the user service survives logout" [20]. Without it, closing SSH can take the Gateway down. loginctl enable-linger openclaw is the line people skip.

Step 3: Switch user and check the install

su - openclaw
openclaw --version

A printed version means it worked. openclaw: command not found is covered in the error table below.

Step 4: Run onboarding and install the daemon

As the openclaw user:

openclaw onboard --install-daemon

This "walks you through model auth, channel setup, Gateway token generation, and daemon installation (systemd user service)" [6].

Step 5: Add swap on a 1 GB server

The guide calls swap "recommended for 1 GB Droplets" [6]. On a 1 GB VPS, treat it as required:

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

The last line adds the swap file to /etc/fstab so it survives a reboot. Skip it and swap disappears on the next restart.

Step 6: Verify the Gateway

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

The install page adds openclaw doctor and openclaw gateway status [2]. Run openclaw doctor once now; it catches configuration warnings before they become outages.

If you manage Node yourself

On npm 12 or npm 11.16+, the install docs give this path [2]:

npm install -g openclaw@latest --allow-scripts=openclaw
openclaw onboard --install-daemon

On npm 11.15 and earlier, drop --allow-scripts=openclaw. The flag exists because npm 12 blocks unapproved lifecycle scripts by default, reporting them as "blocked because they are not covered by allowScripts". npm approve-scripts openclaw does not work for a global install; it fails with ENOMATCH [2].

Why does the Gateway service fail to start or stop after logout?

The Gateway runs as a systemd user unit, so it depends on lingering, a working user session and Ubuntu’s user-manager settings. Duplicate system-level units cause most of the remaining trouble.

Both openclaw onboard --install-daemon and openclaw gateway install render a user unit by default; a system-level unit exists as a variant for shared or always-on hosts [1]. Read the exact unit with:

systemctl --user cat openclaw-gateway.service

The unit uses Restart=always with RestartSec=5 [1][10], so a crashed Gateway comes back on its own. The docs also list "an unavailable user session bus on a systemd host" as a separate diagnostic, without a fix on the pages read [1].

In March 2026, one user reported this error on Ubuntu: systemctl is-enabled unavailable: Command failed: systemctl --user is-enabled openclaw-gateway.service [16]. The poster reinstalled Ubuntu and wrote ~/.config/systemd/user/openclaw-gateway.service by hand. Before going that far, check lingering and run openclaw doctor. If systemctl --user commands fail right after su - openclaw, log out and connect over SSH directly as the openclaw user, then try again.

The quieter issue is shutdown. Ubuntu 24.04 ships a five-second stop limit for the user manager in /usr/lib/systemd/system/user@.service.d/timeout.conf, which can cut short the Gateway’s shutdown drain [1]. Doctor and Gateway status warn when the effective timeout is below 90 seconds. Inspect it:

systemctl show user@$(id -u).service -p TimeoutStopUSec

To fix it, create /etc/systemd/system/user@<uid>.service.d/zz-openclaw-stop-timeout.conf (with the openclaw user’s ID as <uid>) containing:

[Service]
TimeoutStopSec=90

Then run sudo systemctl daemon-reload.

How do you reach the dashboard safely?

Keep the Gateway on loopback and reach it through an SSH tunnel or Tailscale Serve. Never expose it publicly without authentication.

The Gateway binds to loopback on port 18789 by default. The network exposure docs call this the secure default: "keep the Gateway on loopback and access it via SSH tunnel or Tailscale Serve." [10][11]

The SSH tunnel is simplest. From your own machine, run this, then open http://localhost:18789 [6]:

ssh -L 18789:localhost:18789 root@YOUR_SERVER_IP

Tailscale Serve suits access from several devices. After these steps, open https://<magicdns>/ [6]:

curl -fsSL https://tailscale.com/install.sh | sudo sh
sudo tailscale up
openclaw config set gateway.tailscale.mode serve
openclaw gateway restart

Non-loopback startup requires configured auth and fails closed without it, logging "refusing to bind gateway … without auth" [11][12]. Prefer Tailscale Serve over LAN binds, firewall any LAN bind to a tight source-IP allowlist, and "never expose the Gateway unauthenticated on 0.0.0.0". The hardened baseline uses gateway.mode: "local", bind: "loopback" and auth: { mode: "token", token: "<long random token>" } [13].

The VPS guide says to "harden admin access first." With Tailscale, join the VPS to your tailnet, verify a second SSH session over the Tailscale IP, and only then restrict public SSH [10], so you never lock yourself out.

Which errors come up most on Ubuntu, and what fixes them?

Most errors come down to mode, ports, duplicate services, memory or PATH. Start with openclaw gateway status, openclaw status, openclaw logs --follow, openclaw doctor and openclaw gateway status --deep [12].

Message or symptom Cause Fix
"Gateway start blocked: set gateway.mode=local" Mode not set Set gateway.mode="local" or re-run openclaw onboard --mode local [12]
"another gateway instance is already listening" / EADDRINUSE Port conflict Find the process with lsof -i :18789 [12]
"Gateway service port does not match current gateway config" Service and config disagree openclaw doctor --fix or openclaw gateway install --force, then restart [12]
"System-level OpenClaw gateway service detected" System unit exists, user service missing Remove or disable the duplicate [12]
memory pressure: level=critical 1 GB is tight Check swap with free -h, use API-based models, or move to 2 GB [6]
openclaw: command not found npm’s global bin not on PATH Check npm prefix -g, add export PATH="$(npm prefix -g)/bin:$PATH" to ~/.bashrc [3]
EACCES on npm install -g No write access to global prefix mkdir -p "$HOME/.npm-global", npm config set prefix "$HOME/.npm-global", export PATH="$HOME/.npm-global/bin:$PATH" [3]

On memory, the docs are blunt: "local LLM inference does not fit in 1 GB" [6].

What do real Ubuntu installs look like?

Reddit reports suggest clean VPS installs go smoothly, while VMs and containers hit systemd trouble. Each is one person’s experience.

In February 2026, one user posted a full Hetzner walkthrough on a CPX22 with Ubuntu 24.04, at "~$7.60/month" by that poster’s count at the time, using Telegram to talk to OpenClaw [18].

In April 2026, one user described about ten failed attempts on Ubuntu and Debian VMs and LXC containers with versions 2026.4.22 to 2026.4.24. The "gateway service fails to launch during install," and the fix was a manual systemd definition plus solving port conflicts [17].

In February 2026, another user on an Ubuntu VM reported a skill that "cannot seem to see that gog is installed" [19]: a PATH problem inside the service environment. Together with the March "installation is hell" thread above, the pattern is clear: failures cluster around the user service, ports and PATH.

How do you keep a small Ubuntu server stable?

Keep swap in place, tune startup on small VMs, back up state regularly, and update through OpenClaw’s own commands.

For small VMs, the docs suggest appending these lines to ~/.bashrc [10]:

export NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache
mkdir -p /var/tmp/openclaw-compile-cache
export OPENCLAW_NO_RESPAWN=1

Optionally, set them for the service too with systemctl --user edit openclaw-gateway.service, adding Environment=OPENCLAW_NO_RESPAWN=1, Environment=NODE_COMPILE_CACHE=/var/tmp/openclaw-compile-cache and TimeoutStartSec=90 [10].

State lives in ~/.openclaw/ and ~/.openclaw/workspace/. Back up with openclaw backup create and restore with openclaw backup restore <archive.tar.gz> --target <fresh-directory> [6][10]. Do it on a schedule, since the VPS is your source of truth.

Update with openclaw update and check with openclaw update status [14]. To remove OpenClaw, run openclaw doctor --fix, then openclaw uninstall (it preselects only the Gateway service) or openclaw uninstall --all for complete removal [15]. If you are weighing a VPS against hardware at home, see this comparison of VPS and Mac mini alternatives for OpenClaw, or the short answer on whether you need a Mac mini for OpenClaw.

Bottom line

A clean Ubuntu 24.04 LTS server with 1 GB of RAM and swap runs the OpenClaw Gateway well when your models run through an API [6]. Use root only for bootstrap, install with --no-onboard, create the openclaw user, enable lingering, and onboard as that user. Keep the Gateway on loopback and reach it through an SSH tunnel or Tailscale Serve. When something breaks, run openclaw doctor first. On 24.04, raise the user-manager stop timeout to 90 seconds [1], and back up ~/.openclaw/ regularly.

Frequently asked questions

Can I install OpenClaw on Ubuntu Server 26.04 LTS?

The OpenClaw docs name Ubuntu 24.04 LTS and, on the pages read, do not state support for 26.04 LTS [6]. For the documented path, use 24.04 LTS, supported until May 2029 [7].

Do I need to run OpenClaw as root on Ubuntu Server?

No. Use root only for bootstrap and run OpenClaw as the non-root openclaw user, so state lives under /home/openclaw/.openclaw/ and the Gateway runs as that user’s systemd service [6].

How much RAM does OpenClaw need on an Ubuntu server?

The official guide uses 1 vCPU, 1 GB of RAM and 25 GB of SSD, with swap recommended [6]. Local LLM inference does not fit in 1 GB, so use API-based models or move to 2 GB.

Is it safe to open port 18789 on my Ubuntu server?

Not publicly. The secure default is loopback with access through an SSH tunnel or Tailscale Serve, and the docs say never to expose the Gateway unauthenticated on 0.0.0.0 [11]. If you must bind to LAN, firewall the port to a tight source-IP allowlist [11].

Why does the OpenClaw Gateway stop when I close SSH?

The Gateway is a systemd user service, so the user needs lingering, enabled with loginctl enable-linger openclaw [6][20]. If it still stops, run openclaw doctor and check for a duplicate system-level service [12].

Sources

All sources were read on November 24, 2026.

  1. [1] OpenClaw docs: platforms/linux
  2. [2] OpenClaw docs: install
  3. [3] OpenClaw docs: install/node
  4. [4] npm registry: openclaw (latest)
  5. [5] OpenClaw release v2026.11.8 on GitHub
  6. [6] OpenClaw docs: install/digitalocean
  7. [7] Ubuntu release cycle (Canonical)
  8. [10] OpenClaw docs: vps
  9. [11] OpenClaw docs: gateway/security/network-exposure
  10. [12] OpenClaw docs: gateway/troubleshooting/gateway-service-and-process
  11. [13] OpenClaw docs: gateway/security/hardened-baseline
  12. [14] OpenClaw docs: install/updating
  13. [15] OpenClaw docs: install/uninstall
  14. [16] Reddit r/openclaw: installation is hell
  15. [17] Reddit r/openclaw: looking for recipe to run openclaw on linux
  16. [18] Reddit r/openclaw: how i set up openclaw on a hetzner vps full guide
  17. [19] Reddit r/openclaw: ubuntu setup
  18. [20] OpenClaw docs: install/raspberry-pi