Johnhhorton
10/22/2015 - 5:12 PM

Vagrant setup for Hashicorp Ubuntu Precise 32bit with Apache2 and PHP.

Vagrant setup for Hashicorp Ubuntu Precise 32bit with Apache2 and PHP.

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
  config.vm.box = "hashicorp/precise32"
  config.vm.synced_folder "./", "/var/www"
  config.vm.network "forwarded_port", guest: 80, host: 3000
  config.vm.provision "shell", inline: <<-SHELL
    sudo apt-get update
    sudo apt-get install -y apache2 php5 libapache2-mod-php5
	sudo a2enmod php5
	sudo service apache2 restart
  SHELL
  
  config.vm.provider "virtualbox" do |vb|
   # Display the VirtualBox GUI when booting the machine
    vb.gui = true
  # Customize the amount of memory on the VM:
    vb.memory = "1024"
  end

end

#Vagrant Setup

Initialize

Vagrant init

add config

Replace contents of Vagrantfile with contents of VagrantFile.rb.

Create and start

vagrant up

usage

vagrant ssh

vagrant suspend //to save state and suspend.

vagrant halt //to gracefully shutdown

vagrant destroy //to destroy the VM.