Vagrant, Parallels and Windows guests
October 7, 2015
For all of you running a Mac, this is how to create a Windows guest with Vagrant and Packer.
Vagrant supports Parallels 8 and higher, but please be aware that Vagrant only supports the Pro version of Parallels 11.
First install the plugin:
vagrant plugin install vagrant-parallels
Second, get the Parallels virtualization SDK here
Third, get Packer and unzip it in your Vagrant dir.
Fourth, clone packer-windows from Github.
git clone https://github.com/joefitzgerald/packer-windows
Now make sure the packer and the packer-windows executables are in the same folder. This makes the command easier because you don’t need to think hard to make sure the paths to all the files and commands are right.
Fifth, download the Windows server iso upfront. I usually download the Windows Server iso first from here so that I don’t have to wait for the download to finish during the packer build process.
Sixth, get this json config file for Parallels. You see that I put the iso from the fifth step on the desktop and reference it in the file.
Seventh, start building and grab coffee
./packer build -var iso_url=~/Desktop/9600.16384.WINBLUE_RTM.130821-1623_X64FRE_SERVER_EVAL_EN-US-IRM_SSS_X64FREE_EN-US_DV5.ISO windows_2012_r2_parallels.json
And another coffee..
Step eight: add the template to vagrant
vagrant box add --name windows_2012_r2 windows_2012_r2_parallels.box
Step nine: create a Vagrant file
Create a folder named lab01 and put a Vagrantfile in it:
Vagrant.require_version ">= 1.6.2" $root_provision_script = <<'ROOT_PROVISION_SCRIPT' & $env:windir\system32\tzutil /s "W. Europe Standard Time" ROOT_PROVISION_SCRIPT Vagrant.configure("2") do |config| config.vm.define "lab01" config.vm.box = "windows_2012_r2" config.vm.hostname = "lab01" config.vm.provider :virtualbox do |v, override| v.gui = false #v.customize ["modifyvm", :id, "--memory", 2048] #v.customize ["modifyvm", :id, "--cpus", 2] end config.vm.network :forwarded_port, guest: 3389, host: 3391, id: "rdp", auto_correct: true config.vm.network :forwarded_port, guest: 22, host: 2223, id: "ssh", auto_correct: true #config.vm.network "private_network", ip: "192.168.56.11" config.vm.provision "shell", inline: $root_provision_script #config.vm.provision "shell", path: "sysprep.ps1" end
Then issue a ‘vagrant up’ and we’re done.