Skip to content

Instantly share code, notes, and snippets.

@barrykooij
Last active August 29, 2015 14:01
Show Gist options
  • Save barrykooij/4841d51ad9a6ccaa48ba to your computer and use it in GitHub Desktop.
Save barrykooij/4841d51ad9a6ccaa48ba to your computer and use it in GitHub Desktop.
sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password root'
sudo apt-get update
sudo apt-get -y install mysql-server-5.5 php5-mysql libsqlite3-dev apache2 php5 php5-dev build-essential php-pear
# Set timezone
echo "Europe/Amsterdam" | sudo tee /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
# Setup database
if [ ! -f /var/log/databasesetup ];
then
echo "DROP DATABASE IF EXISTS test" | mysql -uroot -proot
sudo touch /var/log/databasesetup
if [ -f /var/sqldump/database.sql ];
then
mysql -uroot -proot devdb < /var/sqldump/database.sql
fi
fi
# Apache changes
if [ ! -f /var/log/webserversetup ];
then
echo "ServerName localhost" | sudo tee /etc/apache2/httpd.conf > /dev/null
sudo a2enmod rewrite
sudo sed -i '/AllowOverride None/c AllowOverride All' /etc/apache2/sites-available/default
sudo touch /var/log/webserversetup
fi
# Install Mailcatcher
if [ ! -f /var/log/mailcatchersetup ];
then
sudo /opt/vagrant_ruby/bin/gem install mailcatcher
sudo touch /var/log/mailcatchersetup
fi
# Install xdebug
if [ ! -f /var/log/xdebugsetup ];
then
sudo pecl install xdebug
XDEBUG_LOCATION=$(find / -name 'xdebug.so' 2> /dev/null)
sudo touch /var/log/xdebugsetup
fi
# Configure PHP
if [ ! -f /var/log/phpsetup ];
then
sudo sed -i '/;sendmail_path =/c sendmail_path = "/opt/vagrant_ruby/bin/catchmail"' /etc/php5/apache2/php.ini
sudo sed -i '/display_errors = Off/c display_errors = On' /etc/php5/apache2/php.ini
sudo sed -i '/error_reporting = E_ALL & ~E_DEPRECATED/c error_reporting = E_ALL | E_STRICT' /etc/php5/apache2/php.ini
sudo sed -i '/html_errors = Off/c html_errors = On' /etc/php5/apache2/php.ini
echo "zend_extension='$XDEBUG_LOCATION'" | sudo tee -a /etc/php5/apache2/php.ini > /dev/null
sudo touch /var/log/phpsetup
fi
# Make sure things are up and running as they should be
mailcatcher --http-ip=192.168.33.10
sudo service apache2 restart
# Symlink /vagrant/ to /var/www
sudo rm -Rf /var/www
cd /var/
sudo ln -s /vagrant/ www
# Installing Curl
sudo apt-get install curl
sudo apt-get install php5-curl
sudo service apache2 restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment