# A Quick Linux VM on Windows with Vagrant

## Overview

In [What is this "Linux", anyhow?](../../../what-is-linux/get-you-a-linux) we mention using Vagrant as a way to quickly configure a Linux **virtual machine** , and the [Raspberry Pi Kernel-o-Matic](../../../raspberry-pi-kernel-o-matic/overview) uses Vagrant to set up a VM for cross-compiling a custom Raspberry Pi kernel.

Vagrant is a software package designed to let you easily create disposable VMs from a library of freely-downloadable images and connect to them, all with a few simple commands in a terminal. The idea is that you can continue to run your desktop OS like Mac OS X or Windows 7 or whatever, but then make a tiny new Linux computer in a window that you can connect to whenever you need to run Linux software

Unfortunately this isn't quite as seamless on Windows machines as on GNU/Linux or OS X systems, but with a few minutes of effort you should be able to do this any time you feel like it:

![](https://cdn-learn.adafruit.com/assets/assets/000/023/466/medium800/hacks_hello_world.png?1424814791)

This is a brief guide to installing the three moving pieces needed to make this work well on a Windows machine:

1. Vagrant itself
2. VirtualBox to run virtual machines
3. msysGit, a Windows distribution of Git and some other Unix tools, for cloning git repositories containing Vagrant configurations and connecting to your new VM with SSH

# A Quick Linux VM on Windows with Vagrant

## Install Vagrant

First, [hit the Vagrant site](https://www.vagrantup.com/) and look for a "DOWNLOAD" button.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/468/medium800/hacks_vagrant_site.png?1424815673)

Click on the Windows installer link, and save the installer:

![](https://cdn-learn.adafruit.com/assets/assets/000/023/469/medium800/hacks_vagrant_download.png?1424815642)

Then run the installer. Default choices should be fine.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/470/medium800/hacks_vagrant_setup1.png?1424815763)

![](https://cdn-learn.adafruit.com/assets/assets/000/023/471/medium800/hacks_vagrant_setup2.png?1424815773)

![](https://cdn-learn.adafruit.com/assets/assets/000/023/472/medium800/hacks_vagrant_setup3.png?1424815786)

![](https://cdn-learn.adafruit.com/assets/assets/000/023/473/medium800/hacks_vagrant_setup4.png?1424815800)

![](https://cdn-learn.adafruit.com/assets/assets/000/023/474/medium800/hacks_vagrant_setup_finish.png?1424815825)

# A Quick Linux VM on Windows with Vagrant

## Install msysGit

Next, we'll install **msysGit** , which is a distribution of the [git version control system](http://git-scm.com/). Git isn't strictly necessary for working with Vagrant, but it provides a version of the Bash shell, SSH, and other tools we'll find helpful.&nbsp; Later on, if you have Git installed, you can use it to keep up to date with things like the [Kernel-o-Matic](https://github.com/adafruit/Adafruit-Pi-Kernel-o-Matic).

Info: 

Again, visit the&nbsp;[msysGit site](https://msysgit.github.io/) and look for a "Download" button.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/476/medium800/hacks_msysgit_site.png?1424816167)

Run the installer. Windows will likely ask you several times if you'd like to allow the installer to run and modify your system.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/477/medium800/hacks_git_setup.png?1424816264)

For most options, the defaults should be acceptable. You may want to select "Use Git from the Windows Command Prompt", but it shouldn't make any real difference for our purposes.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/478/medium800/hacks_use_git_from_windows_prompt.png?1424816349)

![](https://cdn-learn.adafruit.com/assets/assets/000/023/479/medium800/hacks_msysgit_line_endings.png?1424817422)

For convenience, you might want to choose "In the Quick Launch" and "On the Desktop" under "Additional icons".

![](https://cdn-learn.adafruit.com/assets/assets/000/023/480/medium800/hacks_msysgit_desktop.png?1424817548)

# A Quick Linux VM on Windows with Vagrant

## Install VirtualBox

Lastly, we need VirtualBox to actually _run_ the virtual machine we're going to configure. Head to [virtualbox.org](https://www.virtualbox.org/) and look for the [Downloads](https://www.virtualbox.org/wiki/Downloads) link, then find the Windows installer.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/481/medium800/hacks_virtualbox_site.png?1424817921)

![](https://cdn-learn.adafruit.com/assets/assets/000/023/483/medium800/hacks_vbox_download.png?1424817855)

As with Vagrant and msysGit, run the installer, and click through options. Defaults should be fine.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/484/medium800/hacks_vbox_setup.png?1424817878)

If all has gone well, you should be ready to start up a Vagrant box.

# A Quick Linux VM on Windows with Vagrant

## Run Bash and Fire up a New Vagrant Box

First, look for the Git Bash prompt provided by msysGit. It's probably on your desktop, but if you can't find it there, have a look in the Start Menu.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/485/medium800/hacks_git_bash.png?1424818894)

This is a version of Bash, which is a standard shell on GNU/Linux systems (for shell basics, [start here](../../../../what-is-the-command-line)). Fire it up and enter the following commands:

```auto
mkdir vagrant_demo
cd vagrant_demo
vagrant init hashicorp/precise32
```

![](https://cdn-learn.adafruit.com/assets/assets/000/023/486/medium800/hacks_start_making_vagrant_demo.png?1424818912)

You should now have a folder containing a basic `Vagrantfile`. (There's a [lot of documentation](http://docs.vagrantup.com/v2/vagrantfile/) on Vagrantfiles.)

Next, do `vagrant up`, which should download an image, set it up, and start a virtual machine running in VirtualBox. This will probably take a while.

![](https://cdn-learn.adafruit.com/assets/assets/000/023/488/medium800/hacks_vagrant_up_finished.png?1424819012)

![](https://cdn-learn.adafruit.com/assets/assets/000/023/489/medium800/hacks_vagrant_i_have_prompt.png?1424819044)

There you have it: A working Linux VM. What now? Well, you can:

- Continue with the [Getting Started section](https://docs.vagrantup.com/v2/getting-started/index.html) of the official Vagrant manual.
- Check out our ongoing series of introductory Linux tutorials:

  - [What is this "Linux", anyhow?](../../../../what-is-linux)
  - [What is the Command Line?](../../../../what-is-the-command-line)
  - [An Illustrated Shell Command Primer](../../../../an-illustrated-shell-command-primer)
  - [An Illustrated Guide to Shell Magic: Standard I/O & Redirection](../../../../basic-shell-magic/overview)
  - [An Illustrated Guide to Shell Magic: Typing Less & Doing More](../../../../an-illustrated-guide-to-shell-magic-typing-less-and-doing-more)

Once you're done with a machine, you can remove it with `vagrant destroy`.

If you're interested in trying other operating systems and configurations, [read the manual on boxes](https://docs.vagrantup.com/v2/boxes.html), then have a look at the [list of available boxes from HashiCorp](https://atlas.hashicorp.com/boxes/search) - you're not limited to these, but it's a good place to start.


## Featured Products

### Linux "Tux" Penguin - Skill badge, iron-on patch

[Linux "Tux" Penguin - Skill badge, iron-on patch](https://www.adafruit.com/product/553)
You hacked, modded or made something with Linux! Adafruit offers a fun and exciting "badges" of achievement for electronics, science and engineering. We believe everyone should be able to be rewarded for learning a useful skill, a badge is just one of the many ways to show and...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/553)
[Related Guides to the Product](https://learn.adafruit.com/products/553/guides)
### Linux "Tux" Penguin - Sticker

[Linux "Tux" Penguin - Sticker](https://www.adafruit.com/product/663)
You hacked, modded or made something with Linux! Adafruit offers a fun and exciting stickers to achievement for electronics, science and engineering. We believe everyone should be able to be rewarded for learning a useful skill, a sticker is just one of the many ways to show and share.<br...></br...>

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/663)
[Related Guides to the Product](https://learn.adafruit.com/products/663/guides)

## Related Guides

- [Adafruit Speaker Bonnet for Raspberry Pi](https://learn.adafruit.com/adafruit-speaker-bonnet-for-raspberry-pi.md)
- [Install bluez on the Raspberry Pi](https://learn.adafruit.com/install-bluez-on-the-raspberry-pi.md)
- [Living Ventriloquist Dummy with MONSTER M4SK Eyes](https://learn.adafruit.com/living-ventriloquist-dummy-with-monster-m4sk-eyes.md)
- [Use Apple HomeKit Devices with itsaSNAP and Adafruit IO](https://learn.adafruit.com/use-apple-homekit-devices-with-itsasnap.md)
- [An Illustrated Guide to Shell Magic: Typing Less & Doing More](https://learn.adafruit.com/an-illustrated-guide-to-shell-magic-typing-less-and-doing-more.md)
- [3D Printing on Diffraction Grating Sheets](https://learn.adafruit.com/3d-printing-on-diffraction-grating-sheets.md)
- [Contribute to CircuitPython with Git and GitHub](https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github.md)
- [Crayola Scented Candle](https://learn.adafruit.com/crayola-scented-candle.md)
- [LEGO Set Lighting](https://learn.adafruit.com/lego-set-lighting.md)
- [Adafruit Feather RP2040 with USB Type A Host](https://learn.adafruit.com/adafruit-feather-rp2040-with-usb-type-a-host.md)
- [Make Beautiful Fritzing Parts with kicad2fritzing](https://learn.adafruit.com/make-beautiful-fritzing-parts-with-kicad2fritzing.md)
- [Stand-alone programming AVRs using CircuitPython](https://learn.adafruit.com/stand-alone-programming-avrs-using-circuitpython.md)
- [Furby 2012 Teardown](https://learn.adafruit.com/furby-2012-teardown.md)
- [USB to Eurorack Power Supply](https://learn.adafruit.com/usb-to-eurorack-power-supply.md)
- [Dimmable Li-Ion Halogen Bike Light](https://learn.adafruit.com/dimmable-li-ion-halogen-bike-light.md)
