Skip to content

Instantly share code, notes, and snippets.

@kevindees
Last active January 8, 2016 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevindees/c70fd2418f9bca5d721c to your computer and use it in GitHub Desktop.
Save kevindees/c70fd2418f9bca5d721c to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
apt-get update
apt-get -y upgrade
apt-get install -y debconf-utils
export DEBIAN_FRONTEND="noninteractive"
# tools
apt-get -y install git
# apt-get install -y build-essential
# apt-get install -y zlib1g-dev sqlite3
# LAMP
apt-get install -y apache2
# install mysql and give password to installer
debconf-set-selections <<< "mysql-server mysql-server/root_password password password"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password password"
apt-get -y install mysql-server
apt-get install -y mysql-client
apt-get install -y php5
apt-get install -y php5-mysql
apt-get install -y php5-curl
apt-get install -y php5-xdebug
# set
if ! [ -L /var/www ]; then
rm -rf /var/www/html
ln -fs /vagrant /var/www/html
fi
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
sed -i 's/www.example.com/\n<Directory \"\/var\/www\/html">\nAllowOverride All\n<\/Directory>/' /etc/apache2/sites-available/000-default.conf
cat <<EOT >> /etc/php5/apache2/conf.d/20-xdebug.ini
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey ="vagrant"
EOT
# enable mod_rewrite
a2enmod rewrite
# config
sudo echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
# restart
service apache2 restart
service mysql stop
service mysql start
# install Composer
curl -s https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
# import database
echo "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'; create database test; exit;" | mysql -u root -ppassword
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment