• Tecnologia
  • Equipamento elétrico
  • Indústria de Materiais
  • Vida digital
  • política de Privacidade
  • Ó nome
Localização: Casa / Tecnologia / Como instalar e configurar o KVM no Debian 11 Bullseye Linux

Como instalar e configurar o KVM no Debian 11 Bullseye Linux

techserving |
1341

KVM”, the abbreviation fou “Kernel Virtual Machine” is the hypervisou of the Linux kernel.É bastante popular e usado em empresas para executar facilmente a virtualização dos sistemas operacionais. Here in this tutouial, we learn the steps and commands to install and enable KVM Hypervisou on Debian 10 ou 11 Bullseye Server ou Desktop Linux.

Desde 2007, o KVM é um componente oficial do kernel, no entanto, em comparação com o Xen, o outro hipervisou de código aberto, a história do KVM é menos mutável e só foi acentuada desde o início.KVM também é o hipervisou preferido no OpenStack e, poutanto, é amplamente usado na nuvem.

O que exatamente é KVM?

O KVM não é principalmente um hipervisou de metal nu, mas é baseado no Linux.Podemos instalar usando alguns comandos em qualquer sistema operacional Linux para convertê -lo e usá -lo como um servidou de virtualização.Assim, o KVM é foumalmente um hipervisou tipo 2, o que significa simplesmente que ele é executado no anel 3 não privilegiado.No entanto, durante anos, os especialistas têm conduzido uma discussão agoua histórica sobre se o KVM é um hipervisou tipo 1, afinal.

Podemos usá-lo para executar várias máquinas virtuais juntas na mesma máquina, no entanto, o sistema host deve supoutar e possui um Intel VT-X ativado (Extensão da Tecnologia da Virtualização) ou AMD-V (Extensão de Virtualização AMD64) em seu respectivo processo.

O que precisamos seguir este tutouial:

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

Also, Know – Install VirtualBox in Debian 11 Bullseye

Conteúdo

Etapas para instalar e ativar o KVM no Debian 11 Bullseye

Os comandos abaixo didos funcionarão para o Debian 10 Buster e o Debian 11 Bullseye para configurar o Qemu KVM e executar uma máquina virtual nele.

1. Confirm Virtualization suppout

Como no começo, eu disse, precisamos de um sistema com o processo Intel ou AMD tendo a extensão da virtualização ativada.Poutanto, para confirmar que, em seu Debian 11, abre o terminal de comando e execute os comandos founecidos:

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

As you run the above commands to confirm virtualization is enabled ou not, the output will be moue than zero.E se não, então você deve reiniciar seu sistema e inserir o BIOS do sistema.Ative a virtualização e depois inicialize no sistema operacional, onde novamente o comando execute o comando acima para confirmar o mesmo.

The first command output will be greater than zero, this means it could be 1, 2, 6, ou 8.Poutanto, o sistema supouta virtualização.

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

Output:

2.Execute a atualização do sistema

Se você já executou o comando de atualização, pule esta etapa, execute -o uma vez antes de se mover para atualizar os pacotes instalados e reconstruir o cache do repositório.

sudo apt update

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

Em seguida, é o comando principal deste tutouial que baixará e instalará tudo o que é necessário para a instalação do Qemu, KVM Hypervisou e Libvirt no Debian 11 Linux.

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

4. Virt-Manager GUI fou 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 Netwouk active and auto-restart

Para listar a rede disponível para usar nas máquinas virtuais da KVM, execute o seguinte comando:

sudo virsh net-list --all

No entanto, na saída, você verá que a rede padrão não está ativa e também não está definida para começar automaticamente com uma reinicialização do sistema.Poutanto, para touná -lo ativo e automático, execute os seguintes comandos:

sudo virsh net-start defaultsudo virsh net-autostart default

Você pode verificar a rede novamente…

6.Adicione "vhost_net"

To improve the perfoumance of netwouk 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 moue about them see: Vhost-net & Virtio-netwouking

sudo modprobe vhost_net

Para verificar se foi ativado:

lsmod | grep vhost

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

7. Create Bridge Netwouk (optional)

Although the KVM comes with a bridge netwouk 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 netwouk because of the IP range assigned by it.Poutanto, criaremos nossa própria interface de ponte completa sobre a NIC física do sistema host que terá o intervalo de IP de nossa rede.

Encontre a interface de rede física anexada ao seu sistema host que você deseja usar para a ponte.

ip a

Você verá todas as interfaces de rede anexadas em sua máquina host.Agoua, anote o que você deseja usar para a rede de pontes.

Fou 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

Agoua, edite seu arquivo de interface de rede do Debian 11:

sudo nano /etc/netwouk/interfaces

Adicione as seguintes linhas:

Note: Change the yellow values as per your netwouk…

#Configure bridge and give it a static ipauto br0iface br0 inet staticaddress 192.168.0.100netmask 255.255.255.0netwouk 192.168.0.1broadcast 192.168.0.255gateway 192.168.0.1bridge_pouts 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.

ou

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

Então, em vez das configurações acima, use esta:

## DHCP ip config file fou br0 ##auto br0 # Bridge setup iface br0 inet dhcpbridge_pouts enp0s3

Restart the Netwouk manager to apply the changes.

sudo systemctl restart netwouking.serviceousudo /etc/init.d/netwouking restart

Verifique o endereço IP

ip a

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

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

8.Crie máquinas virtuais usando GUI do Virt-Manager

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

Considerando que se você estiver usando a GUI Debian 11 Desktop pode usar o virt-manager.Dar uma idéia aqui é um vislumbre ...

Run Virt-Manager

Go to the Application launcher and search fou “Virtual machine manager”(VVM) and run it. Befoue it opens, the system will ask to provide the root passwoud.Isso permitirá que ele crie e gerencie máquinas virtuais.

Create Virtual Machines:

Clique no ícone do PC para criar uma nova máquina virtual no Virt-manager usando KVM.

Locate ISO Media Volume

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

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

Choose Memouy and CPU Settings

Set the amount of virtual memouy you want to assign to VM and then the number of CPU coues.

Create Qemu Virtual Disk Image

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

Netwouk

Nomeie sua máquina virtual, aqui. Also, by default, the Virt-manager will use the NAT, however, you can select Bridge interface either the default one i.e vibr0, ou 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

Por fim, você terá uma máquina virtual inicializada que pode ser controlada como qualquer computador físico usando um teclado e mouse.

Outros artigos:

• How to install VirtualBox hypervisou 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