Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MekDrop/5e473e3beff5778dd9442eae07edfd87 to your computer and use it in GitHub Desktop.
Save MekDrop/5e473e3beff5778dd9442eae07edfd87 to your computer and use it in GitHub Desktop.
Script for Vagrant boxes to create basic LAMP
#!/bin/bash
chown -R www-data:www-data /vagrant/www
if grep -Fxq "~/.composer/vendor/bin" /etc/environment
then
echo ';)'
else
sed -i '/^PATH=/d' /etc/environment
PATH="$PATH:~/.composer/vendor/bin"
echo "PATH=\"$PATH\"" >> /etc/environment
cat /etc/environment
export PATH
fi
apt-get update
apt-get upgrade -y
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
apt-get install -y php-intl php-mbstring php-gd php-json php php-cli php-fpm apache2 libapache2-mod-php git php-xdebug php-curl php-gd php-mcrypt mysql-server php-mysql zip unzip sendmail php-zip
sed -i "s/\/var\/www/\/\/vagrant\/www/" /etc/apache2/apache2.conf
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/cli/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/cli/php.ini
sed -i "s/disable_functions = .*/disable_functions = /" /etc/php/7.0/cli/php.ini
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php/7.0/fpm/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.0/fpm/php.ini
sed -i "s/disable_functions = .*/disable_functions = /" /etc/php/7.0/fpm/php.ini
a2enmod rewrite
service apache2 reload
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
rm -rf /var/www/html
ln -s /vagrant/www /var/www/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment