Skip to content

Instantly share code, notes, and snippets.

@zolem
Last active August 29, 2015 14:22
Show Gist options
  • Save zolem/c0a565bc4efd7c43268a to your computer and use it in GitHub Desktop.
Save zolem/c0a565bc4efd7c43268a to your computer and use it in GitHub Desktop.
Install LAMP server and enable needed mods
echo "Installing a LAMP server and php5-dev..."
##### Preseed options to ignore prompt #####
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"
##### Easiest was to use the tasksel lamp server option #####
sudo apt-get install lamp-server^ php5-dev -y
##### Enable any mods for the environment #####
sudo a2enmod expires
sudo a2enmod rewrite
sudo a2enmod headers
sudo a2enmod ssl
sudo sh -c "echo 'SetEnv ENVIRONMENT test' >> /etc/apache2/apache2.conf"
sudo sh -c "echo 'ServerName localhost' >> /etc/apache2/apache2.conf"
sudo ln -s /vagrant /var/www/vagrant
echo "Updating VHOSTS"
if [ -d /vagrant/vhosts ] ; then
for f in /vagrant/vhosts/*.conf
do
b=$(basename $f)
sudo cp -v $f /etc/apache2/sites-available/$b
sudo a2ensite $b
echo "Added vhost $b"
done
fi
sudo service apache2 restart
echo "LAMP Server installation complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment