![libvirt kvm](https://i-blog.csdnimg.cn/blog_migrate/05fce51446f2067fc5dc656f0c24369e.png)
libvirt kvm
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.
今天您好,我们将寻求管理VM,尤其是在使用libvirtLinux中。 Libvirt是用于管理虚拟机的库和工具。 Linux世界中的Red hat和defacto工具支持Lbivirt开发。 在Linux中,Kvm / qemu通常用于虚拟化,但libvirt也支持Xen,Virtualbox,Vmware和Hyperv。 要安装并查看有关libvirt数据包的信息。 如您所见,它是一个很小的小数据包,它安装了一个守护程序来控制虚拟化。
安装Libvirt软件包 (Install Libvirt Package)
Debian,Ubuntu,Mint,Kali(Debian, Ubuntu, Mint, Kali)
libvirt
is named as libvirt-daemon
in distributions like Debian, Ubuntu, Mint and Kali.
在诸如Debian,Ubuntu,Mint和Kali的发行版中, libvirt
被命名为libvirt-daemon
。
$ sudo apt install libvirt-daemon
Fedora,CentOS,RedHat (Fedora, CentOS, RedHat)
$ sudo yum -y install libvirt
禁用SeLinux (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.
一些安全机制可以阻止或阻止运行libvirt
。 SELinux
就是其中之一。 我们可以使用以下setsebool
命令禁用SELinux。
$ sudo setsebool false
启动Libvirt守护程序 (Start Libvirt Daemon)
We will start libvirt daemon to connect server with out client virsh
我们将启动libvirt守护程序以将服务器与客户端virsh断开连接
$ sudo systemctl start libvirtd
检查Libvirt守护程序状态 (Check Libvirt Daemon Status)
We will use systemctl status
command in order to check the libvirt
daemon status.
我们将使用systemctl status
命令来检查libvirt
守护程序的状态。
$ sudo systemctl status libvirtd
![Check Libvirt Daemon Status](https://i-blog.csdnimg.cn/blog_migrate/f925fd5659571d3929db3cb2ca9c9575.png)
使用Virsh连接到Libvirt(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.
如前所述, libvirt
作为守护程序运行。 我们可以将libvirt与virsh
工具连接。 virsh
提供了浴和交互式控制台来管理KVM
虚拟化。 我们通常需要root
特权才能连接virsh。
$ sudo virsh
将普通用户添加到虚拟化 (Add Normal User To Virtualization)
If we want to connect virsh
with 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.
如果要将virsh
与普通用户连接,则需要将该用户添加到虚拟化组中,如下所示。 因此,该用户无需root特权即可连接和使用虚拟化。 kvm
是虚拟化组名称。 因此,我们将使用usermod
命令将用户ismail
添加到该组。
$ sudo usermod -a -G kvm ismail
Linux KVM Libvirt教程信息图 (Linux KVM Libvirt Tutorial Infographic)
![Linux KVM Libvirt Tutorial Infographic](https://i-blog.csdnimg.cn/blog_migrate/58145f7ea3ebe2eef183e6ac943b7488.png)
libvirt kvm