• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » How To Install WP CLI With apt get On Ubuntu Server?

By Abhishek Ghosh November 26, 2018 8:27 pm Updated on November 26, 2018

How To Install WP CLI With apt get On Ubuntu Server?

Advertisement

In previous articles we discussed about WP CLI. We used to avoid involving WP CLI as most of the new users with cloud, dedicated server may get confused on SSH. Many avoid WP CLI for multi-step CLI works. A Debian installer makes the installation, setup work just easy. This article will guide how to install WP CLI with apt get on Ubuntu server. This guide is usable on server with already running WordPress site as well as fresh server. Fresh blank servers need to install Apache2,  PHP 7.2 (latest commonly used at this moment), Percona MySQL.  WP CLI will :

  • Make WordPress works possible to perform with commands and bash scripts. Hence it is possible to automate more.
  • Make WordPress installation easy, avoiding wget, un-tar, moving files steps.

 

How To Install WP CLI With apt get

 

You will get official deb, rpm installer here on GitHub :

Vim
1
https://github.com/wp-cli/builds/tree/gh-pages/deb

You’ll get the apt version on Launchpad :

Advertisement

---

Vim
1
https://launchpad.net/~tiagohillebrandt/+archive/ubuntu/wp-cli

In order to install WP CLI, we will run :

Vim
1
2
3
4
5
sudo add-apt-repository ppa:tiagohillebrandt/wp-cli
## hit enter/return key to accept
apt update
apt upgrade
apt install wp-cli

How To Install WP CLI With apt get On Ubuntu Server

If you are root user, and run :

Vim
1
wp --help

You’ll get output like this :

Vim
1
2
3
4
5
6
7
8
9
Error: YIKES! It looks like you're running this as root. You probably meant to run this as the user that your WordPress install exists under.
 
If you REALLY mean to run this as root, we won't stop you, but just bear in mind that any code on this site will then have full control of your server, making it quite DANGEROUS.
 
If you'd like to continue as root, please run this again, adding this flag:  --allow-root
 
If you'd like to run it as the user that this site is under, you can run the following to become the respective user:
 
    sudo -u USER -i -- wp <command>

You can run commands with :

Vim
1
wp --help --allow-root

If your current WordPress installation is at /var/www/html location, then change directory there :

Vim
1
cd /var/www/html

… then run test commands. If you have another WordPress site at /var/www/wordpress1 location, then you can individually manage it.

We can search WordPress plugin with keyword like SEO :

Vim
1
wp plugin search seo

Ideally, you should have an username with root privilage to install (or later manage) WordPress, keep the ownership of WordPress files to username:www-data. Commonly we use root:www-data for installation from SSH. You should take care that new plugins, themes are not getting installed with only root ownership – it can make PHP and WordPress unable to work properly. There is way to manage that, notice the commands :

Vim
1
2
3
4
5
6
7
# update wordpress
sudo -u www-data wp core update
sudo -u www-data wp core update-db
 
# install plugin
sudo -u www-data wp plugin install wordpress-seo
sudo -u www-data wp plugin activate wordpress-seo

To install WordPress in /var/www/htmlcurrent dir with database host localhost, with database name wordpress_db, database prefix wp_, database user abhishek, database password mypassword, Site
Name The Customize Windows, URL https://thecustomizewindows.com, WordPress account username thecustomizewindows, password loginpassword, email address admin@thecustomizewindows.com, command will be :

Vim
1
wp core download --path=/var/www/html && wp core config --dbhost=localhost --dbname=wordpress_db --dbprefix=wp_ --dbuser=abhishek --dbpass="mypassword" && wp db create && wp core install --url=https://thecustomizewindows.com --title="The Customize Windows" --admin_user=thecustomizewindows --admin_password="loginpassword" --admin_email=admin@thecustomizewindows.com

 

Conclusion

 

You can configure WP CLI more – perform database queries, manage user capabilities, manage cron events, import or export content to many works. There are huge resources for information on that topic :

Vim
1
2
3
4
5
6
# resources on wordpress
https://make.wordpress.org/cli/handbook/tools/
https://developer.wordpress.org/cli/commands/
 
# resources on wp-cli
http://wp-cli.org/

Tagged With apt install wp cli , apt-get install wp-cli
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How To Install WP CLI With apt get On Ubuntu Server?

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

  • Install WordPress on HP Cloud (Ubuntu, Nginx)

    Here is step by step guide to install WordPress on HP Cloud with one Database Server and one Web server on Ubuntu and Nginx PHP5-FPM platform.

  • How To Install WordPress on Ubuntu 13.10 on Rackspace Cloud Server

    This is a Step by Step Guide For the New Users With All the Commands To Install Wordpress on Ubuntu 13.10 on Rackspace Cloud Server.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy