Skip to content

Instantly share code, notes, and snippets.

@bryan-snyder
Created May 30, 2016 22:16
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryan-snyder/845210f6792cde3a073e08de9a86917f to your computer and use it in GitHub Desktop.
Save bryan-snyder/845210f6792cde3a073e08de9a86917f to your computer and use it in GitHub Desktop.
Wordpress Bash Install Script
#!/bin/bash
# Setup Variables
DBNAME=mydatabase
DBUSER=databaseuser
DBPASS=dnpass
DBHOST=localhost
DBPREFIX=9239jej9md_
URL=http://urlofsite.com
TITLE=SiteTitle
ADMINUSER=danielpataki
ADMINPASS=mypassword
ADMINEMAIL=myeamil
REPOPLUGINS="wordpress-importer theme-check"
# Remove Current Installation
wp db drop --yes;
wp core download;
# Install WordPress
wp core config --dbname=${DBNAME} --dbuser=${DBUSER} --dbpass=${DBPASS} --dbhost=${DBHOST} --dbprefix=${DBPREFIX} --extra-php <<PHP
define( 'WP_DEBUG', true );
PHP
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 "/%year%/%monthnum%/%day%/%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