WP-CLI: How to Install WordPress via SSH

WP-CLI is a command-line interface for managing WordPress installations, and it can be used to install WordPress via SSH. Here’s how:

  1. Connect to your server via SSH: You’ll need to use a terminal or command-line interface to connect to your server via SSH. This will require you to have access to your server login credentials.
  2. Install WP-CLI: Once you’re connected to your server via SSH, you’ll need to install WP-CLI. You can do this by following the instructions provided on the WP-CLI website.
  3. Create a database: Before you can install WordPress, you’ll need to create a new database. You can do this using the command-line interface by typing:
mysql -u username -p

Replace “username” with your MySQL username. You’ll be prompted to enter your MySQL password. Once you’re logged in, type:

CREATE DATABASE database_name;

Replace “database_name” with the name of your new database.

  1. Download WordPress: Next, you’ll need to download the latest version of WordPress. You can do this using the command-line interface by typing:
wp core download

This will download the latest version of WordPress to your server.

  1. Create a wp-config.php file: WordPress requires a configuration file to connect to your database. You can create this file using the command-line interface by typing:
wp config create --dbname=database_name --dbuser=username --dbpass=password

Replace “database_name”, “username”, and “password” with your database name, username, and password.

  1. Install WordPress: Finally, you can install WordPress using the command-line interface by typing:
wp core install --url=example.com --title="My WordPress Site" --admin_user=admin --admin_password=password --admin_email=email@example.com

Replace “example.com”, “My WordPress Site”, “admin”, “password”, and “[email protected]” with your website URL, site title, admin username, admin password, and admin email address.

That’s it! You’ve now installed WordPress via SSH using WP-CLI.