Skip to content

Instantly share code, notes, and snippets.

@ajmorris

ajmorris/wp-install.sh Secret

Created Sep 4, 2015
Embed
What would you like to do?
#!/bin/bash -e
# Goal is to pass wsomething like this:
# sh wp-install.sh siteURL dbname dbusername dbpass wpuser wpemail wppass
echo "===================================="
echo "Downloading WordPress!!"
echo "===================================="
# Step 1 Download WordPress
wp core download
echo "===================================="
echo "Creating WordPress Config File!!"
echo "===================================="
# Step 2 Create wp-config.php
wp core config --dbname=$2 --dbuser=$3 --dbpass=$4
echo "===================================="
echo "Creating WordPress Database!!"
echo "===================================="
# Step 3 Create the WP Database
wp db create
echo "===================================="
echo "Installing WordPress!!"
echo "===================================="
# Step 4 Install WordPress
wp core install --url=$1 --title="Liquid Web Test Site" --admin_user=$5 --admin_password=$7 --admin_email=$6
echo "===================================="
echo "Removing Hello Dolly!!"
echo "===================================="
# Step 5 Remove Hello Dolly Plugin
wp plugin delete hello
# To enable Pretty URLs we must also modify our .wp-cli/config.yml file to include the following:
# apache_modules:
# - mod_rewrite
# With this added, pretty URLs will work.
echo "===================================="
echo "Make Pretty URLs"
echo "===================================="
# Step 6 Setup Pretty URLs
wp rewrite structure '/%postname%/' --hard
wp rewrite flush --hard
clear
echo "================================================================="
echo "Installation is complete."
echo "================================================================="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment