Skip to content

Instantly share code, notes, and snippets.

@jonathanbossenger
Last active December 8, 2021 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanbossenger/be8b2c691736a581ff0832dc9dc71059 to your computer and use it in GitHub Desktop.
Save jonathanbossenger/be8b2c691736a581ff0832dc9dc71059 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Installation:
## Download the script to your home directory
# Make sure it has execute permissions (`chmod +x wp-install-core.sh`).
# Install the script in one of the folders in your PATH. (`mv wp-install-core /usr/local/bin/wp-install-core-sub-dir`)
#Usage:
# $ mkdir mysite
# $ cd mysite
# $ wp-install-core {db_name} {db_user} {db_pass} {site_url} "{site_title}" {admin_user} {admin_pass} {admin_email}
DB_NAME=${1-'wordpress'}
DB_USER=${2-'root'}
DB_PASS=${3-'password'}
SITE_URL=${4-'https://wordpress.test'}
SITE_TITLE=${5-'WordPress Site'}
SITE_USER=${6-'admin'}
SITE_PASS=${7-'password'}
SITE_EMAIL=${8-'your@email.com'}
# download WordPress files
wp core download
# create the wp-config.php file
wp config create --dbname=$DB_NAME --dbuser=$DB_USER --dbpass=$DB_PASS
# create the database
wp db create
# install WordPress (less than 5 mins)
wp core install --url=$SITE_URL --title="$SITE_TITLE" --admin_user=$SITE_USER --admin_password=$SITE_PASS --admin_email=$SITE_EMAIL
echo 'Install finished!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment