Skip to content

Instantly share code, notes, and snippets.

@w33ble
Last active January 1, 2016 05:49
Show Gist options
  • Save w33ble/8100842 to your computer and use it in GitHub Desktop.
Save w33ble/8100842 to your computer and use it in GitHub Desktop.
vangrant bootstrap file
#!/usr/bin/env bash
ROOT_PW="PassWord"
apt-get update
### MySQL
# install mysql
apt-get -y install expect
VAR=$(expect -c '
spawn apt-get -y install mysql-server
expect "New password for the MySQL \"root\" user:"
send "${ROOT_PW}\r"
expect "Repeat password for the MySQL \"root\" user:"
send "${ROOT_PW}\r"
expect eof
')
echo "$VAR"
apt-get -y install mysql-client
### PHP
# install php and modules
apt-get install -y php5 php5-mysql libapache2-mod-php5 php5-mcrypt php5-cli php5-intl php5-gd php-pear
# install pear packages
pear install Log Mail MDB2
### Apache
# install apache and replace www
apt-get install -y apache2 apache2-utils
# enable apache features
a2enmod rewrite alias ssl
# set AllowOverrides
mv /etc/apache2/sites-available/default /tmp
sed '11s/.*/\t\tAllowOverride All/' /tmp/default > /etc/apache2/sites-available/default
# restart apache
service apache2 restart
# set up local file access
rm -rf /var/www
ln -fs /vagrant /var/www
### Final output
echo "Mysql root password is ${ROOT_PW}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment