If you are a bash lover I wish you will find WP-CLI is the best approach to install WordPress for your project. WP-CLI provides a command-line interface for many actions you might perform in the WordPress admin where doing those same thing via WP-Admin will cost you some extra time.
To install WP-CLI on your machine depending on your Operating System there are some requirements, please check for that here https://wp-cli.org/
Here I am going to show how to move forward with Linux with PHP version 7.0.
Installing WP-CLI
Open you terminal with CTRL + ALT + T and execute below commands one by one. If things go right I hope you are ready to test the power of WP-CLI.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
wp --info
How to Install a fresh WordPress instance
To install a fresh WordPress instance move into your work directory and create a directory with your project name. For example phpfarmer.com in my case. Then change directory into it and run below commands one by one.
In the meantime I will create a database with below info:
Database name: phpfarmer
Database Username: juyal
Database User Password: 123456$$!
Also I am expecting my newly installed WordPress admin credentials will be:
Username: phpfarmer
Password: 123farmer$$
Email: juyal@phpfarmer.com
# Download and Configure WordPress
wp core download
wp core config --dbhost=localhost --dbname=phpfarmer --dbuser=juyal --dbpass=123456$$!
# Configure wp-config.php
chmod 644 wp-config.php
wp core install --url=yourwebsite.com --title="Your Blog Title" --admin_name=phpfarmer --admin_password=123farmer$$ --admin_email=juyal@phpfarmer.com
# Enable File Uploading
cd wp-content
mkdir uploads
chgrp web uploads/
chmod 775 uploads/
If everything went right then that’s all! Isn’t it easy and fast enough? Let’s see it in action just visit – http://localhost/phpfarmer.com
Try some action with WP-CLI
May be all of them you can do via WP-Admin but clicking, page loading, navigation will wast your time for them. So here you are going to skip them to speed up your development.
wp plugin list
wp plugin update akismet
wp theme list
wp theme update twentyfifteen
Thanks for reading!
very useful ! specially, when building an AMI in AWS. thanks for such a post!
LikeLike