Skip to content

Instantly share code, notes, and snippets.

@john-crossley
Last active December 30, 2015 14:09
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 john-crossley/7840568 to your computer and use it in GitHub Desktop.
Save john-crossley/7840568 to your computer and use it in GitHub Desktop.
My default vagrant setup script
#!/usr/bin/env bash
sudo apt-get update
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- Installing MYSQL ---"
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'
echo "--- Installing base packages ---"
sudo apt-get install -y vim curl python-software-properties
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- Updating to the most bleeding edge of php ---"
sudo apt-add-repository -y ppa:ondrej/php5
echo "--- Updating packages list ---"
sudo apt-get update
echo "--- Installing PHP-specific packages ---"
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt mysql-server-5.5 php5-mysql git-core
echo "--- Installing and configuring Xdebug ---"
sudo apt-get install -y php5-xdebug
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
EOF
echo "--- Enabling mod-rewrite ---"
sudo a2enmod rewrite
echo "--- Setting document root to public directory. Update as needed. ---"
sudo rm -rf /var/www
sudo ln -fs /vagrant/public /var/www
echo "--- Ensuring PHP errors are turned on ---"
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
echo "--- Restaring apache ---"
sudo service apache2 restart
echo "--- Installing composer ---"
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Custom laravel settings here...
echo "--- INSTALLATION AND CONFIGURATION COMPLETE - HAPPY CODING ---"
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :shell, :path => "install.sh"
config.vm.synced_folder ".", "/vagrant", :mount_options => ["dmode=777","fmode=666"]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment