Is it possible to automate the creation of a Vagrant .box file for an OS install, from the original ISO?
To me, this is a significant gap in the end-to-end automation of Operating System install and configuration on a Virtual Machine that Vagrant provides.
Sure, VagrantBox.es provides many base .box OS install files for usage. But some are from third party suppliers and not from the original OS distribution maker. For example Arch Linux: Arch Linux 64 (2012-07-02) http://vagrant.pouss.in/archlinux_2012-07-02.box
Not wanting to be negative about the efforts of third-party suppliers, but some organisations may want the original install image from the original OS provider (e.g. for the Arch example above, this would be: https://www.archlinux.org/download/ ). Reasons for wanting original install image would be security (as it would not be possible to verify the third party image for security compromises and malware) and getting the image as the original suppliers intended without extra stuff not required. Another reason would be to take advantage of new releases direct from the original supplier and not have to wait for a third party to release it as a Vagrant .box
There are guides for creating a .box file from a .ISO image:
But these are manual steps - which goes against the philosphy behind Vagrant of automation and consistency. Especially if many want to achieve the end goal of being able to use the original - this would end up with duplicate effort on everyone's part.
So I would be looking here from a definitive answer that describes how to make a generic automation script to convert a .ISO OS install image into a Vagrant box.
Vagrant will prompt you to select a provider. Type 2 and press Enter to select Virtualbox. This will download the box named hashicorp/bionic64 from HashiCorp's Vagrant Cloud box catalog, where you can find and host boxes. Boxes are globally stored for the current user.
Boxes are the package format for Vagrant environments. A box can be used by anyone on any platform that Vagrant supports to bring up an identical working environment. The vagrant box utility provides all the functionality for managing boxes.
I think VeeWee provides a great mechanism for preparing a Vagrant box from an ISO:
https://github.com/jedi4ever/veewee
It already provides a lot of out-of-the-box templates for most distributions, which you can customize if required (although this is often not needed). Alternatively you can create your own definitions.
Alternatively you can use Packer:
https://packer.io/
Which is produced by the same company that makes Vagrant, so it has fairly good integration. Packer itself doesn't provided sample templates I believe, but you can use the ones Puppet Labs uses for its own testing purposes if you like:
https://github.com/puppetlabs/puppetlabs-packer
This can be used as a solid base for your own templates and modified to taste, or you can raise a PR on the project to contribute back if desired.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With