Qemu Guide

Hey you- read completely before u directly start to follow.

  • GUI

Install packages-

  1. virt-manager(GUI to manage VM)
  2. libvirtd (handler for VM’s such as qemu, xen, virsh, kvm, and so on)
  3. QEMU (a virtual machine emulator)

extras

there are some extra packages which might come in handy if virt manager is upset with you-

  1. ebtables (if u are getting prompt that this package conflicts with iptables, just type y and replace iptables with this.)
  2. dnsmasq (provides DNS server)

*just install them manually if u face errors later

If you don’t know how to install

Debian based- sudo apt install qemu (other packages come as dependens)
Arch - sudo pacman -S virt-manager libvirtd qemu

Configurations (run these commands in terminal)

  1. add libvirtd as a daemon and run at boot

  2. sudo systemctl start libvirtd

  3. sudo systemctl enable --now libvirtd

  4. set virsh (to avoid network errors)

  5. sudo virsh net-start default

  6. 6.sudo virsh net-autostart default

All set!

Reboot

and

launch virt-manager

from dmenu/rofi or whatever you use (if nothing then launch a terminal and type virt-manager and hit enter) Voila!



  • Cli

This is for people who wanna try harder and use command line instead,
this will provide no GUI unless u install virt-manager separately.

  1. install qemu

  2. create a disk file for ur new system
    qemu-img create -f raw <any name like diskfile/vmfile> <number of storage in gb for vm >G

    *if u created less, and wanna increase ur image size
    qemu-img resize <file name created earlier> +<number u wanna increase in gb>G
    like - qemu-img resize diskfile +10G
    same applies for reducing the filesize- replace the + sign with - sign.

  3. Converting to other formats (optional)
    qemu-img convert -f raw -O qcow2 <filename>.img <newname>.<newformat>
    *the iso image u going to use shouldn’t be mounted. if this is the case, first unmount it.

  4. Installing the OS (not using-1st we had to install to the disk we created)
    qemu-system-x86_64 -cdrom <path/to/iso> -boot order=d -drive file=<diskname from step 2>,format=raw -m <amount of memory in mb u want to allocate>M

    *Instead of -boot order=x, use -boot menu=on, if u want GUI installation medium instead of CLI

  5. Running the virtual system we installed
    qemu-system-x86_64 <diskname>

DONE

Note! - If the VM grabs your mouse pointer use Ctrl+Alt+g to release it otherwise your mouse might be trapped in the VM!

1 Like

Great guide kudos to u dude !!