Install WordPress Using WP-CLI

Install WordPress Using WP-CLI Hero Image

WP-CLI, WordPress Command Line Interface, is a powerful set of tools, available with WordPress Hosting at InMotion. WP-CLI commands allow you to perform common WordPress management tasks via the command line. One great example is the ability to completely install WordPress from the command line, which saves time compared to the manual option. In this guide, you will learn how to use WP-CLI to setup a new WordPress website from the command line.

Install WordPress

  1. SSH into your server as the cPanel user that owns the website you are installing WordPress on.

  2. Use the cd command to switch to the document root directory of your website.

    Example: cd public_html/my_website

    NOTE: Be sure to replace public_html/my_website with the actual path to the document root directory of your website.

  3. Run the following command to download WordPress (into the document root directory you are in):

    wp core download

  4. Run the following command to configure WordPress:

    wp core config –prompt

    Refer to the table below for a description of the values you will enter when prompted.

    PromptDescriptionValue
    1/11 dbname: *Enter the name of the MySQL database createdexampl3_wp
    2/11 dbuser: *Enter the name of the MySQL database user createdexampl3_wp
    3/11 dbpass: *Enter the password created for the database userDBp@s$w0rd123!
    4/11 dbhost:Enter the hostname of the MySQL database server 
    5/11 dbprefix:Enter the prefix to use in the MySQL database structure 
    6/11 dbcharset:Enter the database character set 
    7/11 dbcollate:Enter the database collation 
    8/11 locale:Enter the WPLANG constant 
    9/11 extra-php (Y/n): *Enter Y to add any PHP code from STDIN or n to skipn
    10/11 skip-salts (Y/n): *Enter Y to generate or n to skip generating keys and saltsn
    11/11 skip-check (Y/n): *Enter Y test or n to skip testing the database connectionn

    Simply type in your custom value and then press the Enter key to proceed through each prompt.

  5. Run the following command to install WordPress:

    wp core install –prompt

    Refer to the table below for a description of the values you will enter when prompted.

    PromptDescriptionValue
    1/6 url:Enter the URL for your websiteexample.com
    2/6 title:Enter the site title for your websiteWPCLI Example Site
    3/6 admin_user:Enter the administrator usernameexampl3_wpadmin
    4/6 admin_password:Enter the administrator password@DM|Np@s$w0rd123!
    5/6 admin_email:Enter the email address for the administrator[email protected]
    6/6 skip-email (Y/n):Enter Y to email or n to skip emailing the admin detailsY

    Simply type in your chosen value and then press the Enter key to proceed through each prompt.

Congratulations! You now know how to install WordPress from the command line, using WP-CLI. 

Learn more about WP-CLI, the command-line interface for WordPress, and how to streamline your WordPress maintenance workflows!

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!