Tag: tutorial

  • How to Setup OpenClaw on a VPS

    How to Setup OpenClaw on a VPS

    ๐Ÿค– 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.

    Server rack representing a VPS environment
    A VPS provides a dedicated, isolated environment for running your WordPress + OpenClaw stack.

    ๐Ÿ“‹ 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:

    >
    ProviderRAMStoragePrice/moBest For
    DigitalOcean2 GB50 GB SSD~$12Beginners & Developers
    Linode (Akamai)2 GB50 GB SSD~$12Performance-focused
    Vultr2 GB55 GB SSD~$12Global edge locations
    Hetzner4 GB40 GB SSD~$6Budget-conscious users
    AWS Lightsail2 GB60 GB SSD~$10AWS ecosystem integration
    Popular VPS providers and their entry-level plans suitable for OpenClaw.

    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
    Terminal window showing server configuration commands
    Running setup commands via SSH terminal on your VPS.

    ๐Ÿฌ 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! \
      --admin_email=you@example.com \
      --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
    Code on a laptop screen showing plugin development
    OpenClaw bridges your WordPress site with AI agents via a REST API.

    ๐Ÿ” 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!

    SettingValueWhere to Set
    API Base URLhttps://yourdomain.com/wp-jsonOpenClaw config file
    Auth MethodApplication PasswordWordPress user profile
    Admin UsernameadminWordPress user
    REST Namespace/openclaw/v1/Auto-registered by plugin
    Abilities Endpoint/openclaw/v1/abilitiesAuto-registered by plugin
    Execute Endpoint/openclaw/v1/executeAuto-registered by plugin
    Key OpenClaw API configuration settings.

    ๐Ÿ”’ 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
    Computer circuit board representing technology infrastructure
    OpenClaw connects your WordPress site to powerful AI-driven automation pipelines.

    ๐Ÿ› ๏ธ Troubleshooting Common Issues

    If something doesn’t work as expected, consult the table below for common problems and solutions:

    IssueLikely CauseSolution
    401 Unauthorized on API callsWrong application passwordRegenerate the application password in WP Admin โ†’ Users โ†’ Profile
    404 on /wp-json/openclaw/v1/Plugin not active or permalinks not flushedActivate the plugin and go to Settings โ†’ Permalinks โ†’ Save
    500 Internal Server ErrorPHP memory limit too lowSet memory_limit = 256M in php.ini
    SSL certificate errorsCertbot not configured properlyRe-run certbot --apache and check Apache vhost
    WP-CLI database errorMySQL not running or wrong credentialsCheck wp-config.php credentials and MySQL service status
    Plugin install failsFile permission issuesRun chown -R www-data:www-data /var/www/html
    Common OpenClaw VPS setup issues and their fixes.

    ๐Ÿš€ 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!