Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible for Vagrant to use an OS .ISO install image directly/or create a Vagrant box from an ISO on the fly?

Tags:

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:

  • http://www.practicalweb.co.uk/blog/12/10/16/how-build-centos-6-base-box-vagrant
  • http://pyfunc.blogspot.co.uk/2011/11/creating-base-box-from-scratch-for.html

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.

like image 375
therobyouknow Avatar asked Mar 06 '13 09:03

therobyouknow


People also ask

How do I install vagrant boxes?

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.

What is vagrant base box?

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.


1 Answers

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.

like image 126
Ken Barber Avatar answered Oct 02 '22 16:10

Ken Barber