Setting up the CentOS 8KVM hypervisor and CentOS virtual machine

Setting up the CentOS 8KVM hypervisor and CentOS virtual machine

CentOS installation

Install the OS on the server machine by various methods We connect the display and mouse and install from the USB memory with GUI Server installation Allocate to / usr / local

network settings

Fixed IP 192.168.1.50/24
[root@centos8 ~]# nmcli connection modify ens3 ipv4.address 192.168.10.50/24
Default gateway 192.168.1.1
[root@centos8 ~]# nmcli connection modify ens3 ipv4.gateway 192.168.10.1

dns 192.168.1.1

[root@centos8 ~]# nmcli connection modify ens3 ipv4.dns 192.168.10.1
Fixed device
[root@centos8 ~]# nmcli connection modify ens3 ipv4.method manual
Reboot the configured device
nmcli connection up
Change host name (no reboot)
sudo hostnamectl set-hostname kvm.flownetsecure.com	

yum update

yum update

KVM installation

Install KVM and related packages
dnf update
dnf install @virt
dnf install virt-top libguestfs-tools
dnf install qemu-kvm libvirt virt-install
systemctl enable --now libvirtd
Create a bridge interface (br0)
nmcli con add type bridge ifname br0 con-name br0
Connection'br0' (ef4529c7-d511-4331-a193-8150e1ed707e)Was added successfully.
Display / confirmation of connection
# nmcli con show
NAME    UUID                                  TYPE      DEVICE
br0     ef4529c7-d511-4331-a193-8150e1ed707e  bridge    br0
enp2s0  c72c2593-0ddb-4cb1-93cb-5863cdd76c11  ethernet  enp2s0
virbr0  e18f2616-7c18-4cde-88d0-18dd8bcb1b86  bridge    virbr0
Set the IP address, gateway, and DNS in br0 (this will be the KVM address)
nmcli con mod br0 bridge.stp no
nmcli con mod br0 ipv4.method manual ipv4.address "192.168.10.51/24" ipv4.gateway "192.168.10.1" ipv4.dns 192.168.10.1
Create virtual bridge
nmcli con add type bridge-slave ifname eno1 con-name eno1-br0 master br0
nmcli con show
NAME      UUID                                  TYPE      DEVICE
br0       ef4529c7-d511-4331-a193-8150e1ed707e  bridge    br0
enp2s0    c72c2593-0ddb-4cb1-93cb-5863cdd76c11  ethernet  enp2s0
virbr0    e18f2616-7c18-4cde-88d0-18dd8bcb1b86  bridge    virbr0
eno1-br0  863898d3-004a-4fb4-ab5f-e83767bd6442  ethernet  --

eno1-br0 is added

Delete physical port
nmcli con del eno1
Reboot
reboot
nmcli con show
NAME                 UUID                                  TYPE      DEVICE
br0                  8f659364-cbe0-4c6e-8211-c3091e6c0942  bridge    br0
virbr0               f463bfbb-0030-4fd4-b42b-ccdf528e5718  bridge    virbr0
bridge-slave-enp2s0  45c0907e-6db7-41ae-a11d-763448dc36e0  ethernet  enp2s0

KVM completed!

Create a virtual machine on KVM

Creating a storage pool (storage location for virtual machine images)
# mkdir -p /var/kvm/images
Virtual machine installation
VM_NAME="compute-vm01"
virt-install
--name ${VM_NAME} 
--hvm 
--arch x86_64 
--os-type linux 
--os-variant centos8 
--vcpus 1 
--ram 8192 
--disk path=/var/lib/libvirt/images/${VM_NAME}.img,format=qcow2,size=284 
--network bridge=br0 
--graphics vnc,keymap=ja 
--noautoconsole 
--location /iso/centos82.iso 
--check all=off 
--extra-args ro
Starting install...

Installation will start

Without `` `--extra-args ro```, the following error will occur during virtual OS installation

The following error occurred during installation: Cancel the installation as it will result in a fatal error. DNF error: Error in POSTTRANS scriptlet in rpm package Kernel-core image.png

Browser connection to Cockpit of host OS (http://192.168.10.51:9090/)

image.png log in

Connect to the created virtual machine and continue installing the virtual machine OS

image.png

Virtual machine completed!

・ ・ ・ Excerpt from the construction memo, maybe there is something missing?

Recommended Posts

Setting up the CentOS 8KVM hypervisor and CentOS virtual machine
Bytecode and virtual machine
Set up a CentOS virtual server with Vagrant
[Ruby] Setting values ​​and memorandum for the table