Red Hat / CentOS

Configuring the System kvm on centos 8

Configuring the System kvm on centos 8

Configuring the System kvm on centos 8

Kernel-based Virtual Machine (KVM in short) is an open-source and de facto standard virtualization solution that is tightly integrated into Linux. It is a loadable kernel module that turns Linux into a type-1 (bare-metal) hypervisor that creates a virtual operating platform used to run virtual machines (VMs).

Under KVM, each VM is a Linux process that is scheduled and managed by the kernel and has private virtualized hardware (i.e CPU, network card, disk, etc.). It also supports nested virtualization, which allows you to run a VM inside another VM.

Some of its key features include support for a wide range of Linux-supported hardware platforms (x86 hardware with virtualization extensions (Intel VT or AMD-V)), it provides enhanced VM security and isolation using both SELinux and secure virtualization (sVirt), it inherits kernel memory management features, and it supports both offline and real-time migration (migration of a running VM between physical hosts).

Before starting the explanation, please read this lesson

How to Install KVM on CentOS 8

How to Install KVM on CentOS 8

Configuring The System

Adding our user to [libvirt] group :

# useradd -G libvirt errorhatt
# passwd errorhat

Relogin or start a new bash session, Or execute :

 # newgrp libvirt 

Set system_DBus aliases instead of session_DBus :

# vim ~/.bashrc

add in file

alias virsh="virsh --connect 'qemu:///system'"
alias virt-install="virt-install --connect 'qemu:///system'"
alias virt-top="virt-top --connect 'qemu:///system'"
alias virt-clone="virt-clone --connect 'qemu:///system'"
alias virt-manager="virt-manager --connect 'qemu:///system'"
alias virt-viewer="virt-viewer --connect 'qemu:///system'"
 # source ~/.bashrc 

Set a bridged  network connection :

Attention, Use an ethernet cable .
Most wifi cards will get you into the promiscous_mode issue .

# echo 'BRIDGE=br0' >> /etc/sysconfig/network-scripts/ifcfg-ens3
# vim /etc/sysconfig/network-scripts/ifcfg-br0

add in file

# systemctl restart NetworkManager

= From now on, We should not configure [ens3] at all, We configure [br0] instead .
= [br0] is the master now while [ens3] is a member[slave] of it .

Enable port forwarding :

# echo 'net.ipv4.ip_forward = 1' >> /etc/sysctl.conf
# sysctl -p /etc/sysctl.conf

Final Words

Congratulations! You have finally Configuring the System kvm on centos 8 on your server. Let us know in the comments how you managed to do it and dont forget to share it with your colleagues.

About the author

jon snow

Jon is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, and currently a content creator for ERRORHAT who loves working with computers and strongly believes in sharing knowledge.

Add Comment

Click here to post a comment