To install and configure KVM virtualization on Red Hat Enterprise Linux (RHEL) or CentOS 6.x, you can follow these steps:
sudo yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer
sudo systemctl enable libvirtd sudo systemctl start libvirtd
libvirt
group by running the following command:sudo usermod -a -G libvirt <username>
Replace <username>
with your username.
Log out and log back in for the group membership changes to take effect.
Verify that KVM is working by running the following command:
virsh -c qemu:///system list
You should see an empty list of virtual machines.
virt-install
command. For example, to create a new virtual machine with 2 CPU cores, 4GB of RAM, and a 20GB disk, you can use the following command:virt-install --name=centos7 --memory=4096 --vcpus=2 --disk path=/var/lib/libvirt/images/centos7.img,size=20 --cdrom=/path/to/centos7.iso --network bridge=br0 --graphics vnc --os-type=linux --os-variant=centos7.0 --noautoconsole
Replace centos7
with the desired name for the virtual machine, and /path/to/centos7.iso
with the path to the ISO image on the host machine.
To manage virtual machines using the graphical virt-manager
tool, you can launch it from the command line or by searching for it in the application launcher.