Install WordPress Using WP-CLI

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. 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.

    Prompt Description Value
    1/11 dbname: * Enter the name of the MySQL database created exampl3_wp
    2/11 dbuser: * Enter the name of the MySQL database user created exampl3_wp
    3/11 dbpass: * Enter the password created for the database user DBp@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 skip n
    10/11 skip-salts (Y/n): * Enter Y to generate or n to skip generating keys and salts n
    11/11 skip-check (Y/n): * Enter Y test or n to skip testing the database connection n

    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.

    Prompt Description Value
    1/6 url: Enter the URL for your website example.com
    2/6 title: Enter the site title for your website WPCLI Example Site
    3/6 admin_user: Enter the administrator username exampl3_wpadmin
    4/6 admin_password: Enter the administrator password @DM|Np@s$w0rd123!
    5/6 admin_email: Enter the email address for the administrator wpadmin@example.com
    6/6 skip-email (Y/n): Enter Y to email or n to skip emailing the admin details Y

    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. To continue learning more WP-CLI commands, check out our guide on how to use WP-CLI to install and activate themes.

Leave a Reply