How to Install WP-CLI on Linux.

WP-CLI is a handy tool that greatly simplifies installing and managing WordPress. Its installation requires only a few steps, which we will go through here.

In this tutorial, we assume you are working with Ubuntu and you are logged in as root, so switch to root user if you are not already.

sudo -i

Download and install WP-CLI with following command:

wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
-O /usr/local/bin/wp \
&& chmod +x /usr/local/bin/wp

Test if the program works.

wp --info

If the WP-CLI is ‘installed’ properly, the output should be similar to this:

OS:     Linux 5.15.0-1030 #36-Ubuntu SMP Wed Feb 15 05:57:14 UTC 2023 aarch64
Shell:  /bin/bash
PHP binary:     /usr/bin/php8.2
PHP version:    8.2.3
php.ini used:   /etc/php/8.2/cli/php.ini
MySQL binary:   /usr/bin/mysql
MySQL version:  mysql  Ver 15.1 Distrib 10.11.2-MariaDB, for debian-linux-gnu (aarch64) using  EditLine wrapper
SQL modes:      STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:      phar://wp-cli.phar/vendor
WP_CLI phar path:       /usr/src
WP-CLI packages dir:
WP-CLI cache dir:       /root/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.7.1

Similar Posts