Jump to content

Install KVM on CentOS 8.3


Cowboy Denny
 Share

Recommended Posts

Here are my notes on setting up KVM on a fresh install of CentOS 8.3 on a VMWare ESX host

SETTINGS

  • Ram: 8G
  • Disk: 50G

USER SETTINGS

  • root / SUPERMAN!

NETWORK SETTINGS (2 interfaces required)

  • IPADDR="10.11.24.20"
  • PREFIX="23"
  • GATEWAY="10.11.24.1"
  • DNS1="10.11.26.11"
  • DNS2="10.11.27.11"
  • DOMAIN="atic.eventguyz.com eventguyz.com"

 

As you go through the install choose:

Server with GUI

  • Container Management
  • Development Tools
  • Graphical Administration Tools
  • Headless Management
  • System Tools

1. Start with a clean install of CentOS 8.3
2. Add proxy to /etc/yum.conf and /etc/dnf/dnf.conf
3. CPU Support for Intel VT or AMD-V: cat /proc/cpuinfo | egrep "vmx|svm" OR RUN lscpu | grep Virtualization
4. sudo yum update
CHECK if its installed and running: sudo systemctl status libvirtd
5. sudo yum install @virt
6. VERIFY KERNEL MODS ARE LOADED: lsmod | grep kvm
7. TOOLS FOR MGMT: sudo dnf -y install virt-top libguestfs-tools
8. START KVM DAEMON: sudo systemctl enable --now libvirtd
9. INSTALL VIRT-MGR: sudo yum -y install virt-manager
10. CREATE NETWORK BRIDGE: sudo nmcli connection show

CREATE BRIDGE ON 2nd INTERFACE
nmcli connection show
nmcli connection delete e4014630-448b-5ad3-4992-f4678202147c
nmcli connection add type bridge autoconnect yes con-name br0 ifname br0
nmcli connection modify br0 ipv4.addresses 10.6.0.136/27 ipv4.method manual
nmcli connection modify br0 ipv4.gateway 10.6.0.129
nmcli connection modify br0 ipv4.dns 10.11.26.11 +ipv4.dns 10.11.27.11
nmcli connection delete ens224
nmcli connection add type bridge-slave autoconnect yes con-name ens224 ifname ens224 master br0
nmcli connection show
nmcli connection up br0
nmcli connection show br0
ip addr

VERIFY KVM INSTALLED
lsmod | grep kvm

HELPFUL TOOLS
dnf -y install virt-top libguestfs-tools

START/ENABLE KVM
systemctl enable --now libvirtd

MANAGE KVM VIRTUALS IN GUI
yum -y install virt-manager

dnf install virt-install virt-viewer libguestfs-tools
systemctl enable libvirtd.service
systemctl start libvirtd.service
systemctl status libvirtd.service

ip r

BEFORE
STP=yes
BRIDGING_OPTS=priority=32768
TYPE=Bridge
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=br0
UUID=b5a9dc97-ebd9-43aa-ba1f-88b308663a02
DEVICE=br0
ONBOOT=yes
IPADDR=10.6.0.136
PREFIX=27
GATEWAY=10.6.0.129
DNS1=10.11.26.11
DNS2=10.11.27.11

AFTER
STP=no
BRIDGING_OPTS=priority=32768
TYPE=Bridge
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=br0
UUID=b5a9dc97-ebd9-43aa-ba1f-88b308663a02
DEVICE=br0
ONBOOT=yes
IPADDR=10.6.0.136
PREFIX=27
GATEWAY=10.6.0.129
DNS1=10.11.26.11
DNS2=10.11.27.11
IPV6_DISABLED=yes 

systemctl restart NetworkManager.service

VERIFY
nmcli device

SET PROXY
vi /etc/wgetrc
use_proxy=yes
https_proxy = http://10.47.196.156:80
http_proxy = http://10.47.196.156:80
ftp_proxy = http://10.47.196.156:80

CREATE TEST INSTANCE
cd /var/lib/libvirt/boot/
wget --no-check-certificate https://mirrors.edge.kernel.org/centos/8/isos/x86_64/CentOS-8.3.2011-x86_64-boot.iso
wget https://mirrors.edge.kernel.org/centos/8/isos/x86_64/CHECKSUM
sha256sum --ignore-missing -c CHECKSUM

virt-install \
--virt-type=kvm \
--name centos8-vm \
--memory 1024 \
--vcpus=1 \
--os-variant=rhel8.1 \
--cdrom=/var/lib/libvirt/boot/CentOS-8.3.2011-x86_64-boot.iso \
--network=bridge=br0,model=virtio \
--graphics vnc \
--disk path=/var/lib/libvirt/images/centos8.qcow2,size=20,bus=virtio,format=qcow2

virsh dumpxml rhel8-server | grep vnc

You need to use an SSH client to setup tunnel and a VNC client to access the remote vnc VM display. Type the following SSH port forwarding command from your client/desktop:
ssh root@10.6.0.136 -L 5906:127.0.0.1:5906

List images
virt-builder --list
virt-builder --list | egrep -i 'debian|ubuntu'
virt-builder --list | egerp -i centos

virt-install \
--name fed29 \
--ram 1024 \
--vcpus 1 \
--disk path=/var/lib/libvirt/images/fed29.img,size=20 \
--os-variant fedora29 \
--os-type linux \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://fedora.inode.at/releases/29/Server/x86_64/os/' \
--extra-args 'console=ttyS0,115200n8 serial'

virt-install \
--name ubu-vm-01 \ 
--vcpus 2 \
--memory 2048 \
--disk size=8,bus=virtio,format=qcow2 \
--boot kernel=/var/lib/libvirt/images/kernel.ubuntu,initrd=/var/lib/libvirt/images/initrd.ubuntu \
--network bridge=br0 \
--graphics none \
--console pty,target_type=sclp \
--cdrom /var/lib/libvirt/images/ubuntu-17.10-server-s390x.iso

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...