Skip to content

Instantly share code, notes, and snippets.

@joelstein
Last active August 29, 2015 13:57
Show Gist options
  • Save joelstein/9509867 to your computer and use it in GitHub Desktop.
Save joelstein/9509867 to your computer and use it in GitHub Desktop.
Vagrant
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The box to build from.
config.vm.box = "ubuntu-precise-64"
# The URL where box is located.
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
# Setup port forwarding from the host to the guest.
config.vm.network :forwarded_port, host: 4567, guest: 80
# Update apt.
config.vm.provision "shell", inline: "apt-get update"
# Install Apache.
config.vm.provision "shell", inline: "apt-get install -y apache2"
# Set Apache server name.
config.vm.provision "shell", inline: "echo 'ServerName localhost' >> /etc/apache2/apache2.conf"
# Enable Apache's rewrite module.
config.vm.provision "shell", inline: "a2enmod rewrite"
# Link DocumentRoot to shared vagrant folder.
config.vm.provision "shell", inline: "rm -rf /var/www"
config.vm.provision "shell", inline: "ln -fs /vagrant /var/www"
# Install PHP.
config.vm.provision "shell", inline: "apt-get install -y php5"
# Install cURL.
config.vm.provision "shell", inline: "apt-get install -y curl php5-curl"
# Install PHP GD.
config.vm.provision "shell", inline: "apt-get install -y php5-gd"
# Install APC.
config.vm.provision "shell", inline: "apt-get install -y php-apc"
config.vm.provision "shell", inline: "echo 'apc.rfc1867=1' > /etc/php5/conf.d/apc.ini"
config.vm.provision "shell", inline: "echo 'apc.shm_size=128M' > /etc/php5/conf.d/apc.ini"
# Install MySQL (setting password non-interactively).
config.vm.provision "shell", inline: "echo 'mysql-server-5.1 mysql-server/root_password password 1234567890' | debconf-set-selections"
config.vm.provision "shell", inline: "echo 'mysql-server-5.1 mysql-server/root_password_again password 1234567890' | debconf-set-selections"
config.vm.provision "shell", inline: "apt-get install -y mysql-server"
config.vm.provision "shell", inline: "apt-get install -y curl php5-mysql"
# Restart Apache.
config.vm.provision "shell", inline: "service apache2 restart"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment