Download and Install WordPress via bash script

January 11, 2015   |   1 minute read.

My favourite way to install wordpress is with a bash script and WP-CLI. After creating my little script I can enjoy a cup of tea, sea the sun, the rain or just wait until everything happen.

Here is the magic:

# This bash script works JUST with WP-CLI
# You can get it from here:
# http://wp-cli.org/
# If you don't know what to do with this file:
# 1) Install wp-cli on your workspace
# 2) Create a file call wpinstall.sh 
# 3) Copy the whole content of this file on your wpinstall.sh file
# 4) Save your file and add this: chmod +x wpinstall.sh your file. Otherwise you won't be able to run the script
# 5) run your file with ./wpinstall.sh
# 6) While install have a nice cup of hot water or cold.
# Your database credentials
# Your next wordpress site credentials
# 1) Download WordPress
echo 'Downloading WordPress'
wp core download
# 2) Generate wp-config.php / Setting DB
echo 'Creating wp-config.php'
wp config create --dbname=$DBNAME --dbuser=$DBUSER --dbpass=$DBPASS --dbhost=$DBHOST
echo 'Creating database...'
# 3) Creating database
wp db create
# 4) All good
echo 'Dream as if you will live forever. Live as if you will die today.'

Source: https://gist.github.com/teledirigido/94014432677ec36af0ae