Install New WordPress site from SSH

The Terminal-Only Deployment

This guide outlines the streamlined workflow for deploying a standalone WordPress installation onto a custom subdomain utilizing SSH, cPanel UAPI, and WP-CLI, bypassing the graphical cPanel interface entirely.

1. Connect & Navigate to the Subdomain Directory

Open PowerShell or your preferred terminal client, connect to your server, and navigate directly to your target subdomain folder (which is typically created as a sibling directory to public_html).

PowerShell

# Connect to your server via SSH
ssh username@your-server-ip -p port_number

# Navigate into your subdomain directory
cd ~/yoursubdomain.yourdomain.com

# Verify you are in the correct directory
pwd && ls -la

2. Download WordPress Core

Use WP-CLI to pull down a fresh, clean copy of the latest WordPress core files directly into your active directory.

Bash

wp core download

3. Generate wp-config.php (Pre-Provisioning Step)

Generate your local configuration file first. Invent a unique name for your database, a unique name for your database user, and a strong password. Use the --skip-check flag so WP-CLI writes the file without trying to connect to MySQL yet.

⚠️ Important: On cPanel environments, your database and user names must be prefixed with your cPanel username (e.g., cpaneluser_dbname).

Bash

wp config create --dbname="cpaneluser_databasename" --dbuser="cpaneluser_databaseuser" --dbpass="YourUniqueDatabasePassword123!" --skip-check

4. Provision and Map the Database via cPanel UAPI

Because standard terminal users do not have root or passwordless access to raw MySQL binaries on shared/reseller environments, use cPanel’s native Command Line API (uapi). This utilizes your active SSH session token to securely provision the database infrastructure without demanding a master password.

Run the following three commands in sequence:

Bash

# A. Create the database container
uapi Mysql create_database name=cpaneluser_databasename

# B. Create the isolated database user and assign their password
uapi Mysql create_user name=cpaneluser_databaseuser password="YourUniqueDatabasePassword123!"

# C. Grant the user full privileges over the database
uapi Mysql set_privileges_on_database user=cpaneluser_databaseuser database=cpaneluser_databasename privileges=ALL

5. Execute the WordPress Installation

Now that the database infrastructure is live and perfectly matches the parameters inside your wp-config.php file, execute the final core installer to build the database tables and create your primary WordPress administrator account.

Bash

wp core install --url="https://yoursubdomain.yourdomain.com" --title="Your Site Title" --admin_user="your_wp_admin_username" --admin_password="YourStrongAdminPassword" --admin_email="you@example.com"

💡 Note on Server Warnings: You may see a couple of lines stating sendmail: Not running with correct effective GID. These are routine server permissions warnings regarding local automated notification mailers. They do not affect the site; as long as the terminal outputs Success: WordPress installed successfully., your installation is complete and ready for browser access.

© 2026 All Rights Reserved.