Skip to content

Instantly share code, notes, and snippets.

@sheanhoxie
Created February 24, 2019 18:08
Show Gist options
  • Select an option

  • Save sheanhoxie/a379e52740954dffcd0dc9b420b6b238 to your computer and use it in GitHub Desktop.

Select an option

Save sheanhoxie/a379e52740954dffcd0dc9b420b6b238 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo "-- Setting up the box"
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
cat > /etc/apt/sources.list << EOF
deb http://archive.kernel.org/debian-archive/debian/ squeeze main contrib non-free
deb-src http://archive.kernel.org/debian-archive/debian/ squeeze main contrib non-free
deb http://archive.kernel.org/debian-archive/debian/ squeeze-lts main contrib non-free
deb-src http://archive.kernel.org/debian-archive/debian/ squeeze-lts main contrib non-free
EOF
cat > /etc/apt/apt.conf.d/10-no-check-valid-until << EOF
Acquire::Check-Valid-Until "0";
EOF
echo "-- Installing webserver packages"
sudo apt-get update -y > /dev/null 2>&1
sudo apt-get install -y --force-yes git apache2 vim php5-gd php5-xdebug php5-curl php5-mysql mysql-server > /dev/null 2>&1
# Set Git config options.
git config --global color.ui auto
## Fix some stuff in the php.ini for vardump to pretty print.
echo "-- Modifying php.ini"
sudo perl -pi -e 's/html_errors = Off/html_errors = On/' /etc/php5/apache2/php.ini
sudo perl -pi -e 's/display_errors = Off/display_errors = On/' /etc/php5/apache2/php.ini
echo "-- Modifying xdebug.ini"
cat > /etc/php5/cli/conf.d/xdebug.ini << EOF
zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_port = 9000
xdebug.var_display_max_depth = 10
EOF
echo "-- Directory manipulations"
sudo rm -rf /var/www
sudo ln -sf /vagrant/htdocs /var/www
## Set some php config options.
echo "-- Modifying php.ini"
sudo perl -pi -e 's/html_errors = Off/html_errors = On/' /etc/php5/apache2/php.ini
sudo perl -pi -e 's/upload_max_filesize = 2M/upload_max_filesize = 80M/' /etc/php5/apache2/php.ini
sudo perl -pi -e 's/display_errors = Off/display_errors = On/' /etc/php5/apache2/php.ini
sudo perl -pi -e 's/;suhosin.executor.include.whitelist =/suhosin.executor.include.whitelist = phar/' /etc/php5/apache2/conf.d/suhosin.ini
echo "-- Enabling mod_rewrite and allowing .htaccess overrides"
a2enmod rewrite > /dev/null 2>&1
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/sites-enabled/000-default
/etc/init.d/apache2 restart > /dev/null 2>&1
echo "-- Installing drush"
sudo rm -rf /opt/local/bin/drush
sudo mkdir -p /opt/local/bin/drush
sudo chmod -R 777 /opt/local/bin/drush
cd /opt/local/bin/drush
sudo git clone http://git.drupal.org/project/drush.git .
sudo git checkout 7.x-5.4
sudo chown -R vagrant:vagrant /opt/local/bin/drush
PATH=/opt/local/bin/drush:$PATH
ln -sf /vagrant/dev/drush_custom /opt/local/bin/drush/commands
drush cc drush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment