๐Ÿš€Setup & Installation

How to Deploy OpenClaw on DigitalOcean

Intermediate1-2 hoursUpdated 2025-01-12

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

Step 1

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 creation
Create your DigitalOcean account
Step 2

Connect via SSH and update the system

SSH into your droplet and update packages.

ssh root@your_droplet_ip
apt update && apt upgrade -y
Step 3

Install 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+
Step 4

Create a non-root user for OpenClaw

Run OpenClaw as a dedicated user for security.

adduser openclaw
usermod -aG sudo openclaw
su - openclaw

Warning: Never run OpenClaw as root. Always use a dedicated non-root user to minimize security risks.

Step 5

Clone and install OpenClaw

Clone the repository and install dependencies.

cd ~
git clone https://github.com/openclaw/openclaw.git
cd openclaw
npm install
Step 6

Configure 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 origins
Step 7

Create 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 openclaw
Step 8

Configure 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 status

Skip 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 โ†’

Frequently Asked Questions