I suppose that many of us would do the next to install WordPress in local server: Obtain the Bundle from WordPress.org, unpack it, put the recordsdata at the native server, open the localhost adopted with the wordpress listing within the Browser, after which practice the instruction as proven.

That is the same old approach to set up WordPress. It really works fantastic, aside from it calls for a number of layer of steps. And more often than not, I’ve to manually re-download the package deal for brand new set up.

In a different way to put in WordPress is by means of the usage of WP-CLI, which I discovered to be extra streamlined. WP-CLI is a collection of command strains for running WordPress stuff. This comprises set up and replace WordPress Core, in addition to set up and replace plugins.

So, should you principally paintings on WordPress setting and are comfy on appearing command strains in Terminal, you’ll practice this tip.

Getting Began

We first want to set up WP-CLI, and one of the best ways could be by way of Homebrew. Kind the next instructions:

brew faucet josegonzalez/homebrew-php
brew set up wp-cli

As soon as put in, you’ll kind wp command to make sure the it’s appropriate. If you were given a message like what’s proven within the screenshot under, it way “it really works”.

verify commandverify command

Developing Mission

We commence putting in WordPress thru command strains. First let’s create our venture listing. In my case, all internet tasks are living beneath ~/Websites folder. So, I will kind the command under to create a folder named /wordpress in it:

mkdir ~/Websites/dev/wordpress

Then, we navigate to this folder with the next command.

cd ~/Websites/dev/wordpress

Let’s obtain the WordPress package deal to this folder.

wp core obtain

Tip: If you wish to obtain a specific edition of WordPress, you’ll run the command adopted with the edition quantity. For instance:

wp core obtain --version=5.1

If the obtain has finished, we will start the set up.

wp downloadwp download

Set up WordPress

First, run the next command to create wp-config.php document.

wp core config --dbname=wordpress --dbuser=root --dbpass=root

The above command assumes that, you in the past have created a database named wordpress. Exchange the database title with the one who you might have created for the WordPress website.

Subsequent, we use wp core set up command to put in WordPress. This instructions the next parameters:

  • --url The site deal with url, e.g. http://localhost:8888/wordpress/.
  • --title The site identify, e.g. My Weblog.
  • --admin_user The admin username. It must be all in lowercase, e.g. admin.
  • --admin_password
  • --admin_email

Kind the command under. Change the parameters price as in line with your individual setup.

wp core set up --url=http://localhost:8888/dev/wordpress/ --title=WordPress --admin_user=myusername --admin_password=mypassword --admin_email=tfirdaus@outlook.com

The method must run fast. If it has finished, you’ll see the next message:


Let’s check out the database.


Sure, as you’ll see above, we have now effectively put in WordPress thru command strains.

Ultimate Ideas

I’m hoping you’ll in finding WP-CLI as a perfect choice to function WordPress. For extra reference, you’ll head over to WP-CLI.org Commands Doc.

The put up How to Install WordPress via Command Line seemed first on Hongkiat.

WordPress Website Development

[ continue ]