The following tutorial will tech you how to create a virtual machine on Linux, first we are going to install the virtual machine tools.
Install and configure the virtual machine tools
Install the virtual machine tools grouped in @virtualization, some packages are: virt-manager, libvirt, qemu-kvm, etc. Source, full virtualization on fedora workstation linux.
sudo dnf install @virtualization
Edit the libvirtd configuration to enable a regular user the system administration privileges.
sudo vim /etc/libvirt/libvirtd.conf
Set the domain socket group ownership to libvirt.
unix_sock_group = "libvirt"
Adjust the UNIX socket permissions for the R/W socket.
unix_sock_rw_perms = "0770"
Start and enable the libvirtd service.
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
Add your user to the libvirt group.
sudo usermod -aG libvirt $(whoami)
Install the secure boot tool package
It is needed when you are configuring the virtual machine, windows 11 need it. To install run the following command.
sudo dnf install edk2-ovmf
Source, secure boot
Install TPM
We need to install the Software Trusted Platform Module Emulator it will be used when being customizing the virtual machine configuration, close virt-manager and got to the link below, download and install swtpm-tools-0.7.3-1.20220427gitf2268ee.fc36.x86_64.rpm, select according your distribution number, will select that for fedora 36 and today its the last version.
swtpm-tools rpm fedora centos redhat
Go to the directory where you downloaded the package and install it with dnf package manager.
cd Downloads
sudo dnf install ./swtpm-tools-0.7.3-1.20220427gitf2268ee.fc36.x86_64.rpm
Create a Pool to store the virtual machines
Before create a virtual machine first we will create a pool. A pool is a directory and you can use a partition for example. You can create the virtual machine in the default directory, but if you are thinking format your root directory in the future and want to preserve the virtual machine , save it in a new pool is a good option.
Source, new pool using a partition.
We will use a LVM partition forvm-vmtest and You do not need to mount the partition.
~
❯ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 447.1G 0 disk
└─sda1 8:1 0 100G 0 part
└─forvm-vmtest 253:0 0 100G 0 lvm
sdb 8:16 0 1.8T 0 disk
├─sdb1 8:17 0 839G 0 part /run/media/chris/New Volume
├─sdb2 8:18 0 27.9G 0 part
└─sdb3 8:19 0 93.2G 0 part
└─vg2-vms 253:1 0 93.2G 0 lvm
sdc 8:32 0 223.6G 0 disk
├─sdc1 8:33 0 100M 0 part /boot/efi
├─sdc2 8:34 0 16M 0 part
├─sdc3 8:35 0 100G 0 part
├─sdc4 8:36 0 123G 0 part /
└─sdc5 8:37 0 509M 0 part
sdd 8:48 1 0B 0 disk
sr0 11:0 1 1024M 0 rom
zram0 252:0 0 8G 0 disk [SWAP]
Select the QEMU/KVM drop-dawn tab then in the menu select Edit>Connection Details.
Click in the Storage tab, click in bottom left corner the Add Pool plus symbol button.
Type and select the following data.
In Name type any name you like, in my case vmtest.
In the type select fs:Pre-Formatted Block Device.
In target path, you can create a directory in your home or any place of your directory system it will be the mount point, if it doesn’t exist yet it will be created, in my case it will be mounted in my root "/" directory with the following name. /vmtest.
in Format auto.
In the source path, select the device partition, in my case can use /dev/mapper/forvm-vmtest or /dev/forvm/vmtest.
Click in Finish.
You can enable Autostart On Boot option of the new pool vmtest created if you like.
If the State of the pool is Inactive, click in the bottom left side the play button to start the pool. Click in Apply.
Create the windows 11 virtual machine
Click in the create a new virtual machine button.
Select Local install media, click in Forward.
Select the ISO image file, click in Browse, Click in Browse Local, select your windows 11 image iso file, click Open.
Enable automatically detect from the installation media. So far windows 11 is not an option there, but windows 10 option works fine for now. Then click in Forward.
Select the memory and cpu, its depent of your host machine capacity. For memory you can use 8192MiB which is equivalent to 8GiB, for cpu 2. Click Forward.
Enable storage for the virtual machine, select Select or Create custom storage, click in manage.
Select the new pool in my case vmtest, click in the plus symbol to Create a new volume . Its important to use as capacity a minimum value of 65GiB.
As name. you can use win11, in format qcow2, as capacity 65GiB.
Click in Finish.
Select the new created volume win11.qcow2, click in Choose Volume.
Then click Forward.
Fix the name to win11 if you like. Enable customize configuration before install, click Finish.
In the new window select in firmware option:
UEFI x86_64:/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd
Click the Apply button to save the current change.
In the left side bar, click in Boot options. In Boot device order enable SATA CDROM 1 and set that as the highest boot priority using the up arrow next to it.
Click Apply.
In the left side bar in the bottom click in Add Hardware, in the new window add a virtual TPM module, click in TPM, in Type select Emulated, click in Advanced options drop-dawn, in Model select CRB, in Version select 2.0. Click Finish.
Click the Apply button if you haven’t saved the changes yet.
Then in the top left corner click in Begin Installation button.
Installing Windows 11, soon the tutorial
Go to the web
Install Guest tools in the virtual machine
Install spice-guest-tools
After install the windows 11 virtual machine, you can install spice-guest-tools to enable copy and paste, drag and drop files from host to guest, and fix screen resolution.
Power on the virtual machine and from inside the windows 11 virtual machine, go to here and download spice-guest-tools and install inside the virtual machine.
Bonus: Enable Auto resize VM with window if it isn’t enable
If the Auto resize VM with window is not enable, you can install the latest virtio-win-guest-tools. Go to this direct link and download it, run it and install inside the virtual machine.
Top comments (1)
youtube.com/embed/0RiUrsljD_E