The WordPress CLI tool allows you to deploy WordPress and add themes & plugins from the command line.
Installation
Change to user that will own the WP install:
Give proper ownership to a suitable directory and move into it:
Install WP-cli:
Make executable, move to make available across system:
Get info about wp-cli to check the installation worked:
Install WordPress Using WP-CLI
Create a new directory called “testsite”:
Give proper ownership:
Download WP core:
Create a MySQL Database:
Configure WordPress to use it:
Install WordPress:
Using WP-CLI Deploy Plugin
Install WP-cli Deploy plugin in relevant WP directory:
Create a wp-cli.yml file in the root of you WordPress directory and add this line to the file:
For example:
Enter wp help deploy
to check it works.
To use WP-cli deploy, you need to define constants in wp-config.php.
For example, set up deploy for the “dev” environment:
Deploy Database and uploads to dev environment:
Necessary Local Ownership Local
Set permissions: allow rwx for user & group, r for others
Remote Ownership:
Example
drwxr-xr-x 5 USERNAME www-data 4096 May 5 17:20 testsite