Install VirtualBox Guest Additions on CentOS 8

You will need to carry out the following steps (as root) to install VirtualBox Guest Additions on a CentOS 8 Virtual machine and install it without any errors.
Open a terminal and update the Linux kernel with the following command:
dnf -y install kernel
Reboot the virtual machine:
systemctl reboot
Install kernel-headers, gcc, elfutils-libelf-devel, and other dependency packages that are necessary for CentOS 8:
dnf install kernel-headers-$(uname -r) kernel-devel-$(uname -r) elfutils-libelf-devel gcc make tar bzip2
Mount the Guest Addition CD Image: Go to the Devices menu and choose "Insert Guest Addition CD Image" from the menu.

Click on Cancel to close the window when asked: Would you like to run it?

Mount the CD Image to the /mnt
directory:
mount /dev/cdrom /mnt/
Execute VBoxLinuxAdditions.run
to run the VirtualBox guest additions installer:
sh /mnt/VBoxLinuxAdditions.run
After the process completes, restart CentOS by typing the systemctl reboot
command in the terminal console.
Guest Additions are a set of utilities and programs provided by VirtualBox to improve the overall performance of your guest operating system. Although CentOS Linux 8 can run without Guest Additions, Full-Screen mode, share folders, and other features are not available until you Install Guest Additions.