You’ll need Virtual box so download and install that
https://www.virtualbox.org/wiki/Downloads
Then you’ll need vagrant
https://www.vagrantup.com/downloads.html
You can check out the getting started guide here:
https://www.vagrantup.com/docs/getting-started/
Simple example:
Open a terminal session (iTerm2 on mac or cmder windows) and run:
vagrant init hashicorp/precise64
vagrant up
vagrant ssh
exit
vagrant destroy
Lets make our own
mkdir MyFirstVagrant
cd MyFirstVagrant/
vagrant init
Lets commit it to a github repo so we have source control on it. Go to github.com and create a repo. Replace the url below with your .git file.
echo "# Vagrants" >> README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/phpdave/Vagrants.git git push -u origin master
Lets find a box we want to add to our vagrantfile
https://atlas.hashicorp.com/boxes/search
I chose the most popular vagrant ubuntu/trusty64. Edit the vagrantfile and Below “Vagrant.configure(“2″) do |config|” add:
config.vm.box = “ubuntu/trusty64”
config.vm.box_version = “20160926.0.1”
exit your editor and do
vagrant up
vagrant ssh
Then you have your ubuntu server to setup how you want.
Example of setting up PHP 7 dev vagrant:
https://github.com/rlerdorf/php7dev
Provisioning w/ external shell script:
config.vm.provision "shell", path: "script.sh"
in script.sh you could run an update and install of apache, php:
sudo apt-get -y update
sudo apt-get -y install apache2 php7 libapache2-mod-php7
Give a network IP address
config.vm.network "private_network", ip: "192.168.50.4"
Want to do this on a power System? Well VirtualBox doesnt appear to support powerpc so looks like you have to use powerkvm instead.