I've been asked a few times about running virtual machines on the ARMv8 AArch64 platform, so it may be time to document the procedure.
There are a few packages you'll need to make this happen, so lets install them first. The AAVMF package is the one noticeable difference between AArch64 and x86_64. It contains the needed UEFI loaders for the vm to function properly.
[root@aarch64 ~]# yum install NetworkManager libvirt libvirt-daemon virt-install qemu-img-ev qemu-kvm-ev AAVMF
Most users will want a bridged network, so we need to create one. I find it easiest (and safest) to do this with nmcli from the local console, but you're free to do it however you wish. The commands below will remove the default eth0 interface configuration, create a bridge, and add eth0 to that bridge. Once that's done, we start up the libvirt daemon and make sure it starts on boot.
[root@aarch64 ~]# nmcli con delete eth0
[root@aarch64 ~]# nmcli con add type bridge ifname br0 stp no
[root@aarch64 ~]# nmcli con add type bridge-slave ifname eth0 master br0
[root@aarch64 ~]# systemctl enable libvirtd
[root@aarch64 ~]# systemctl start libvirtd
Now that we have our bridge enabled and libvirtd is running, we can create our virtual machine. I use the virt-install command below to initialize a vm with 2 gigs of ram, and 10G of disk space via a kickstart install. Example kickstarts for various tasks will be published soon at https://github.com/CentOS/AltArch
virt-install --name centos-7-aarch64 \
--initrd-inject kickstart.ks \
--extra-args "ks=file:/kickstart.ks" \
--memory 2048 \
Once the installation is complete, the system will reboot and the vm will be ready to use. A quick virsh list will show that the guest vm is active, and a virsh console will give you console access to the vm, just as you'd expect on an x86_64 system.
[root@aarch64 ~]# virsh list
Id Name State
3 centos-7-aarch64 running
[root@aarch64 ~]# virsh console centos-7-aarch64
CentOS Linux 7 (AltArch)
Kernel 4.2.0-0.29.el7.1.aarch64 on an aarch64
Finally, once we're done playing around with the image, there's a slight bit of extra work required to remove it. Because the aarch64 images have an nvram specification we need to be sure to pass that information on to virsh, otherwise the undefine command will fail with an nvram error. The command example below shows how to delete the vm, including the disk image.
[root@aarch64 ~]# virsh undefine centos-7-aarch64 --remove-all-storage --nvram
Domain centos-7-aarch64 has been undefined
Volume 'vda'(/var/lib/libvirt/images/centos-7-aarch64.qcow2) removed.
That's all there is to it. From here, you can use virsh or any of the other vm management tooling as you ordinarily would. The dark days of manually specifying AAVMF loader locations are behind us, as libvirt handles it all with ease now.