Detailed Instructions are here : https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html ( for VMWare and VirtualBox and Hyoer-V in addiation to KVM )
Instructions sample configs and cloud-init files for on on-premises images: https://cdn.amazonlinux.com/os-images/2.0.20201111.0/
edit: this seems to work to get the latest files ( include the final slash ) https://cdn.amazonlinux.com/os-images/latest/
A google dork for older versions:
site:cdn.amazonlinux.com inurl:kvm inurl:os-images
( remove the kvm term to see images,etc for virtualbox, kvm-arm64 and other hypervisors)
KVM / qemu / virt-manager instructions -
Download 2 files - the seed.iso and then the actual OS disk image. The Seed.iso file is just for examples and you must generate a new one below with genisoimage. For KVM/qemu/virt-manager the OS file is currently named amzn2-kvm-2.0.20201111.0-x86_64.xfs.gpt.qcow2 Here: https://cdn.amazonlinux.com/os-images/2.0.20201111.0/kvm/
-
Download "SHA256sums" file containing sha256 sums and download shasums signature file ( .gpg )
-
check sha256sum with something like this:
grep \`sha256sum amzn2-kvm-2.0.20201111.0-x86_64.xfs.gpt.qcow2\` SHA256SUMS
-
add/import the AWS key: 0x11CF1F95C87F5B1A using for instance
$ wget https://cdn.amazonlinux.com/_assets/11CF1F95C87F5B1A.asc $ gpg --verbose --interactive --import 11CF1F95C87F5B1A.asc
-
validate signature on the shasum signature file ( SHA256SUMS.gpg ) with gpg
gpg --verify SHA256SUMS.gpg SHA256SUMS
If the sha256sum checks out and the signature file is "Good" then proceed: ( even if the key is 'not certified with a trusted.. ')
Create two simple local text configuration files named 'meta-data' and 'user-data' meta-data is network settings and user-data sets up the ec2-user username account.
See this link for default settings: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/amazon-linux-2-virtual-machine.html#amazon-linux-2-virtual-machine-prepare
Change the network settings to fit your local network IP addresses or DHCP.
Note - the 2 local text files act as a "data source" named NoCloud - Instead of getting IP addresses and usernames from AWS-EC2 or from DigitalOcean etc, they are be added to the text files by hand. See this: https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html
and the more intimidating version of that info here: https://cdn.amazonlinux.com/os-images/2.0.20201111.0/README.cloud-init
and finally - the whole list of potential cloud init data sources here - with some blah-blah about telling the guest OS about the host virt. platform: https://cloudinit.readthedocs.io/en/latest/topics/datasources.html
Generate your own ISO image named seed.iso from the data-source files named 'meta-data' and 'user-data' that you created: That is to say - run the genisoimage command below:
$ genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
Create a new vm in virt-manager
- Select Import existing disk image and use the qcow VM file ( amzn2-kvm-2.0.20201111.0-x86_64.xfs.gpt.qcow2 )
- "For OS type and Version, choose Linux and Red Hat Enterprise Linux 7.0 "
- Create a new CDROM custom storage
- Browse local and choose the generated seed.iso as the cdrom
- Begin Installation.
"After the VM has booted, log in using one of the user accounts that is defined in the user-data configuration file. " Disconnect the seed.iso after you log in supposedly
^Note:^ SSH password-auth is disabled. Unless you add an ssh-key to user-data then you will need to log-in via virt-manager directly to the console.