Installation of KVM in Linux Machine & VM Centos - Ubuntu

technonotes-hacker - Oct 28 '23 - - Dev Community

KVM

Virtualization software in simple.

  1. Kernel-based Virtual Machine
  2. Is an open source virtualization technology built into Linux. Specifically, KVM lets you turn Linux into a hypervisor that allows a host machine to run multiple, isolated virtual environments called guests or virtual machines (VMs).
  3. KVM is part of Linux.
  4. KVM is faster than VMware because it does not need to translate the guest operating system into the host's native instructions. While VMware is more flexible than KVM because it can run more than just one operating system on a virtual machine.
  5. KVM can turn any Linux machine into a bare-metal hypervisor. This allows developers to scale computing infrastructure for different operating systems without investing in new hardware.
  6. Though KVM runs on Linux, it can run Windows VMs and Microsoft Hyper-V can host Linux VMs.

Image description

Below command should be > than 0.

egrep -c '(vmx|svm)' /proc/cpuinfo
free -h
Enter fullscreen mode Exit fullscreen mode

Image description

sudo apt install cpu-checker
Enter fullscreen mode Exit fullscreen mode

Image description

sudo kvm-ok
Enter fullscreen mode Exit fullscreen mode

Image description

sudo apt install -y qemu-kvm virt-manager libvirt-daemon-system virtinst libvirt-clients bridge-utils --> YES is passed inside the command so it will start the installation once you execute the command.
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

sudo systemctl enable –now libvirtd
sudo systemctl start libvirtd
sudo systemctl status libvirtd
sudo usermod -aG kvm $USER
sudo usermod -aG libvirt $USER
virt-manager
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Solution >> newgrp libvirt & reboot the PC
Enter fullscreen mode Exit fullscreen mode

Image description

Image description

Lets Install CENTOS & UBUNTU

CENTOS

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

  • Execute the below command in the target servers because if you take the clone of the target server , the machine name or IP should be same . To avoid this we need to execute the below commands.
echo -n > /etc/machine-id
rm /var/lib/dbus/machine-id
ln -s /etc/machine-id /var/lib/dbus/machine-id
Enter fullscreen mode Exit fullscreen mode

Image description

SSH Key Generation

Image description

Copy the ssh key to the target server

Image description

ssh-copy-id -i id_rsa.pub sathishpy1808@192.168.122.152
Enter fullscreen mode Exit fullscreen mode

Image description

UBUNTU

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

WAIT TILL THE INSTALLATION COMPLETES

Image description

Image description

  • Execute the below command in the target servers because if you take the clone of the target server , the machine name or IP should be same . To avoid this we need to execute the below commands.
echo -n > /etc/machine-id
rm /var/lib/dbus/machine-id
ln -s /etc/machine-id /var/lib/dbus/machine-id
Enter fullscreen mode Exit fullscreen mode

Image description

ssh-copy-id -i id_rsa.pub sathishpy1808_user@192.168.122.250
ssh sathishpy1808_user@192.168.122.250

Enter fullscreen mode Exit fullscreen mode

Image description

Image description

ERROR

https://askubuntu.com/questions/345218/virt-manager-cant-connect-to-libvirt

Image description

Reference

https://linux-kvm.org/page/Main_Page
https://www.youtube.com/watch?v=59XDojAsWH4

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player