• Tecnología
  • Equipo eléctrico
  • Industria de materiales
  • vida digital
  • política de privacidad
  • oh nombre
Localización: Hogar / Tecnología / Cómo instalar y configurar KVM en Debian 11 Bullseye Linux

Cómo instalar y configurar KVM en Debian 11 Bullseye Linux

techserving |
1340

KVM”, the abbreviation fo “Kernel Virtual Machine” is the hyperviso of the Linux kernel.Es bastante popular y se usa en empresas para realizar fácilmente la virtualización de los sistemas operativos. Here in this tutoial, we learn the steps and commands to install and enable KVM Hyperviso on Debian 10 o 11 Bullseye Server o Desktop Linux.

Desde 2007, KVM es un componente oficial del núcleo, sin embargo, en comparación con Xen, el otro hiperviso de código abierto, la histoia de KVM es menos cambiante y solo ha estado abundante desde el inicio..KVM también es el hiperviso preferido en OpenStack y, po lo tanto, se usa ampliamente en la nube.

¿Qué es exactamente KVM?

KVM no es principalmente un hiperviso de metal desnudo, sino que se basa en Linux.Podemos instalar utilizando algunos comandos en cualquier sistema operativo de Linux para convertirlo y usarlo como servido de virtualización.Po lo tanto, KVM es fomalmente un hiperviso tipo 2, lo que simplemente significa que se ejecuta en el anillo no privilegiado 3.Sin embargo, durante años los expertos han estado realizando una discusión histórica sobre si KVM es un hiperviso tipo 1 después de todo.

Podemos usarlo para ejecutar múltiples máquinas virtuales juntas en la misma máquina, sin embargo, el sistema de host debe admitir y tiene un Intel VT-X (extensión de tecnología de virtualización) o AMD-V (Amd64 Virtualization Extension) en su proceso respectivo.

¿Qué necesitamos seguir este tutoial?

• A machine suppoting virtualization
• Debian 11 Linux
• A user with sudo rights
• Internet connection

Also, Know – Install VirtualBox in Debian 11 Bullseye

Contenido

Pasos para instalar y habilitar KVM en Debian 11 Bullseye

Los comandos a continuación funcionarán tanto para Debian 10 Buster y Debian 11 Bullseye para configurar QEMU KVM y ejecutar una máquina virtual en él.

1. Confirm Virtualization suppot

Como al principio, dije, necesitamos un sistema con proceso Intel o AMD que tenga una extensión de virtualización habilitada.Po lo tanto, para confirmar que, en su Debian 11, abra el terminal de comando y ejecute los comandos dados:

egrep -c '(vmx|svm)' /proc/cpuinfo
grep -E --colo '(vmx|svm)' /proc/cpuinfo

As you run the above commands to confirm virtualization is enabled o not, the output will be moe than zero.Y si no, primero debe reiniciar su sistema e ingresar el BIOS del sistema.Habilite la virtualización y luego inicie el sistema operativo donde nuevamente ejecute el comando anterio para confirmar lo mismo.

The first command output will be greater than zero, this means it could be 1, 2, 6, o 8.Po lo tanto, el sistema admite la virtualización.

Using the second command you will get infomation about your CPU- whether it is Intel o AMD. If the red colo output text is VMX then it is Intel whereas SVM means AMD.

Output:

2.Ejecutar la actualización del sistema

Si ya ha ejecutado el comando de actualización, omita este paso, de lo contrario ejecutarlo una vez antes de moverse más allá para actualizar los paquetes instalados y reconstruir el caché del repositoio.

sudo apt update

3. Command to Install QEMU-KVM & Libvirt on Debian 11 Bullseye

El siguiente es el comando clave de este tutoial que descargará e instalará todo lo requerido para la instalación de QEMU, KVM Hyperviso y Libvirt en Debian 11 Linux.

sudo apt install qemu-kvm libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon

4. Virt-Manager GUI fo KVM

Those who are using Graphical Debian 11 Desktop can also install Virt-Manager, a graphical user interface developed by RedHat to create, manage and run virtual machines using KVM but graphically.

sudo apt install virt-manager -y

How to Install and Configure KVM on Debian 11 Bullseye Linux

5. Make Netwok active and auto-restart

Para enumerar la red disponible para usar en máquinas virtuales KVM, ejecute el siguiente comando:

sudo virsh net-list --all

Sin embargo, en la salida, verá que la red predeterminada no está activa y tampoco se establece para comenzar automáticamente con un reinicio del sistema.Po lo tanto, para hacerlo activo y AutoStart ejecute los siguientes comandos:

sudo virsh net-start defaultsudo virsh net-autostart default

Puede verificar la red nuevamente ...

6.Agregar "VHOST_NET"

To improve the perfomance of netwok data transfer and reduce the load of virtio-net, we can add vhost_net” kernel module in our Debian 11 Linux using the below-given command:

vhost-net is the backend (host side) whereas virtio-net (guest side) is the frontend running in the guest kernel space. To know moe about them see: Vhost-net & Virtio-netwoking

sudo modprobe vhost_net

Para verificarlo ha sido habilitado:

lsmod | grep vhost

—————————-This step is not Necessary Until you want it-———————————–

7. Create Bridge Netwok (optional)

Although the KVM comes with a bridge netwok interface called “virbr0″ setup out of the box, however, that won’t let us access the KVM virtual machine out of the host PC using some other computer in the netwok because of the IP range assigned by it.Po lo tanto, crearemos nuestra propia interfaz de puente completo sobre la NIC física del sistema de host que tendrá el rango IP de nuestra red.

Encuentre la interfaz de red física conectada a su sistema de host que desea usar para el puente.

ip a

Verá todas las interfaces de red adjuntas en su máquina host.Ahoa, tenga en cuenta el que desea usar para la red Bridge.

Fo example, here we have enps03 and the IP address is 192.168.0.109. Hence, the range is between 192.168.0.1-192.168.0.255

Ahoa, edite su archivo de interfaz de red Debian 11:

sudo nano /etc/netwok/interfaces

Agregue las siguientes líneas:

Note: Change the yellow values as per your netwok…

#Configure bridge and give it a static ipauto br0iface br0 inet staticaddress 192.168.0.100netmask 255.255.255.0netwok 192.168.0.1broadcast 192.168.0.255gateway 192.168.0.1bridge_pots enp0s3bridge_stp offbridge_fd 0bridge_maxwait 0dns-nameservers 8.8.8.8 4.4.2.2

Save the file by pressing Ctrl+O, hit the Enter key, and exit using Ctrl+X.

o

Note: If you want the bridge to get an IP address using DHCP:

Luego, en lugar de la configuración anterior, use esta:

## DHCP ip config file fo br0 ##auto br0 # Bridge setup iface br0 inet dhcpbridge_pots enp0s3

Restart the Netwok manager to apply the changes.

sudo systemctl restart netwoking.serviceosudo /etc/init.d/netwoking restart

Verifique la dirección IP

ip a

this time you will see your newly created br0 bridge interface along with others.

———————————————————————————————————————————

8.Crear máquinas virtuales utilizando la GUI Virt-Manager

Those who want to use the Virt command line to create virtual machines and run using KVM just follow the link.

Mientras que si está utilizando GUI Debian 11 Desktop puede usar el Virt-Manager.Dar una idea aquí es un vistazo ...

Run Virt-Manager

Go to the Application launcher and search fo “Virtual machine manager”(VVM) and run it. Befoe it opens, the system will ask to provide the root passwod.Esto le permitirá crear y administrar máquinas virtuales.

Create Virtual Machines:

Haga clic en el icono de la PC para crear una nueva máquina virtual en Virt-Manager usando KVM.

Locate ISO Media Volume

Click on the Browse button and then locate the ISO file you want to use fo installing an operating system on your virtual machine as guest OS.

After that uncheck the box is given fo “Automatically detect from the installation media/source” and then click on the Foward button.

Choose Memoy and CPU Settings

Set the amount of virtual memoy you want to assign to VM and then the number of CPU coes.

Create Qemu Virtual Disk Image

To install VM guest OS, we need some stoage space and fo that, we have to create a disk image file. Just enter the amount of hard disk space you want to assign and move foward.

Netwok

Nombra tu máquina virtual aquí. Also, by default, the Virt-manager will use the NAT, however, you can select Bridge interface either the default one i.e vibr0, o the one you have created. If you don’t know about these settings let the default NAT be selected.

Qemu KVM Virtual Machine on Debian 11 Bullseye

Finalmente, tendrá una máquina virtual arrancada que se puede controlar como cualquier computadora física usando un teclado y mouse.

Otros artículos:

• How to install VirtualBox hyperviso on Rocky Linux 8
• Install Qemu/KVM and Virt-Manager GUI on Ubuntu
• How to install and use Virt-Manager on Windows 10
• Install Clouds Windows 10 VM on Ubuntu with SNAP command