Deploy OpenClaw on DigitalOcean
Run the self-hosted OpenClaw AI agent on a DigitalOcean Droplet. This guide walks you through creating an Ubuntu Droplet, adding your SSH key, installing Node.js 22+ and OpenClaw via the one-line installer, and running it as a systemd service. DigitalOcean’s simple dashboard and predictable pricing ($6/month basic, $12/month production-ready) make it a popular choice for 24/7 OpenClaw hosting.
1. Overview
DigitalOcean Droplets are Linux virtual machines with straightforward pricing and a simple control panel. OpenClaw runs on any Droplet that supports Node.js 22+; we recommend Ubuntu 22.04 LTS. This guide covers:
- Creating a Droplet (Ubuntu 22.04, Basic plan: $6/mo or $12/mo)
- Adding your SSH key and choosing a datacenter region
- Firewall: SSH only; do not expose the OpenClaw gateway port (1618) to the internet
- Connecting via SSH and installing Node.js 22+ and OpenClaw
- Running OpenClaw as a systemd service for 24/7 operation
- Optional: add swap on the $6 plan to reduce OOM risk
- Common issues and links to troubleshooting and security best practices
2. Prerequisites
- DigitalOcean account - Sign up at digitalocean.com. New users often get trial credits.
- SSH key - Generate or use an existing SSH key pair. Add the public key in DigitalOcean under Settings → Security → SSH Keys (or during Droplet creation). You need the private key on your local machine to connect.
- LLM API key - At least one: Anthropic Claude, OpenAI, DeepSeek, or Ollama (local).
- Optional: A messaging app account for your first channel - e.g. Telegram, Discord, WhatsApp.
3. Create a Droplet
3.1 Choose image and plan
- In the DigitalOcean Control Panel, go to Droplets → Create Droplet.
- Image: Choose Ubuntu 22.04 (LTS) x64. Avoid older Ubuntu or non-LTS if possible.
- Droplet type: Basic (Regular or CPU-Optimized; Regular is enough for OpenClaw).
- Plan size:
- $6/month (Basic, 1 GB RAM / 1 vCPU): Adequate for a single user or light automation. Consider adding swap (see below) to avoid out-of-memory issues.
- $12/month (Basic, 2 GB RAM / 1 vCPU): Recommended for production or multiple channels and skills. More headroom for Node.js and the gateway.
- Larger plans ($18–24/mo) are optional for heavy multi-channel or resource-intensive skills.
- Datacenter region: Pick a region close to you or your users for lower latency. All regions support Ubuntu.
- Authentication: Select your SSH key (or add a new one). Optionally enable Password + SSH for recovery; prefer SSH-only for security.
- Hostname: e.g.
openclaw.
3.2 Firewall (critical for security)
Do not open the OpenClaw gateway port (1618) to the internet. The gateway should bind to 127.0.0.1 on the Droplet; you access the dashboard or CLI via SSH port forwarding, Tailscale, or another VPN.
- DigitalOcean Cloud Firewall (optional but recommended): Create a firewall under Networking → Firewalls. Allow SSH (22) from your IP only (or a narrow range). Do not add a rule for port 1618. Attach the firewall to your Droplet.
- On-droplet UFW: After first login you can run
sudo ufw allow 22,sudo ufw enable. Neverufw allow 1618for the public interface. See Security Best Practices and Network Isolation.
Click Create Droplet. Wait for the Droplet to boot and note its public IP address.
4. Connect via SSH
From your local machine (replace with your key path and Droplet IP):
ssh root@YOUR_DROPLET_IP
If you created the Droplet with a non-root user (e.g. after adding an SSH key that has a username), use that user:
ssh -i ~/.ssh/your_private_key your_user@YOUR_DROPLET_IP
DigitalOcean’s default Ubuntu image uses root for password/SSH login unless you disabled root or created a sudo user.
5. Install Node.js 22+ and OpenClaw
On the Droplet (Ubuntu 22.04), install Node.js 22+ if not present, then run the official one-line installer:
# Optional: install Node.js 22 via NodeSource (Ubuntu/Debian)
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
# Install OpenClaw (installs Node 22 if needed and runs onboarding)
curl -fsSL https://openclaw.ai/install.sh | bash
The script will create ~/.openclaw and may start the onboarding wizard. If not, run:
openclaw setup
Complete the wizard: choose an LLM provider, add your API key, and optionally add your first channel (e.g. Telegram). See the Quick Start Guide and Post-installation setup for details.
6. (Optional) Add swap on $6/month Droplet
Droplets with 1 GB RAM can occasionally hit out-of-memory under load. Adding a 1 GB swap file helps:
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
Verify with free -h. For 2 GB or larger Droplets, swap is optional.
7. Run OpenClaw as a systemd service
To keep OpenClaw running after you disconnect and to start it on reboot:
# Install the systemd unit (run as the user that runs OpenClaw)
sudo openclaw service install --systemd
# Enable and start the service
sudo systemctl enable openclaw
sudo systemctl start openclaw
# Check status
sudo systemctl status openclaw
openclaw status
View logs: journalctl -u openclaw -f or openclaw logs. Ensure the gateway is bound to 127.0.0.1 only; see Security Best Practices.
8. Cost and Droplet sizing
- $6/month (Basic, 1 GB RAM): Good for trying OpenClaw or light personal use. Add swap (see above) to reduce OOM risk.
- $12/month (Basic, 2 GB RAM): Recommended for production, multiple channels, or several ClawHub skills. More stable under load.
- DigitalOcean pricing is monthly and predictable; no per-hour billing. See Droplet pricing.
- For a cost comparison across providers, see our VPS comparison and cost calculator.
9. Common issues
| Issue | Solution |
|---|---|
openclaw command not found |
Ensure the install script added the binary to your PATH (e.g. ~/.local/bin or ~/.openclaw/bin). Add to ~/.bashrc and run source ~/.bashrc or re-connect via SSH. See Installation Errors. |
| Node.js version too old | OpenClaw requires Node.js 22+. Run node -v. Install Node 22+ via NodeSource (see above) or nodejs.org, then re-run the installer. |
| Cannot connect via SSH | Check that your Droplet is running and that your firewall or Cloud Firewall allows SSH (port 22) from your IP. Verify your SSH key is added to the Droplet and key permissions chmod 400 your_key. Use the IP from the DigitalOcean control panel. |
| Gateway won't start | Ensure port 1618 is free and gateway binds to 127.0.0.1. Run openclaw doctor and see Gateway Issues. |
| Out of memory (OOM) | On 1 GB Droplets, add swap (see section 6) or upgrade to the $12 2 GB plan. Reduce concurrent usage or number of skills if needed. |
For more fixes, see the full Troubleshooting Guide.
10. Best practices
- Security: Follow our Security Best Practices. Never expose the OpenClaw gateway port (1618) to the internet; use SSH tunneling, Tailscale, or a VPN for remote access.
- Updates: Regularly update OpenClaw. After upgrading, restart:
sudo systemctl restart openclaw. - Backups: Back up
~/.openclaw(config and credentials). DigitalOcean offers Droplet backups (paid) or use your own backup script; do not commit credentials to version control. - Post-install: Run through the Security Checklist after setup.
11. Next steps
- Installation hub - macOS, Windows (WSL2), Linux, Docker, VPS, Raspberry Pi
- Post-installation setup - onboarding, first channel, security
- Connect a channel - Telegram, Discord, WhatsApp, Slack
- ClawHub skills - extend your agent
- Use cases - automation ideas
- Community - Discord, GitHub
Related resources
- Official Documentation
- Video Tutorials
- Configuration Templates
- Configuration file guide
- VPS provider comparison - DigitalOcean, Linode, Hetzner, AWS