If you want to automate and speed up your WordPress development process, it’s highly advisable to try out WP-CLI.
In this small guide, we will be focusing on the installation of WP-CLI on Centos 7 or any other RHEL based OS machines. If you want to know more about the WP-CLI in overall, just read our previous article related to the WP-CLI subject.
If you plan to use the WP-CLI, we already assume that you do have the root access credentials or al least user credentials enough to be able to issue sudo command.
Install WP-CLI on CentOS 7
So, access your server or VPS running CentOS7 using your favorite terminal software, like Putty. Once you log in, type the cd / command to go into the root folder. You can also specify any other folder per your own specific needs.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
Next, check the Phar file to verify that it’s working:
php wp-cli.phar --info
To use WP-CLI from the command line by typing
wp, make the file executable and move it to somewhere in your PATH.
chmod +x wp-cli.phar
If you are not using the root account, type sudo before the mv command:
sudo mv wp-cli.phar /usr/local/bin/wp--info
If WP-CLI was installed successfully, you should see something like this when you run
$ wp --info OS: Linux xxx.prvihosting.com 3.10.0-957.10.1.el7.x86_64 #1 SMP Mon Mar 18 15:06:45 UTC 2019 x86_64 Shell: /bin/zsh PHP binary: /usr/local/bin/php PHP version: 7.2.13 php.ini used: /etc/local/etc/php/7.0/php.ini WP-CLI root dir: /home/wp-cli/.wp-cli/vendor/wp-cli/wp-cli WP-CLI vendor dir: /home/wp-cli/.wp-cli/vendor WP-CLI packages dir: /home/wp-cli/.wp-cli/packages/ WP-CLI global config: /home/wp-cli/.wp-cli/config.yml WP-CLI project config: WP-CLI version: 2.3.0
So, once you perform this couple of easy steps you can start using the WP-CLI.
Be sure to visit our blog more often as we plan to write down the guidances on how to use WP-CLI on daily base development and we will also provide the example scripts for use.
That’s it, have a great day. 🙂