Skip to content

Instantly share code, notes, and snippets.

@sobujbd
Created July 25, 2019 02:30
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 sobujbd/91092f76ca2ec91681f32dcf3302583c to your computer and use it in GitHub Desktop.
Save sobujbd/91092f76ca2ec91681f32dcf3302583c to your computer and use it in GitHub Desktop.
One-Click WordPress Installer
#!/bin/bash
# Setup Variables
DBNAME=database_name
DBUSER=database_user
DBPASS=database_password
#DBHOST=localhost
#DBPREFIX=gits_
URL=domain_name
TITLE=site_title
ADMINUSER=wp_admin_name
ADMINPASS=wp_admin_password
ADMINEMAIL=wp_admin_email
# Default Plugin
REPOPLUGINS="wordpress-importer classic-editor theme-check";
# Remove Current Installation
wp db drop --yes;
wp core download;
# Install WordPress
wp core config --dbname=${DBNAME} --dbuser=${DBUSER} --dbpass=${DBPASS}
wp db create
wp core install --url=${URL} --title=${TITLE} --admin_user=${ADMINUSER} --admin_password=${ADMINPASS} --admin_email=${ADMINEMAIL}
# Delete Base Plugins
#wp plugin delete hello
#wp plugin delete akismet
# Install Repo Plugins
wp plugin install ${REPOPLUGINS} --activate
# Misc Cleanup
#wp post delete 1
#wp plugin delete hello-dolly
wp rewrite structure "%postname%";
wp rewrite flush
# Install WPTest.io
#curl -OL https://raw.githubusercontent.com/manovotny/wptest/master/wptest.xml
#wp import wptest.xml --authors=create
#rm wptest.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment