Self-Host OpenClaw on DigitalOcean
DigitalOcean Droplets provide a simple, predictable platform for running OpenClaw Gateway. This guide covers provisioning a Droplet, installing OpenClaw via the official installer script, setting up systemd for process management, and configuring secure remote access.
Quick path
Condensed steps for experienced users:
- Create an Ubuntu 24.04 LTS Droplet (1 vCPU / 1 GB minimum, 2 GB recommended)
- SSH in, add 2 GB swap if on the 1 GB plan
- Install Node.js 24:
curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && apt install -y nodejs - Run the OpenClaw installer:
curl -fsSL https://openclaw.ai/install.sh | bash - Complete the onboarding wizard
- Enable the systemd service:
systemctl enable --now openclaw-gateway - Access via SSH tunnel:
ssh -N -L 18789:127.0.0.1:18789 root@DROPLET_IP - Open
http://127.0.0.1:18789/
Prerequisites
- A DigitalOcean account
- An SSH key added to your DigitalOcean account
- A terminal with SSH access on your local machine
Step 1 — Create a Droplet
In the DigitalOcean control panel, click Create > Droplets and configure:
- Region: Choose the datacenter closest to you
- Image: Ubuntu 24.04 (LTS)
- Droplet Type: Basic (shared CPU)
- Size: 1 vCPU / 1 GB RAM / 25 GB SSD ($6/mo) or 1 vCPU / 2 GB RAM / 50 GB SSD ($12/mo)
- Authentication: SSH Key (select your key)
- Hostname:
openclaw-gateway
Click Create Droplet and wait for provisioning to complete.
Alternatively, using the doctl CLI:
Step 2 — Initial Server Setup
SSH into the Droplet:
Update system packages:
Add swap space (required for 1 GB Droplets)
If your Droplet has only 1 GB of RAM, swap is essential to prevent out-of-memory kills:
Tune swappiness for a server workload:
Verify with free -h.
Step 3 — Install Node.js 24
OpenClaw requires Node.js 24 or later. Install it from the NodeSource repository:
Verify the installation:
Step 4 — Install OpenClaw
Run the official installer script:
The installer downloads the OpenClaw Gateway binary, places it in your PATH, and creates the default configuration directory at ~/.openclaw.
After installation, verify:
The doctor command checks your environment for common issues — Node.js version, available memory, disk space, and network connectivity.
Step 5 — Complete the Onboarding Wizard
Run the onboarding wizard to configure your gateway:
The wizard walks you through:
- Gateway token — A secret token for authenticating to the gateway. The wizard can generate one for you, or you can provide your own.
- Bind address — Select
lanto bind to all local interfaces, orloopbackfor127.0.0.1only. - Port — Default is
18789. - Workspace directory — Where OpenClaw reads and writes project files. Default is
~/.openclaw/workspace.
The configuration is written to ~/.openclaw/config.toml:
Step 6 — Set Up the Systemd Service
Create a systemd unit file so OpenClaw starts on boot and restarts on failure:
Enable and start the service:
Check the status:
Step 7 — Secure Remote Access
You have three options for accessing OpenClaw from your local machine. All three keep the gateway off the public internet.
Option A: SSH Tunnel
The simplest approach. On your local machine:
Then open http://127.0.0.1:18789/ in your browser. The tunnel must remain open while you work.
For persistence, add to your ~/.ssh/config:
Then simply run ssh -N openclaw.
Option B: Tailscale Serve
Install Tailscale on both your local machine and the Droplet:
Then use Tailscale Serve to expose the gateway within your tailnet:
Access the gateway at https://YOUR_DROPLET_TAILSCALE_NAME:443/ from any device on your tailnet. No SSH tunnel needed.
Option C: Tailnet Bind
Alternatively, configure OpenClaw to bind directly to the Tailscale interface. Edit ~/.openclaw/config.toml:
Restart the service:
OpenClaw will listen only on the Tailscale interface, making it accessible to devices on your tailnet at http://YOUR_DROPLET_TAILSCALE_IP:18789/.
Security Best Practices
Firewall configuration
DigitalOcean Cloud Firewalls are free and applied at the network level. Create one that allows only SSH:
- Inbound: TCP port 22 from your IP (or
0.0.0.0/0if your IP is dynamic) - Outbound: All traffic
As a secondary layer, configure ufw on the Droplet:
Non-root user (optional)
For better isolation, run OpenClaw under a dedicated user:
Update the systemd unit's User= and WorkingDirectory= directives accordingly.
Enable automatic security updates
Troubleshooting
Out of memory (OOM) kills
Symptoms: the gateway process dies unexpectedly, dmesg | grep -i oom shows kill entries.
Solutions:
- Add or increase swap (see Step 2)
- Upgrade to a larger Droplet —
doctl compute droplet-action resize YOUR_DROPLET_ID --size s-1vcpu-2gb --wait - Reduce concurrent workload
Port already in use
If you see EADDRINUSE in the logs:
Service fails to start
Common causes:
- Node.js not in PATH for the systemd service — use the full path in
ExecStart - Missing config file — run
openclaw setupagain - Permission denied — check file ownership matches the
User=in the unit file
Cannot reach gateway via SSH tunnel
- Verify the service is running:
systemctl is-active openclaw-gateway - Verify the port is listening:
ss -tln | grep 18789 - Verify the tunnel is active:
ssh -N -L 18789:127.0.0.1:18789 root@DROPLET_IP -v(verbose mode shows tunnel setup)
Updating OpenClaw
Re-run the installer to update to the latest version:
Check the new version:
Next Steps
- Enable DigitalOcean Droplet backups ($1.20/mo) or use snapshots for point-in-time recovery
- Set up monitoring with DigitalOcean's built-in metrics or install a lightweight agent like Netdata
- Explore running multiple OpenClaw workspaces for different projects using separate configuration directories