Want to run your own AI agent 24/7 without relying on cloud services? OpenClaw is an open-source AI agent platform you can self-host on a VPS. In this guide, we’ll walk through installing OpenClaw on Ubuntu, configuring it for production, and keeping it running reliably.

Recommended VPS Specifications

  • CPU: 2 vCPU minimum (4 vCPU recommended)
  • RAM: 4GB minimum (8GB recommended)
  • Storage: 60GB+ NVMe SSD
  • OS: Ubuntu 22.04 LTS or 24.04 LTS
  • Network: Public IPv4 and SSH access

What is OpenClaw?

OpenClaw is a self-hosted AI agent platform that lets you run AI assistants on your own infrastructure. Unlike cloud-based AI services, OpenClaw gives you:

  • Full data privacy — your conversations stay on your server
  • No usage limits — run as many agents as you need
  • 24/7 availability — your agents work around the clock
  • Custom integrations — connect to your internal tools and APIs
  • Model flexibility — use OpenAI, Anthropic, local models, or any LLM provider

What You’ll Need

For this guide, we recommend a Cloud VPS with at least 4GB RAM and 2 vCPUs. OpenClaw is lightweight, but AI workloads benefit from having headroom.

Canadian Web Hosting’s Cloud VPS plans start at affordable monthly rates with full root access, Canadian data centres in Vancouver and Toronto, and 24/7 expert support. Plus, you get data sovereignty — your AI conversations stay in Canada.

Step 1: Prepare Your Server

Start with a fresh Ubuntu 22.04 or 24.04 server. SSH in and update everything:

sudo apt update && sudo apt upgrade -y sudo apt install -y curl git build-essential

Install Node.js 22 (OpenClaw requires Node 20+):

curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
node --version  # Should show v22.x

Step 2: Install OpenClaw

Clone the OpenClaw repository and install dependencies:

git clone https://github.com/openclaw/openclaw.git cd openclaw npm install npm run build

The build takes a few minutes. Grab a coffee.

Step 3: Configure OpenClaw

Create a configuration file with your AI model credentials. OpenClaw supports multiple providers:

cp .env.example .env nano .env

At minimum, add your AI provider API key:

# For OpenAI (most common)
OPENAI_API_KEY=sk-your-key-here

# Or for Anthropic Claude
ANTHROPIC_API_KEY=sk-ant-your-key-here

# Or use a local model via Ollama
OLLAMA_BASE_URL=http://localhost:11434

Gotcha: Never commit your .env file to git. Add it to .gitignore if it isn’t already.

Step 4: Set Up the Gateway Service

OpenClaw uses a Gateway service for WebSocket communication. Set it up as a systemd service so it runs automatically:

sudo nano /etc/systemd/system/openclaw-gateway.service

Paste this configuration (adjust paths to match your installation):

[Unit]
Description=OpenClaw Gateway
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/openclaw
ExecStart=/usr/bin/node gateway/start.js
Restart=on-failure
RestartSec=10
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target

Enable and start the service:

sudo systemctl daemon-reload sudo systemctl enable openclaw-gateway sudo systemctl start openclaw-gateway sudo systemctl status openclaw-gateway

Step 5: Add a Reverse Proxy with Nginx

For production use, put Nginx in front of OpenClaw with SSL:

sudo apt install -y nginx certbot python3-certbot-nginx

Create an Nginx configuration:

sudo nano /etc/nginx/sites-available/openclaw
server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

    # WebSocket endpoint
    location /ws {
        proxy_pass http://127.0.0.1:18789;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 86400;
    }
}

Enable the site and get an SSL certificate:

sudo ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
sudo certbot --nginx -d your-domain.com

Step 6: Test Your Installation

Visit your domain in a browser. You should see the OpenClaw interface. Try sending a message to verify everything works.

Check the logs if something isn’t working:

sudo journalctl -u openclaw-gateway -f

Troubleshooting Common Issues

WebSocket Connection Failed

Make sure your Nginx config has the upgrade headers for WebSocket connections. Check that port 18789 (or your configured port) is accessible locally.

AI Responses Not Working

Verify your API key is correct in the .env file. Test it independently with a curl request to the provider’s API.

Service Crashes on Startup

Check that Node.js version is 20 or higher. Run npm install again to ensure all dependencies are installed.

Keeping OpenClaw Updated

OpenClaw is actively developed. Update regularly:

cd /home/ubuntu/openclaw git pull origin main npm install npm run build sudo systemctl restart openclaw-gateway

Next Steps

Now that OpenClaw is running, you can:

  • Create custom skills for your workflows
  • Connect external tools via the API
  • Set up multiple agents for different tasks
  • Integrate with your CI/CD pipeline

Why Self-Host OpenClaw?

Self-hosting gives you control. No rate limits, no data leaving your infrastructure, no surprise pricing changes. For Canadian businesses, keeping data within national borders matters for compliance.

With a Cloud VPS from Canadian Web Hosting, you get the infrastructure plus expert support when you need it. Full root access means you can customize everything, and our 24/7 team is here if you run into issues.

Resources

Security lockdown (important)

Do not expose OpenClaw wide open on the public internet. Use a reverse proxy, TLS, and firewall restrictions. Follow our hardening guide: OpenClaw Security Lockdown: Safe Internet Exposure Guide.