Setting up Vagrant on Windows
You can install virtualbox and vagrant from the powershell command-line with the help of Powershell’s community repository, Chocolatey:
AnnouncementI have released my new course on Udemy, Kubernetes By Example. Sign up now to get free lifetime access!
1. Open up a powershell terminal (in admin mode)
2. Run the following to connect to the chocolatey library (you can skip this step if the “choco” command already works):
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
3. Now install vagrant, virtualbox, and cyg-get using the following command:
cinst virtualbox vagrant cyg-get
note: cinst is a an alias for “choco install”
Note: cyg-get is something we are installing as part of an intermediary step for installing openssh. We’ll cover more about this later.
4. Also install git-bash.
5. Check that similar folders to these have now been created:
- – VirtualBox : C:\Program Files\Oracle\VirtualBox
- – Vagrant : C:\HashiCorp\Vagrant\bin
- – cyg-get : C:\tools\cygwin and also: C:\tools\cygwin\bin
- – chocolatey : C:\ProgramData\chocolatey\bin
Notice that vagrant doesn’t get installed in your “program files” folder like other software do. The same is true for cyg-get.
10. Once you have located all these directories, you need to append all of them to the window’s path environment variable.
11. Close your powershell terminal and reopen it again in admin mode. This is so that your powershell loads in the newly edited path variable.
12. Verify that vagrant is installed correctly by running the following:
PS C:\Windows\system32> vagrant -v Vagrant 1.6.5
12. Verify that virtualbox is installed properly by running the following:
PS C:\Windows\system32> vboxmanage -v 4.3.12r93733
12c. Install the following components, but this time using the cyg-get command:
cyg-get openssh cyg-get rsync cyg-get ncurses
You are now ready to provision your first VM using vagrant.