How to Deploy OpenClaw on DigitalOcean
Deploying OpenClaw on DigitalOcean gives you a reliable, cloud-hosted AI agent accessible from anywhere. This guide covers creating a droplet, securing SSH access, installing Node.js, configuring a systemd service for automatic restarts, and setting up UFW firewall rules. You'll have a production-ready OpenClaw instance running in the cloud in under 2 hours.
Why This Is Hard to Do Yourself
These are the common pitfalls that trip people up.
Droplet sizing confusion
Choosing the right CPU/RAM tier for your workload
SSH key management
Setting up secure SSH access and disabling password authentication
Firewall configuration
UFW rules blocking necessary ports or leaving vulnerabilities open
Process management
Keeping OpenClaw running after crashes and server reboots
Step-by-Step Guide
Create a DigitalOcean Droplet
Choose Ubuntu 22.04 LTS, at least 2GB RAM.
# Recommended: Basic plan, 2 vCPUs, 2GB RAM ($18/mo)
# Choose a datacenter region closest to your users
# Add your SSH key during creationConnect via SSH and update the system
SSH into your droplet and update packages.
ssh root@your_droplet_ip
apt update && apt upgrade -yInstall Node.js 20+
Install Node.js from NodeSource repository.
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs
node --version # Should be 20.x+Create a non-root user for OpenClaw
Run OpenClaw as a dedicated user for security.
adduser openclaw
usermod -aG sudo openclaw
su - openclawWarning: Never run OpenClaw as root. Always use a dedicated non-root user to minimize security risks.
Clone and install OpenClaw
Clone the repository and install dependencies.
cd ~
git clone https://github.com/openclaw/openclaw.git
cd openclaw
npm installConfigure environment variables
Set up API keys and gateway configuration.
cp .env.example .env
nano .env # Add ANTHROPIC_API_KEY, etc.
cp gateway.example.yaml gateway.yaml
nano gateway.yaml # Set gateway port and allowed originsCreate a systemd service
Configure OpenClaw to auto-start on boot.
sudo nano /etc/systemd/system/openclaw.service
# Add:
# [Unit]
# Description=OpenClaw AI Agent
# After=network.target
#
# [Service]
# Type=simple
# User=openclaw
# WorkingDirectory=/home/openclaw/openclaw
# ExecStart=/usr/bin/npm start
# Restart=on-failure
#
# [Install]
# WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
sudo systemctl status openclawConfigure UFW firewall
Allow SSH and OpenClaw gateway port.
sudo ufw allow OpenSSH
sudo ufw allow 3000/tcp # Or your gateway port
sudo ufw enable
sudo ufw statusSkip the Cloud Setup Headache
Our DigitalOcean specialists handle droplet provisioning, security hardening, systemd configuration, and monitoring. Get a production-ready cloud deployment with automated backups and SSL in hours, not days.
Get matched with a specialist who can help.
Sign Up for Expert Help โ