Easy Guide For Installing WP CLI On A Linux Server

Last updated December 5th, 2023 23:48

If you have your own server hosting one or more WordPress websites, you can use WP CLI alongside the standard tools. WP-CLI (WordPress Command Line Interface) is a tool designed for managing websites built on the WordPress platform through the command line. Additionally, you can leverage WP CLI tools for automating WordPress using commands and PHP functions that utilize WP CLI components. This enables you to create a PHP script that conducts various checks or automated actions using CRON, where it calls WP CLI functions. However, owning a server and having SSH access (at least for installation purposes) are prerequisites. In this article, we’ll demonstrate easy guide for Installing WP CLI on a Linux server. The installation is manageable even with minimal system experience.

Easy Guide For Installing WP CLI On A Linux Server

Nejprve se tedy pomocí libovolného SSH klienta přihlaste na server. Jako první příkaz použijte update pro aktualizaci balíčků:

					sudo apt update

Now, install PHP CLI and related packages. You can achieve this by using the following command:

					sudo apt install php-cli php-mbstring git unzip

Afterwards, download WP-CLI. Execute the following command to download WP-CLI:

					curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

After this command, you’ll need to make WP-CLI executable. Assign executable permissions to the downloaded file:

					chmod +x wp-cli.phar

Move the downloaded file to a folder that’s part of the path for executable files:

					sudo mv wp-cli.phar /usr/local/bin/wp

That’s all you need to do to set up WP-CLI. You can now verify whether this component is functional on the server using the command:

					wp --info

The most important WP-CLI commands:

  • wp core install: command that installs the WordPress core, sets up basic configuration, and creates an administrator account
  • wp plugin list: this command lists installed plugins and their status
  • wp plugin install [plugin_name]: installs the chosen plugin from the official WordPress repository
  • wp plugin activate [plugin_name]: activates a specific plugin
  • wp theme list: displays a list of activated themes and their details
  • wp theme install [theme_name]: installs the selected theme from the official WordPress repository
  • wp theme activate [theme_name]: activates a specific theme
  • wp post create: creates a new post with designated content and metadata
  • wp post list: shows a list of existing posts on the website
  • wp rewrite flush: refreshes URL rules and executes the “flush” mode, which can resolve permalink issues

Easy Guide For Installing WP CLI On A Linux Server


As you can see, WP-CLI can be effectively utilized, for instance, on a server where you aim to fully automate WordPress installations, plugins, and theme templates for your target customers to whom you provide web hosting. However, there are many more possibilities for its usage. Personally, I use WP-CLI alongside my custom PHP scripts to automate specific tasks, and along with CRON management for various website status checks. If you’ve been able to set up MySQL and Apache on a website, then installing and managing WP-CLI should pose no issue for you. This interface offers numerous benefits.

The website is created with care for the included information. I strive to provide high-quality and useful content that helps or inspires others. If you are satisfied with my work and would like to support me, you can do so through simple options.

Byl pro Vás tento článek užitečný?

Klikni na počet hvězd pro hlasování.

Průměrné hodnocení. 0 / 5. Počet hlasování: 0

Zatím nehodnoceno! Buďte první

Jak užitečný vidíte tento článek.

Sledujte mě na sociálních médiích.

Je mi líto, že pro Vás nebyl článek užitečný.

Jak mohu vylepšit článek?

Řekněte mi, jak jej mohu zlepšit.


Subscribe to the Newsletter

Stay informed! Join our newsletter subscription and be the first to receive the latest information directly to your email inbox. Follow updates, exclusive events, and inspiring content, all delivered straight to your email.

Upozornit na
0 Komentáře/ů
Vložené zpětné vazby.
Zobrazit všechny komentáře.

Pokud mi chcete napsat rychlou zprávu, využije, prosím, níže uvedený
kontaktní formulář. Děkuji.

Další Kontaktní údaje