Install WordPress with WP-CLI (with Interactive Prompts)

Install WordPress from the command line using WP-CLI: download core, generate wp-config.php, and run the install in minutes. Then eliminate flag-fatigue with WP-CLI’s interactive --prompt mode and a simple wp-cli.yml so repeat installs feel like a guided wizard.

Table of Contents

The classic WordPress “5‑minute install” works, but it’s repetitive: upload files, create a config, click through the web installer, then repeat the same post‑install steps (permalinks, a theme, plugins…). WP‑CLI collapses that workflow into a handful of commands—fast, consistent, and easy to automate.

Even better: WP‑CLI can prompt you interactively so you don’t have to remember (or mistype) every flag.


What you’ll need

  • A Linux server with PHP and typical WordPress extensions installed
  • MySQL/MariaDB
  • A domain mapped to your server with a working web root (docroot)
  • SSH access

Tip: For best security and fewer permission headaches, run WP‑CLI as the same user that owns the site files (often a per‑site user, or www-data).


Step 1: Install WP‑CLI

Download the WP‑CLI Phar, verify it runs, and place it on your PATH:


Step 2: Go to your site directory

Move into your site’s docroot (examples):

  • /var/www/example.com/public_html
  • /var/www/example.com/html

If your web files are owned by www-data, you can run:


Step 3: Create a database and DB user

Create a dedicated database + user for this WordPress site.

Then in the MySQL prompt:


Step 4: Download WordPress core


Step 5: Create wp-config.php

Generate your config with WP‑CLI:


Step 6: Run the WordPress install

This creates the tables and the initial admin user:


Step 7: Set pretty permalinks (common post‑install step)


Make it painless: use interactive prompts

The annoying part of WP‑CLI isn’t the commands—it’s remembering and typing the flags precisely.

WP‑CLI has a built‑in fix: --prompt.

Prompt for anything you didn’t specify

Prompt only for sensitive values (like passwords)

This keeps secrets out of shell history and reduces copy/paste mistakes:


Bonus: stop retyping flags with wp-cli.yml

If you’re always passing things like --path=/var/www/..., set defaults once with a local config file.

Create a wp-cli.yml in your site directory:

Now you can run WP‑CLI from anywhere without repeatedly specifying --path.


Troubleshooting quick hits

  • “This does not seem to be a WordPress installation” → you’re in the wrong directory; cd into the docroot where you ran wp core download.
  • Permission errors → run WP‑CLI as the site owner user, and ensure ownership/permissions are correct.
  • Missing PHP extensions → install the required modules and restart PHP‑FPM/Apache.

Wrap‑up

With WP‑CLI you can install WordPress in minutes—and with --prompt and wp-cli.yml, you can make it feel like a repeatable, low‑friction “installer wizard” you can use again and again.

Have a project or a problem?

Talk with a senior engineer for practical recommendations—no obligation.

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.