Linux KVM Libvirt Tutorial – POFTUT

Linux KVM Libvirt Tutorial


Hi today we are gonna look for managing vms especially in Linux with libvirt. Libvirt is a library and tools to manage vms. Lbivirt development is supported by Red hat and defacto tool in Linux world. In Linux Kvm/qemu is generally used for virtuulization but libvirt supports Xen, Virtualbox, Vmware, Hyperv too. To install and see info about the libvirt packet. As you see it is very little tiny packet and it install a daemon to control virtualization.

Install Libvirt Package

Debian, Ubuntu, Mint, Kali

libvirt is named as libvirt-daemon in distributions like Debian, Ubuntu, Mint and Kali.

$ sudo apt install libvirt-daemon

Fedora, CentOS, RedHat

$ sudo yum -y install libvirt

Disable SeLinux

Some security mechanisms can prevent or block running libvirt . One of them is SELinux. We can disable SELinux with the following setsebool command.

$ sudo setsebool false

Start Libvirt Daemon

We will start libvirt daemon to connect server with out client virsh

$ sudo systemctl start libvirtd

Check Libvirt Daemon Status

We will use systemctl status  command in order to check the libvirtdaemon status.

$ sudo systemctl status libvirtd
Check Libvirt Daemon Status
Check Libvirt Daemon Status

Connect To Libvirt with Virsh

As stated previously libvirt runs as a daemon. We can connect libvirt with the virsh tool. virsh provides bath and interactive console to manage KVM virtualization. We generally require root privileges to connect virsh.

$ sudo virsh

Add Normal User To Virtualization

If we want to connect  virshwith the normal user we need to add this user to the virtualization group like below. So this user can connect and use virtualization without a root privilege. kvm is the virtualization group name. So we will add user ismail to this group with the usermod command.

$ sudo usermod -a -G kvm ismail

 

Linux KVM Libvirt Tutorial Infographic

Linux KVM Libvirt Tutorial Infographic
Linux KVM Libvirt Tutorial Infographic

LEARN MORE  Virt Install Tool For Virtualization With KVM and Qemu For Linux

Leave a Comment