KVM and Qemu

Starting to make use of my Ubuntu server for setting up virtual machines. I want to make a few notes on the commands used to set up guest VMs in KVM.

For a graphical interface, install Virtual Machine Manager, which can manage VMs locally, or connect to a remote server.

sudo apt install virt-manager

To list the available OS variants, use

osinfo-query os

To set up a Virtual Machine from the command line, what follows should give some examples;

In this instance I am setting up a machine to use for FOG Project, a free and open source system to image computers over a network.

virt-install –name=fogbox \
–os-type=Linux \
–os-variant=ubuntu20.04 \
–vcpu=1 \
–ram=4096 \
–disk path=/vms/fogbox.img,size=50 \
–graphics=spice \
–bridge=br0 \
–cdrom=/multimedia/software/ubuntu-20.04.3-live-server-amd64.iso

–nameThe name you give to the VM
–os-typeWindows, Linux, etc…
–os-variantWindows version, Linux distribution, etc..
–descriptionA short description of the VM
–ramThe amount of RAM you wish to allocate to the VM
–vcpusThe number of virtual CPUs you wish to allocate to the VM
–diskThe location of the VM on your disk (if you specify a qcow2 disk file that does not exist, it will be automatically created)
–cdromThe location of the ISO file you downloaded
–graphicsSpecifies the display type