๐ค How to Setup OpenClaw on a VPS
A complete step-by-step guide to deploying WordPress + OpenClaw on your own server
โ Ubuntu 22.04 LTS
โ WordPress 6.x
โ PHP 8.1+
โ MySQL 8.0+
OpenClaw is a powerful WordPress plugin that turns your site into an AI-powered management agent. In this guide, you’ll learn how to set up OpenClaw on a VPS (Virtual Private Server) from scratch โ covering server requirements, installation, and configuration.
๐ Prerequisites
Before you begin, make sure you have the following ready:
- A VPS running Ubuntu 22.04 LTS (or Debian 11+)
- At least 2 GB RAM and 20 GB disk space
- Root or sudo SSH access to the server
- A domain name pointed to your VPS IP
- A working WordPress installation
- PHP 8.0+ and MySQL 8.0+ installed
๐ฅ๏ธ Step 1 โ Provision Your VPS
Choose a VPS provider and spin up a new server. Below is a comparison of popular VPS providers suitable for running OpenClaw:
| Provider | RAM | Storage | >Price/mo | Best For |
|---|---|---|---|---|
| DigitalOcean | 2 GB | 50 GB SSD | ~$12 | Beginners & Developers |
| Linode (Akamai) | 2 GB | 50 GB SSD | ~$12 | Performance-focused |
| Vultr | 2 GB | 55 GB SSD | ~$12 | Global edge locations |
| Hetzner | 4 GB | 40 GB SSD | ~$6 | Budget-conscious users |
| AWS Lightsail | 2 GB | 60 GB SSD | ~$10 | AWS ecosystem integration |
Once your server is provisioned, SSH into it:
ssh root@your-server-ip
โ๏ธ Step 2 โ Install the LAMP Stack
OpenClaw runs on top of WordPress, so you need a full LAMP (Linux, Apache, MySQL, PHP) stack. Run the following commands:
# Update packages
sudo apt update && sudo apt upgrade -y
# Install Apache, MySQL, PHP
sudo apt install -y apache2 mysql-server php8.1 php8.1-cli php8.1-mysql \
php8.1-curl php8.1-xml php8.1-mbstring php8.1-zip php8.1-gd unzip wget
# Enable Apache modules
sudo a2enmod rewrite ssl
sudo systemctl restart apache2
๐ฌ Step 3 โ Configure MySQL
Secure your MySQL installation and create a database for WordPress:
# Secure MySQL
sudo mysql_secure_installation
# Log in to MySQL
sudo mysql -u root -p
# Create the WordPress database and user
CREATE DATABASE wordpress_db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
๐ Step 4 โ Install WordPress
Download and configure WordPress using WP-CLI for a streamlined setup:
# Install WP-CLI
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
# Download WordPress
cd /var/www/html
sudo wp core download --allow-root
# Create wp-config.php
sudo wp config create \
--dbname=wordpress_db \
--dbuser=wp_user \
--dbpass=StrongPassword123! \
--allow-root
# Install WordPress
sudo wp core install \
--url=https://yourdomain.com \
--title="My OpenClaw Site" \
--admin_user=admin \
--admin_password=SecureAdminPass! \
[email protected] \
--allow-root
๐ Step 5 โ Install the OpenClaw Plugin
With WordPress running, install the OpenClaw plugin. OpenClaw is available as a WordPress plugin that exposes a REST API and CLI bridge for AI-powered management:
# Install and activate OpenClaw
wp plugin install openclaw --activate --allow-root
# Verify it's active
wp plugin list --status=active --allow-root
๐ Step 6 โ Configure Application Passwords
OpenClaw uses WordPress Application Passwords for secure API authentication. Generate one for your admin user:
# Generate an application password for the admin user
wp user application-password create 1 "OpenClaw Agent" --allow-root
Copy the generated password โ you’ll need it to authenticate API requests. Store it securely!
| Setting | Value | Where to Set |
|---|---|---|
| API Base URL | https://yourdomain.com/wp-json | OpenClaw config file |
| Auth Method | Application Password | WordPress user profile |
| Admin Username | admin | WordPress user |
| REST Namespace | /openclaw/v1/ | Auto-registered by plugin |
| Abilities Endpoint | /openclaw/v1/abilities | Auto-registered by plugin |
| Execute Endpoint | /openclaw/v1/execute | Auto-registered by plugin |
๐ Step 7 โ Enable SSL with Let’s Encrypt
Secure your site with a free SSL certificate using Certbot:
# Install Certbot
sudo apt install -y certbot python3-certbot-apache
# Issue SSL certificate
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
# Test auto-renewal
sudo certbot renew --dry-run
โ Step 8 โ Verify Your OpenClaw Installation
Test your OpenClaw setup by querying the abilities endpoint:
# List all available OpenClaw abilities
curl -u admin:YOUR_APP_PASSWORD \
https://yourdomain.com/wp-json/openclaw/v1/abilities
# Execute a test ability
curl -X POST \
-u admin:YOUR_APP_PASSWORD \
-H "Content-Type: application/json" \
-d '{"ability": "openclaw/create-post", "input": {"title": "Test", "content": "Hello from OpenClaw!"}}' \
https://yourdomain.com/wp-json/openclaw/v1/execute
๐ ๏ธ Troubleshooting Common Issues
If something doesn’t work as expected, consult the table below for common problems and solutions:
| Issue | Likely Cause | Solution |
|---|---|---|
| 401 Unauthorized on API calls | Wrong application password | Regenerate the application password in WP Admin โ Users โ Profile |
| 404 on /wp-json/openclaw/v1/ | Plugin not active or permalinks not flushed | Activate the plugin and go to Settings โ Permalinks โ Save |
| 500 Internal Server Error | PHP memory limit too low | Set memory_limit = 256M in php.ini |
| SSL certificate errors | Certbot not configured properly | Re-run certbot --apache and check Apache vhost |
| WP-CLI database error | MySQL not running or wrong credentials | Check wp-config.php credentials and MySQL service status |
| Plugin install fails | File permission issues | Run chown -R www-data:www-data /var/www/html |
๐ Next Steps
Congratulations! Your OpenClaw instance is now live on your VPS. Here’s what you can do next:
- ๐ค Connect an AI agent (Claude, GPT-4, Gemini) to your OpenClaw REST API
- ๐ฆ Register custom Abilities to extend OpenClaw’s capabilities
- ๐ Set up automated backups using WP-CLI + cron jobs
- ๐ Install monitoring tools like UptimeRobot or Netdata
- ๐ Harden your VPS with UFW firewall rules and Fail2ban
Have questions or ran into an issue? Drop a comment below โ we’re happy to help you get OpenClaw running smoothly on your VPS!
