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
–name | The name you give to the VM |
–os-type | Windows, Linux, etc… |
–os-variant | Windows version, Linux distribution, etc.. |
–description | A short description of the VM |
–ram | The amount of RAM you wish to allocate to the VM |
–vcpus | The number of virtual CPUs you wish to allocate to the VM |
–disk | The location of the VM on your disk (if you specify a qcow2 disk file that does not exist, it will be automatically created) |
–cdrom | The location of the ISO file you downloaded |
–graphics | Specifies the display type |