Create vagrant box from existing OS - clone

Is it possible to create vagrant box using working PC or server?
lets say I am running ubuntu 12.04. It contains variety of software (with different versions)
Can I create a vagrant box using that. I mean create vagrant box using existing PC.
Not downloading from anywhere. just make a copy of current OS and share with others.
then others can boot up same copy of my pc

It is possible by creating a physical to virtual image of your current machine. After that you need to import that image into your provider and create Vagrant box.
See this answer for more details.

Related

Boot vagrant box on an external drive (usb) with virtual box

I have Virtual box and a customized vagrant box. The thing is that my own laptop (Macbook) has only about 10 Gb of free space. So I bought a 128Gb USB Stick. Now I need to figure out a way to boot up vagrant boxes on this usb stick instead of the default hard drive of my laptop.
Almost all google articles explain how to boot up from the usb. But this is not what I exactly want. Have you ever been through such a situation?
any help would be appreciated!
you can do 3 things :
move your vagrant home directory with all the box on the USB stick (if you have many boxes, it will save some space)
you need to set $VAGRANT_HOME environment variable
move your VirtualBox VM to the USB stick; Open VirtualBox preferences panel and select the new default location folder for VMs. You would need to remove/re-add the VMs in VirtualBox after you moved all files to the external hard drive
You can use Linked Clones
By default new machines are created by importing the base box. For large boxes this produces a large overhead in terms of time (the import operation) and space (the new machine contains a copy of the base box's image). Using linked clones can drastically reduce this overhead.
Linked clones are based on a master VM, which is generated by importing the base box only once the first time it is required. For the linked clones only differencing disk images are created where the parent disk image belongs to the master VM.
It will not help for existing vagrant VM but for your new project, it will help to save space

How to access files stored in Virtual Machine from Host

I have a Mac OS X (10.11) virtual machine. But it has stopped working. It just about finishes loading the virtual machine and then just freezes on a black screen. Anyway, I wanna know if there is a way for me to recover the files on that virtual machine (Specifically Xcode files). They were not part of the shared folders so I'm not sure how to access them from the host (which is a windows 10).
One way to do this is to do the following:
Create another virtual machine with Ubuntu
Attached the virtual disk image (.vdi) or whichever format you chose to store the OSX image as a second HDD to the Ubuntu VM.
Follow these instructions to enable HFS+ read write in the Ubuntu virual image.
Another way to do it would be to use something like Arsenal Image mounter which supports direct mounting of a bunch of virtual image formats including VDI, VHD etc.

Vagrant / Oracle Virtual box / both host os and guest os are windows 7

We have a project it is based on Java 1.7, spring, hibernate. The development environment has many steps to install. So we decide to use Vagrant so that developer do no need to take time to setup developing environment. Our host OS normally is windows 7. And we would like to have our Virtual box Guest OS as windows 7 also since our developer are most familiar with windows OS. (Of course, we could switch to Linux). We could not find guest OS image (Guest OS: windows image for virtual box, 64 bit). Is guest OS of windows for virtual box commerical or do someone could point me the link for download?
Windows VMs can be a bit tricky, due to the licensing issues of it being non-free software.
Microsoft issues a set of VMs for situations such as yours, which can be found here: https://dev.windows.com/en-us/microsoft-edge/tools/vms/windows/
For your situation, it may be beneficial to create the machine once manually, and package it as a vagrant box and then distribute it to your dev team.
More information on this can be found in the Vagrant documentation: https://www.vagrantup.com/docs/virtualbox/boxes.html - "PACKAGING THE BOX"
(copied below for posterity)
PACKAGING THE BOX
Vagrant includes a simple way to package VirtualBox base boxes. Once
you've installed all the software you want to install, you can run
this command:
$ vagrant package --base my-virtual-machine
Where "my-virtual-machine"
is replaced by the name of the virtual machine in VirtualBox to
package as a base box.
It will take a few minutes, but after it is complete, a file
"package.box" should be in your working directory which is the new
base box. At this point, you've successfully created a base box!

Exporting Vagrant boxes from Linux to Windows

I'm using Windows as my main OS and Linux through Virtualbox for development. I would like to learn Vagrant and create a Linux box using it. After my new box is created using Vagrant, can I somehow export it to Windows so that I can use it without Vagrant? I mean can I start it straight from Windows' Virtualbox?

vagrant-coreos image drops shared folders in virtualbox 4.3.2 in OS X on reboot

Running this CoreOS image inside of Vagrant on Mac OS X, leveraging version 4.3.2 of VirtualBox.
When I start the image up I get the following error:
[default] No guest additions were detected on the base box for this VM! Guest
additions are required for forwarded ports, shared folders, host only
networking, and more. If SSH fails on this machine, please install
the guest additions and repackage the box to continue.
This is not an error message; everything may continue to work properly,
in which case you may ignore this message.
This is despite the fact that I am running VirtualBox on OS X, which doesn't appear to support guest additions.
Nonetheless, I am able to add shared folders manually via Settings -> Shared Folders, though these do not persist on image reboot even if I select Auto-mount and Make permanent.
This CoreOS image includes random reboots as part of its security policy, so I lose shared folders after the reboot, and am unable to regain it without nuking the image entirely and repaving.
Why is this happening?
#fox
CoreOS doesn't actually support the Virtualbox guest additions. Using these requires not only an additional Kernel module, but one which is not upstreamed into the Linux Kernel. We (CoreOS) worked with one of the Kernel developers to try and have this put into the staging kernel tree but there was too many problems with the code for this to be feasible.
The shared folder support that you are seeing is through a Kernel module provided by the Plan 9 filesystem (9pfs) which emulates a squashfs filesystem.
The reason that these are not persisting is the version of the CoreOS image that you are using at the moment. In your Vagrantfile, change the string amd64-generic to amd64-usr. This is a new development image that we are working on.
Additionally, make sure you run a git pull on the repository to ensure you have the most up to date copy of the files. There have been a number of changes since you posted the question and we would hate to see you miss out on them.
The VirtualBox guest additions must be installed in the guest OS, not on the host. My guess is that the warning comes after the CoreOS has been automatically upgraded with a new kernel, and the guest additions are not recompiled/reinstalled.
After the guest additions are reinstalled, you can just vagrant reload to remount the shared folders based on Vagrantfile.

Resources