2

I want to completely automate creating a VM in Windows Hyper-V, starting from the Ubuntu Server v20.04 Server ISO image. I can create a PowerShell script to define and start the VM, and when I open a terminal the new server is running the installer and waiting for me to select a Language. I would like to to use the new v20 "autoinstall config" feature to answer the prompts and complete the installation, but since I am on Windows, I cannot see how to use the Autoinstall Quick Start instructions.

Since Hyper-V does not let specify the 'kvm' command, is this even an option? Do I need to create my own Ubuntu ISO containing the config file I want to use? It looks I would run into similar issues trying to use the old debian-installer preseed files, but this that something I should be considering? Any help or direction would be appreciated, thanks.

Steve
  • 131

1 Answers1

0

Is network booting an option?

I see two possibilities. I assume you don't want to create new ISO every time something changes in autoinstall.

First one is to setup PXE boot environment. It pays off long term if you are installing a lot. To get started with that you can check my step by step guide here: https://askubuntu.com/a/1292097/1080682

Second one is to make an ISO. But just with basic user-data (autoinstall) that points installer to - download new (current) script! That way you keep small web server with scripts somewhere, and when you want to change script, no need to change boot ISO media. To get you started with this idea, you can check my other post here: https://askubuntu.com/a/1292607/1080682

Both guides are based on PXE, but you can use the second one in other approach as well.

As for creating your custom ISO, you don't have to do much. Just making multi-boot ISO that contains Ubuntu and some bootloader like syslinux (actually isolinux variant for ISO media), then in kernel parameters just input same thing you'd input for PXE. Again you can check my guide (first link) to see how it's done with syslinux menu, as syslinux/pxelinux/isolinux are all just variants of the same family, so they act and configure in same way, you just swap the binaries according to your needs.

I am interested in other answers/options as well, maybe I missed something. I too work with Hyper-V and Ubuntu VMs, and I'd sure welcome an even easier way. But in my current situation - I just use PXE server and push new installs from it.

NOTE: If your environment already has SCCM and/or WDS - you can PXE boot Ubuntu from them as well! Push me a comment if you want that, and I'll provide you with a guide. It's 90% done just didn't get to finish and post it somewhere (yet).

pbr
  • 248
LuxZg
  • 547
  • have you completed the other 90% of the guide? :-) – pbr Jul 02 '21 at 03:32
  • @pbr unfortunately I never did finish WDS in nice and written form :( I wanted it to be step by step in details like other ones, but never did get time to do the writing, proofing, testing etc. It involves some un-Microsoft ways, adding PXElinux, and editing approved clients. I do have a nice system in production with other Linux distro, PXE booting from MS environment (DNS, DHCP, WDS, AD) and being managed by PHP web frontend (on IIS, with small MySQL DB, and some Powershell magic, SSL via phpseclib, etc), but I didn't even get to complete documentation for the production site :(( – LuxZg Dec 07 '21 at 11:05