DevOps Yourself:

Fast-Track Your
Windows Develop
Environment Setup

Justin James

@digitaldrummerj

 

Hours

 

Later

 

....

 

 

+

=

+

Hands On 
Time

Creating Config Directories

c:\vagrantboxes\linux

 

c:\vagrantboxes\windows

Creating Linux Machine

Create VagrantFile

  1. Open Command Prompt
     
  2. cd \vagrantboxes\linux
     
  3. vagrant init ubuntu/trusty64

Configure Virtual Machine

  1. VagantFile created in
    c:\vagrantboxes\linux
     
  2. Open in text editor
     

Configure Virtual Box

Vagrant.configure(2) do |config|
    .....

    config.vm.provider "virtualbox" do |vb|
        vb.memory = "1024"
        vb.cpus = 2
        vb.name = "Workshop - Linux"
    end

    ...Provisioning
end

Create Shell Script

  1. Create main.sh in
    c:\vagrantboxes\linux
     
  2. Open in text editor
     

main.sh contents

export DEBIAN_FRONTEND=noninteractive

apt-get install git -y > /dev/null

Configure Provisioning 

Vagrant.configure(2) do |config|
    .....Virtualbox

    config.vm.provision :shell, 
          path: "main.sh" 
end

Start Up Box

vagrant up

Login into Box

vagrant ssh

Control Virtual Machine

Useful Vagrant Commands

vagrant reload

Need to Reboot?

vagrant halt

Need to Shutdown?

vagrant suspend

Need to Hibernate?

vagrant destroy

Done with Project?

vagrant up

Need to Box Again?

Creating Windows
Machine

Create VagrantFile

  1. Open Command Prompt
     
  2. cd \vagrantboxes\windows
     
  3. vagrant init opentable/win-2012r2-standard-amd64-nocm

Configure Virtual Machine

  1. VagrantFile created in
    c:\vagrantboxes\windows
     
  2. Open in text editor
     

Configure VagrantFile

Vagrant.configure(2) do |config|
    config.vm.box = "opentable/win-2012r2-standard-amd64-nocm"
    config.vm.boot_timeout = 600
    config.vm.communicator = "winrm"

    ....Virtualbox Config

    ....Provisioning
end

Configure Virtual Box

Vagrant.configure(2) do |config|
    .....

   config.vm.provider "virtualbox" do |vb|
        vb.gui = true
        vb.memory = "4096"
        vb.cpus = 2
        vb.name = "Workshop - Windows" 
        vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
   end

    ...Provisioning
end

Create Shell Script

  1. Create main.cmd in
    c:\vagrantboxes\windows
     
  2. Open in text editor
     

main.cmd contents


@powershell -NoProfile -ExecutionPolicy Bypass -File 
    "%systemdrive%\vagrant\InstallChocolatey.ps1"

Create Install Chocolatey

  1. Create InstallChocolatey.ps1 in
    c:\vagrantboxes\windows
     
  2. Open in text editor
     

InstallChocolatey.ps1

$ChocoInstallPath = "$env:SystemDrive\ProgramData\Chocolatey\bin"

 if (!(Test-Path $ChocoInstallPath)) {
     iex ((new-object net.webclient)
        .DownloadString('https://chocolatey.org/install.ps1'))
 }

Configure Provisioning 

Vagrant.configure(2) do |config|
    .....Virtualbox

    config.vm.provision :shell, 
          path: "main.cmd" 
end

Start Up Box

vagrant up

  • AWS (EC2 or VPC)
     

  • Azure 
     

  • Modern.IE 

Other uses for Vagrant

thank you

i'm Justin.

 

@digitaldrummerj - digitaldrummerj@gmail.com

http://digitaldrummerj.me

Made with Slides.com