Setting Up virt-manager on Fedora
In this post, I will be going through the installation and configuration process of virt-manager on Fedora. I will be doing this inside a clean installation of Fedora Workstation on a virtual machine inside Virtualbox from my Arch Linux installation.
Virt-manager is a graphical frontend that is used in conjunction with many different hypervisors, including QEMU/KVM, that directly interfaces with libvirt, shows VM details, console, allows for snapshots
Installing virt-manager
In order to install virt-manager, you need to run sudo dnf install @virtualization
. This will install not only the virt-manager package but also the whole virtualization group. By default, this includes the following packages
Mandatory Packages:
virt-install
Default Packages:
libvirt-daemon-config-network
libvirt-daemon-kvm
qemu-kvm
virt-manager
virt-viewer
Now, you should be able to start the virtualization service, using
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
start
actually starts the service and enable
makes sure to start the service every time the computer starts.
Now, you are ready to use KVM virtualization. However, in order to use libvirt (and therefore also virt-manager) without having to run everything with sudo
you should add your user to a specific group and change some permissions. If you edit /etc/libvirt/libvirtd.conf
with your favourite editor, such as
sudo vi /etc/libvirt/libvirtd.conf
Upon running this command, a large file should be displayed. If you scroll a bit down, you should see the section that has the header UNIX socket access controls
. In that section, you should do the following:
Uncomment unix_sock_group
by removing the #
at the beginning of the line. After removing the #
it should look like this
unix_sock_group = "libvirt"
Next, you should change the read/write permissions to 0770
by uncommenting the line
unix_sock_rw_perms = "0770"
The 0770
means that the only users on your PC that will have access to edit or create virtual machines are the owner and the group members. This means that everyone who is in the group libvirt
(the group we set before) will have access. Therefore, the next step is to add your user to the libvirt
group. This can be done using the command
sudo usermod -a -G libvirt <username>
where you should replace <username> with your UNIX username. In my case, this would be cfalas.
In order to apply these changes, you need to log out and log in again.
After logging in once again, we are ready to start using virt-manager
.
You will be able to find Virtual Machine Manager
when searching from the activities view (Press Window key and start typing Virtual Machine Manager).
When starting it, I was asked to enter my password. After entering my password, I was presented with a new window that said “libvirtd.service was found but is not running”. In order to connect virt-manager with KVM, you need to go from File->Add Connection->Connect
Now we are ready to add our first Virtual Machine:
If you click the icon circled in the image above (in the top left corner of the window, looks like a screen with a star), a new window pops up, which will guide us in making the Virtual Machine. It looks like this
We will choose the first option (Local installation media) since we will be using an ISO image file of Fedora. When you choose the first option you can click Forward.
Now is the time to choose what VM to install. I will be using a Fedora ISO image that I downloaded from getfedora.org. Next, you can choose how much RAM and how many CPUs should be available to the VM. Next, you choose the amount of storage the VM should have and where and how it should be stored. When you click finish, the VM will start.
Now, let’s look a bit more into the features of virt-manager and what they do.
On the top of the VM screen, there should be a toolbar. The first and second icon are a screen and a light bulb. The screen is selected, since you can see the screen of the VM. This is called the graphical console. The bulb will change what you see, and you will no longer see the VM. You will only see the hardware details, and you can make any changes. Most of these changes require a restart of the VM to have any effect. In the hardware details window, you should see a long list on the left and details about the selected item on the right. You can add or remove hardware using the buttons, and change any details.
Moving on, the next three buttons on the VM/hardware details window are used to change the power state (Play to start, Pause to suspend and save to disk, and the light switch to shut down).
Moving back to the main virt-manager window, we see some graphs that show CPU activity, disk I/O, and network I/O. These are real-time feeds of the activity of the components of the VM.