Skip to content

Instantly share code, notes, and snippets.

@cmbaughman
Last active September 7, 2018 09:15
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save cmbaughman/3353c3e7279251a2c003 to your computer and use it in GitHub Desktop.
Save cmbaughman/3353c3e7279251a2c003 to your computer and use it in GitHub Desktop.
Vagrant >=1.6 Windows Instructions

How to set up a Windows VM with Vagrant

Create your VM

==================

  1. Obtain a windows vm from Modern IE.
  • Win 8 OSX
curl -O -L "https://www.modern.ie/vmdownload?platform=mac&virtPlatform=virtualbox&browserOS=IE10-Win8.1&parts=5&filename=VMBuild_20131127/VirtualBox/IE10_Win8/Mac/IE10.Win8.For.MacVirtualBox.part{1.sfx,2.rar,3.rar,4.rar,5.rar}"
  • Win 8 Linux
wget -i https://az412801.vo.msecnd.net/vhd/VMBuild_20131127/VirtualBox/IE10_Win8/Linux/IE10.Win8.For.LinuxVirtualBox.txt
  • Extract the .ova file by doing
chmod +x IE10.Win8.For.MacVirtualBox.part1.sfx
./IE10.Win8.For.MacVirtualBox.part1.sfx
  1. Obtain VirtualBox from Oracle VirtualBox.
  2. Import the *.ova or whatever it was you downloaded for your platform into VirtualBox.
  3. Install VirtualBox Windows Guest Tools from inside of the VM.

NOTE: You don't have to use the VMs from Modern IE's site, if you have a windows iso you can make the initial vm yourself. Follow any VirtualBox Tutorial for more info on that if needed. see VirtualBox website

Package for Vagrant

=======================

  1. Launch the box, create a new user called vagrant with password vagrant. Put this user in the Administrators group.
  2. Turn on WinRM:
  • start an command line with Administrator privs.
  • now run these commands in order:
 winrm quickconfig -q
 winrm set winrm/config/winrs @{MaxMemoryPerShellMB="512"}
 winrm set winrm/config @{MaxTimeoutms="1800000"}
 winrm set winrm/config/service @{AllowUnencrypted="true"}
 winrm set winrm/config/service/auth @{Basic="true"}
 sc config WinRM start= auto
  1. Stop the VM and in a terminal run the vagrant packaging commands:
vagrant package --base NameOfTheVMInVirtualBox --output WhateverYouWantToCallIt.box

Example Vagrantfile

=======================

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

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # Windows Guest Specific
  config.vm.box = "Win81"
  config.vm.box_url = "./Win81.box"
  config.vm.guest = :windows

  # port forwarding for RDP and WinRM
  config.vm.network "forwarded_port", guest: 3389, host: 3389
  config.vm.network "forwarded_port", guest: 5985, host: 5985, id: "winrm", auto_correct: true

  # WinRM Settings
  config.vm.communicator = "winrm"

  config.windows.set_work_network = true

  config.vm.network "private_network", ip: "192.168.33.11"

  config.vm.network "public_network"

  # If true, then any SSH connections made will enable agent forwarding.
  # Default value: false
  config.ssh.forward_agent = true

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  config.vm.synced_folder "../data", "/vagrant_data"

  config.vm.provider :virtualbox do |vb|
     # Boot with headless mode
     vb.gui = true
     # Using VBoxManage to set natdnshostresolver (to fix Cisco VPN issues)
     vb.customize ["modifyvm", :id, "--memory", "4096"]
     vb.customize ["modifyvm", :id, "--vram", "128"]
     vb.customize ["modifyvm", :id, "--cpus", "2"]
     vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
     vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
     vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
   end

  config.vm.boot_timeout = 500

end
@IanShoe
Copy link

IanShoe commented Apr 16, 2015

make "IE10.Win8.For.MacVirtualBox.part1.sfx" executable
chmod +x IE10.Win8.For.MacVirtualBox.part1.sfx

./IE10.Win8.For.MacVirtualBox.part1.sfx

@channon1
Copy link

If can not extract on Linux (Debian 8.1)
http://www.hellotecho.com/ubuntu-extracting-sfx-no-such-file-or-directory

dpkg --add-architecture i386
apt-get update
aptitude install libc6:i386 libstdc++6:i386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment