Knowledge Base
MilesWeb / WordPress FAQ

Learn to Install and Manage WordPress Sites With WP-CLI

Approx. read time : 2 min

The below steps can be run with root privileges on a server (VPS hosting). This feature is preinstalled with our VPS hosting accounts.

In this tutorial, you will learn to install and manage WordPress with the WP-CLI. WP-CLI offers a command line interface for WordPress. Users get the tools necessary to install and update plugins, create databases without using a web browser.

Prerequisites

  • Unix-like environment (Linux, FreeBSD, Cygwin).
  • PHP 5.4 or later
  • WordPress 3.7 or later

Installation

Firstly, using SSH connect to your Server’s console. Then you can download the file wp-cli.phar using wget or curl.

Then, check if the downloaded Phar file is working.

Then you will need to set the permission to make the Phar file executable using the below command:

Now, move the file wp-cli.phar to a new directory named wp under /usr/local/bin. With this, you will be able to execute the WP-CLI commands by typing ‘wp’ at the start.

Run wp –info to check if the installation was successful. If it was successful, you’ll see the output below:

Steps to Manage WordPress with WP-CLI

Let’s check some basic and useful WP-CLI commands.

WP-CLI Help System

WP-CLI offers a guide that is accessible by using “wp help“. This guide will give you a detailed info about a specific command. For example, if you want to learn in detail about config command, you can type in:

Check the below sample output:

Steps to Manage Themes

Using the below command, list the themes present in your WordPress:

You will get the below output:

You can install a different theme, using the following command:

Steps to Manage Plugins

Similar to themes, you can also install and manage plugins using wp-cli.

Using the below command you can list the plugins that are already installed on your WP site.

You can also search and install the plugins available from the command line. For example, use the command below to search for the plugin “Yoast SEO”.

You will get the below output:

Use the below command to install and activate the plugin:

Steps to Update WordPress

To update WordPress from the command line, you will need to update the core WordPress files and the database to complete the update process.

Use the below command to update the WordPress core files:

Then, use the below command to update the database:

These are just the few commands that we have discussed in this guide. You will find more commands to manage your database, posts, and multi-sites.

Conclusion

Congratulations! Now you have learned to manage your WP installation from the command line.

Also Read:
The Complete Guide to Update Your WordPress

Delete Your WordPress Theme in 3 Successful Ways

Avatar
Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.
Need help? We’re always here for you.
Register Your Free Domain Name
OFFER EXPIRES IN
04
min
59
sec