I recommend to install or upgrade VirtualBox latest version first. This tutorial is to help you with the installation of VirtualBox Guest Additions on Fedora 27/26, CentOS/RHEL 7/6.
Step 1 – Prerequisites
First of all, Enable the EPEL release yum repository on your Fedora, CentOS, or RHEL systems. Execute one of the below commands to enable yum repository.
Step 2 – Upgrade Kernel
Upgrade your system to use the latest available kernel. To upgrade kernel just execute one of the followings commands on system terminal. After upgrading the kernel, you must reboot your virtual machine.
Step 3 – Install Required Packages
You also need to install some additional packages on your system including kernel-headers and kernel-devel packages.
Step 4 – Setup Environment Variable
Set the KERN_DIR environment variable to the kernel source code. In my case, the latest kernel source is available in 2.6.32-504.3.3.el6.x86_64 directory under /usr/src/kernels/ . Make sure the configured directory exist with proper source code.
Step 5 – Mount Guest Additions Image
Mount the guest additions image CDROM on your system in read-only mode. Using below command this will be mounted on /media directory.
Step 6 – Run Installer
Your system is ready to run the installer. Execute commands to install the latest VirtualBox guest additions on your system. Output All done. The latest VirtualBox guest additions package has been installed on your system.