Skip to content

Instantly share code, notes, and snippets.

@dsprenkels
Created January 16, 2017 18:15
Show Gist options
  • Save dsprenkels/5018719ad7fa2df237f035b502bbdddd to your computer and use it in GitHub Desktop.
Save dsprenkels/5018719ad7fa2df237f035b502bbdddd to your computer and use it in GitHub Desktop.
install script for piwik
#!/bin/sh
set -e
WGET="wget --quiet"
URL="http://example.com/piwik/index.php"
# make sure that these values are correctly url-encoded!
MYSQL_DB="piwik"
MYSQL_USER="piwik"
MYSQL_PASSWORD="secret"
MYSQL_TABLE_PREFIX="piwik_"
SITE_NAME="Default+website"
SUPERUSER="daan"
SUPERUSER_PASSWORD="secret"
SUPERUSER_EMAIL="[email protected]"
ENCODED_SITE_URL="https%3A%2F%2Fexample.com%2F"
TIMEZONE="Europe%2FAmsterdam"
$WGET "${URL}?action=databaseSetup&module=Installation" \
--post-data="type=InnoDB&host=127.0.0.1&username=$MYSQL_USER&password=$MYSQL_PASSWORD&dbname=$MYSQL_DB&tables_prefix=$MYSQL_TABLE_PREFIX&adapter=PDO%5CMYSQL&submit=Next+%C2%BB"
$WGET "${URL}?action=setupSuperUser&module=Installation" \
--post-data="login=$SUPERUSER&password=$SUPERUSER_PASSWORD&password_bis=$SUPERUSER_PASSWORD&email=$SUPERUSER_EMAIL&subscribe_newsletter_piwikorg=0&subscribe_newsletter_professionalservices=0&submit=Next+%C2%BB"
$WGET "${URL}?action=firstWebsiteSetup&module=Installation" \
--post-data="siteName=$SITE_NAME&url=$ENCODED_SITE_URL&timezone=$TIMEZONE&ecommerce=0&submit=Next+%C2%BB"
$WGET "${URL}?action=finished&module=Installation&site_idSite=1&site_name=$SITE_NAME" \
--post-data="do_not_track=1&submit=Continue+to+Piwik+%C2%BB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment