Create Vagrant Box

How to create a Vagrant Box from Existing VM

There are a many of amazing boxes out there available on vagrantcloud.com and other site, But there is still a need to build a custom box.
Maybe we want to add a few extra things to the customized base for example development tools or automation tools for QA team etc.and Instruction or ReadMe file for new employees ..
In this post, I will show you how to create own Vagrant package Box from an existing virtual machine.
let’s start.
Things you may need to pay attention:
* Make sure to install and configure the applications you need in the vagrant base Before you start package.
 
* Before you package the box make sure the Box as Small as possible:
   clean up disk space on the VM before we package it into a new Vagrant box
* Package the VM into a New Vagrant Box:
   Now we’re ready to package the box. I usually make a folder “MyBox” to hold my boxes.
   open command window in “MyBox” folder and type
vagrant package –base windows10 –output win10-v1.0
 
The process will shutdown and then export the VM first, then the package will be compressed and saved in the target folder.
 
* Delete and remove the Existing Virtual Machine
* Add the new Base box to vagrant file, use the following command:
vagrant box add windows10 d:\MyBox\win10-v1.0
 
You can get a list of available vagrant boxes from:
 
* built vagrant machines from the new Vagrant Base box.
create folder for each vagrant machine, then open command window, use the following command Initialize and boot Vagrant Box:
in this example I will create a two vagrant machine from windows10 base immage, so create DevPC1 and QAPC folders and use the following
command to Initialize and boot Vagrant Box:
vagrant init windows10
vagrant up
  
I hope this post will be useful to you. Email me at itmug.pro@gmail.com for corrections, additions,
or questions. Good luck!