From Mageia wiki
Revision as of 10:25, 11 October 2017 by Inktvis75 (talk | contribs) (Shorewall)
Jump to: navigation, search


The virt-manager tool is a graphical frontend to manage KVM virtual machines. While it may not win any prizes for its graphical design, it's a very useful and powerful piece of software.

Installation

/bin/su -c "dnf install virt-manager"

or

/bin/su -c "urpmi virt-manager"

It will automatically pull all dependencies such as qemu-kvm

After that you have to enable the libvirt daemon at boot time:

systemctl enable libvirtd

Start this daemon with:

systemctl start libvirtd

Permissions

As a normal user you don't have the right permissions to do anything, and it's difficult to get them. First add yourself to the kvm group:

/bin/su -c "usermod -aG kvm $USER"

and create a file /etc/polkit-1/rules.d/50-libvirt.rules with the following content:

/* Allow users in kvm group to manage the libvirt
daemon without authentication */
polkit.addRule(function(action, subject) {
    if (action.id == "org.libvirt.unix.manage" &&
        subject.isInGroup("kvm")) {
            return polkit.Result.YES;
    }
});


Logout, and you are ready to create virtual machines

Virtual Machines in Home

If you want to create a storage pool in your home directory, you have to add permissions on your home directory for the kvm group

/bin/su -c "setfacl -m g:kvm:rwx $HOME"

Shorewall

If you have enabled the Shorewall firewall, traffic from the virtual machine will be blocked.

Edit /etc/shorewall/interfaces and add the following lines:

virt	     	virbr1  	detect			dhcp,routeback
virt		vnet+		detect			destonly

Edit /etc/shorewall/zones and add the following line:

virt	ipv4

Edit /etc/shorewall/policy and add the following line:

virt	all	ACCEPT  info
fw      virt    ACCEPT

Restart Shorewall:

/bin/su -c "shorewall restart"