QEMU and virt-manager setup

This is a brief tutorial to help install QEMU and virt-manager to run different OS's in a virtual environment.

In preparation download your ISO files for Linux, utilities or Raspberry Pi etc.

Install the required packages.

sudo apt install -y qemu-kvm libvirt-daemon-system virt-manager

Log out and back in again, otherwise you get an error in virt-manager.

virt-manager-no-access-before-logout

Run Virtual Machine Manager from the menu or run virt-manager from the terminal window.

Optional: Move default disk location to a different disk

You can either add a new pool or replace the default pool.

If you add a new storage pool then you will have to remember to use it when creating volumes.
Otherwise, if you replace the default pool then virt-manager will automatically use it.

It is suggested that you recreate the default pool and move VMs onto a separate volume and not store them on the root partition.

I have a separate disk /data and have created two folders:

/data/vm - To store VMs
/data/iso - To store ISO files

Edit->Connection Details->Storage

Stop and delete the default storage pool.

Add new storage pool, give it a name, e.g. default.

add-storage-1-name

Set the Target Path to /data/vm.

add-storage-2-target-path

You now have a new default storage pool.

Set it to autostart on boot and Apply and close the Connection Details Window.

Now we are in a position to create a new VM.

Click on the Create New Virtual Machine icon or New->Virtual Machine.

Keep the default, Local install media (ISO Image or CDROM).

new-virtual-machine-1-media

Select Use ISO image.

Click on Browse, then click on Browse Local and locate your ISO.

new-virtual-machine-2-browse-iso

Specify the amount of memory and CPU to give the new VM.

new-virtual-machine-3-mem-cpu

Specify the disk size.

new-virtual-machine-4-disk

Give your new VM a meaningful name (this is used for the file names as well).

new-virtual-machine-5-name

Either click Finish and your VM will automatically start or click Customise configuration before install to alter any additional settings.

If the screen goes blank in the VM then choose Send Key->Ctrl+Alt+Backspace to view the boot messages.

After a while you should see your desktop in the VM.

From there, dependant upon what ISO you are running you can continue to install your OS etc.

2 Likes