Last active
November 26, 2015 00:12
-
-
Save cullylarson/d5780ad491b65a303bdc to your computer and use it in GitHub Desktop.
Vagrant Ubuntu 12.04.5 LTS (Precise Pangolin) x64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# set timezone | |
echo "\n--- Set timezone to Etc/UTC\n" | |
echo "Etc/UTC" | tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata | |
echo "\n--- Apt Update\n" | |
apt-get update | |
# setup mysql package | |
echo "\n--- Pre-Configuring MySQL\n" | |
echo "mysql-server mysql-server/root_password password root" | debconf-set-selections | |
echo "mysql-server mysql-server/root_password_again password root" | debconf-set-selections | |
# install packages | |
echo "\n--- Installing Packages\n" | |
apt-get install -y wget apache2 mysql-client mysql-server php5 php5-mysql php5-cli php5-curl php5-mcrypt php5-json php5-gd libssh2-php git sendmail php5-xdebug | |
# create mysql database | |
echo "\n--- Creating MySQL Database\n" | |
mysql -u root -proot -e "CREATE DATABASE dev; GRANT ALL PRIVILEGES ON dev.* TO dev IDENTIFIED BY 'dev'; FLUSH PRIVILEGES;" | |
# setup webroot | |
echo "\n--- Setting Up Webroot\n" | |
if ! [ -L /var/www ]; then | |
rm -rf /var/www | |
mkdir -p /var/www | |
ln -fs '/vagrant' /var/www/html | |
fi | |
# update default apache site config | |
echo "\n--- Re-writing Apache Default Site Config\n" | |
mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.dist | |
echo '<VirtualHost *:80>' > /etc/apache2/sites-available/default | |
echo ' ServerAdmin webmaster@localhost' >> /etc/apache2/sites-available/default | |
echo ' DocumentRoot /var/www/html' >> /etc/apache2/sites-available/default | |
echo ' ErrorLog ${APACHE_LOG_DIR}/error.log' >> /etc/apache2/sites-available/default | |
echo ' CustomLog ${APACHE_LOG_DIR}/access.log combined' >> /etc/apache2/sites-available/default | |
echo ' <Directory "/var/www/html">' >> /etc/apache2/sites-available/default | |
echo ' AllowOverride All' >> /etc/apache2/sites-available/default | |
echo ' </Directory>' >> /etc/apache2/sites-available/default | |
echo '</VirtualHost>' >> /etc/apache2/sites-available/default | |
# allow mod rewrite | |
echo "\n--- Allow Mod_Rewrite\n" | |
a2enmod rewrite | |
# make apache run as vagrant user | |
echo "\n--- Make apache run as vagrant user\n" | |
sed -i 's/APACHE_RUN_USER=www-data/APACHE_RUN_USER=vagrant/' /etc/apache2/envvars | |
chown -R vagrant:www-data /var/lock/apache2 # need to upload lock file permissions | |
# restart apache | |
echo "\n--- Restarting Apache\n" | |
service apache2 restart | |
# SSH keys | |
echo "\n--- Generate SSH key\n" | |
ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N '' | |
echo "\n--- Add SSH key to agent\n" | |
eval `ssh-agent -s` && ssh-add | |
# install composer | |
echo "\n--- Installing Composer\n" | |
curl -sS https://getcomposer.org/installer | php | |
mv composer.phar /usr/local/bin/composer | |
# install node | |
echo "\n--- Install Node\n" | |
curl -sL https://deb.nodesource.com/setup | sudo bash - | |
sudo apt-get install -y nodejs | |
# install gulp | |
echo "\n--- Install npm Packages\n" | |
npm install --global gulp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vm.box = "ubuntu/precise64" | |
config.vm.network "forwarded_port", guest: 80, host: 8080 | |
config.vm.provision "shell", path: "./vagrant-provision.sh" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment