# Virtualization

## Tools

### VirtualBox

[VirtualBox](https://www.virtualbox.org/) is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use.

I use VirtualBox for development enviroments and to play around with various OS images all from my Windows laptop. It's free and open source and is just an easy way to get up and running with virtualization.

I'm not going to give a full blown how to on this because this info is all over the internet from blogs to videos. Just know that to learn about virtualization and infrastructure automation VirtualBox is a good option to create your virtual playground and lab environment.

### Vagrant

[Vagrant](https://www.vagrantup.com/) is an open source tool to create and configure lightweight, reproducible, and portable development environments.

Vagrant makes it drop dead simple to spin up virtual machines.

Add a Vagrant box from [Vagrantbox.es](http://www.vagrantbox.es/):

```
vagrant box add {name} {url}
```

Initialize a Vagrant file that describes your VM by calling init with the name of the Vagrant box:

```
vagrant init {name}
```

Then you can you can boot the VM with:

```
vagrant up
```

Um, how simple can it be?

### Packer

[Packer](https://www.packer.io/intro) is an open source tool for creating identical machine images for multiple platforms from a single source configuration.

We have VirtualBox as our container for virtual machines and we have Vagrant to manage their VM creation and bootup on VirtualBox. Now we need some Windows Vagrant boxes to work with. Unfortunately Windows 2012 is not on VagrantBox.es because of the license requirements and you really can't use someone else's box because you don't now how the license is configured, but since we can create boxes from our licensed copy we can create Vagrant boxes with Packer.

One of the great things about Packer is we can pre-install programs on the image with Chocolatey, Powershell, or basic shell commands. Generally, preinstalling software in images is frowned upon because it is hard to maintain the images with pre-installs, but since Paker automates image creation management and maintenance becomes a breeze (Oh the joy of automation.).

If you need to maintain multiple images for example: VirtualBox local development environment, VMWare pre-production environments and Azure production environments, this could be a nightmare. With Packer this scenario becomes no issue since Packer can build images for each virtualization platform in parallel from just one Packer template.

If you need to update the image, update pre-installed software, whatever... update the template and generate new images automatically.

As I said earlier, Packer can also create Vagrant boxes. It uses a post-processor to turn the Packer build artifacts into a box.

### Chocolatey

[Chocolatey](https://github.com/chocolatey/choco/wiki) is a global PowerShell execution engine using the NuGet packaging infrastructure. It is used to provide an easy and automatable way of installing applications and tools on Windows.
