On Thu, Apr 08, 2021 at 05:51:54PM -0400, Ajay Kumar wrote:
Hello members,
I would like to create virtual machine images with some pre-installed
software in a .*OVF/OVA* format. So that I can use these* OVF *images/templates
for any hypervisor to create a VM.
Do you have any suggestions or some available web scripts/links to do
this..?
Hi,
no, I'm not aware of any such online tools (let alone unlicensed). But if I
were to script this, I'd do it this way:
Prerequisites:
1) create your VM image with a disk type RAW (can be QCOW2 as well, but you'd
then have to use different steps for conversion) for example you could download
one of them cloud images and use libguestfs tools to remove the cloud-init part
2) get a fedora machine (I tried it on Fedora only) - a VM is fine
On ^that Fedora machine:
3) install RPM fusion repo
4) install the VirtualBox-server package
5) upload your RAW disk image created in step 1) to this machine
6) convert the RAW image to VDI which virtualbox understands:
$ VBoxManage convertfromraw <yourimage>.raw <outputpath> --format VDI
7) create a dummy VM object
$ VBoxManage createvm --name dummy --register
8) attach a storage controller to ^this dummy VM
$ VBoxManage storagectl dummy --name dummycontroller --add scsi
9) attach the converted VDI disk to the dummy VM object
$ VBoxManage storageattach dummy --storagectl dummycontroller \
--medium <path_to_VDI> \
--port 1 \ # this can be arbitrary number
--type hdd
10) export the dummy machine as OVA
$ VBoxManage export dummy --output <filename>.ova
I mean, quite a few hoops to jump, but like I said, I have no knowledge of
opensource tools that could do it in one step, but at least the ^above can
all be automated (you'll have to look for more sensible settings to VBoxManage
though) and I myself would most likely going with something like that.
If you don't need automation, just use the virtualbox GUI to import the raw
disk and export the machine in OVA.
Regards,
Erik