For testing Kvm/qemu, prebaked images cloud images nice. However, there is a few steps to get started. We need a recent Qemu (2.5 is good enough). An EFI firmware are needed, and cloud-utils, for customizing our VM.
sudo apt install-y qemu qemu-utils cloud-utils
wget https://releases.linaro.org/components/kernel/uefi-linaro/ 15.12/RELEASE/QEMU64/QEMU_EFI.FD
wget https://cloud-images.ubuntu.com/xenial/current/ Xenial-server-cloudimg-arm64-uefi1.img
Cloud images are Plain-there is no user setup, no default USER/PW combo, so to log in to the image, we need to customize The image on the A-boot. The defacto tool is cloud-init. The simplest method for using Cloud-init is passing a blocks media with a settings file-of course to real Cloud Deployme NT, would use one of the fancy network based initialization protocols cloud-init. Enter the following to a file, say Cloud.txt:
#cloud-config
Users:
-name:you
ssh-authorized-keys:
-Ssh-rsa aaaab3nz ....
sudo: [' all= (All) Nopasswd:all ']
groups:sudo
Shell:/bin/bash
This minimal config would just set you a user with SSH key. A more complex setup can install packages, write files and run arbitrary commands on the In professional setups, your would most likely end-using cloud-init only to start ansible or another configuration Ement tool.
Cloud-localds cloud.img cloud.txt
qemu-system-aarch64-smp 2-m 1024-m virt-bios qemu_efi.fd-nographic \
-devic e virtio-blk-device,drive=image \
-drive if=none,id=image,file=xenial-server-cloudimg-arm64-uefi1.img \
-device virtio-blk-device,drive=cloud \
-drive if=none,id=cloud,file=cloud.img \
-netdev User,id=user0- Device Virtio-net-device,netdev=user0-redir tcp:2222::22 \
-ENABLE-KVM-CPU Host
If you are are on a X86 host and want to use QEMU to run a aarch64 image, replace the last line with "-cpu cortex-a57". Now, since the "example uses user networking with TCP port redirect," can ssh into the VM:
Ssh-p 2222 you@localhost
Welcome to Ubuntu 16.04 LTS (gnu/linux 4.4.0-22-generic) ...
.
Https://suihkulokki.blogspot.com/2016/05/booting-ubuntu-1604-cloud-images-on.html