Skip to content

Instantly share code, notes, and snippets.

@agentrickard
Last active October 25, 2017 02:10
Show Gist options
  • Save agentrickard/1caab0c9084b1ee1418c29f22969f260 to your computer and use it in GitHub Desktop.
Save agentrickard/1caab0c9084b1ee1418c29f22969f260 to your computer and use it in GitHub Desktop.
#!/bin/bash
#######
# This script assumes that you have composer and drush installed.
# Be sure to change the directory location and database credentials below.
#
# Place this file in your home directory or web root. Make it executable.
# To run, open Terminal and:
# > cd ~
# > ./drupal8.sh
#######
# Be in the right directory
# Set this to be proper for your local web root.
cd /Applications/MAMP/htdocs
# Clear the old stuff
sudo rm -rf drupal8
echo 'Sudo password needed to delete files'
echo 'Removed old files.'
# Create the database. Set your password as needed.
echo 'Dropping database.'
mysql -u test -ptest -e "DROP DATABASE drupal8;"
echo 'Creating database.'
mysql -u test -ptest -e "CREATE DATABASE drupal8 CHARACTER SET utf8 COLLATE utf8_general_ci;"
# clone the code
git clone --recursive --branch 8.5.x http://git.drupal.org/project/drupal.git drupal8
# run composer
cd drupal8
composer install
# Try to install
echo 'Setting permissions on default directory.'
cd sites
chmod a+w default
cd ../
# Set your database connection here.
drush si standard --db-url=mysql://test:test@localhost:3306/drupal8 --account-pass="admin" --site-name="Drupal 8" -y
# Set some testing parameters.
chmod 775 sites/default/settings.php
echo "ini_set('memory_limit', '512M');" >> sites/default/settings.php
echo "ini_set('xdebug.max_nesting_level', 256);" >> sites/default/settings.php
echo "error_reporting(E_ALL);" >> sites/default/settings.php
echo "\$config['system.logging']['error_level'] = 'verbose';" >> sites/default/settings.php
echo "\$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';" >> sites/default/settings.php
chmod 444 sites/default/settings.php
cd ../..
drush dl admin_toolbar devel config_inspector
drush en admin_toolbar admin_toolbar_tools devel kint config_inspector simpletest -y
echo "Installation complete."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment