I am starting with CentOS 7 minimal install, but the steps should work wherever you are starting.
In The Host OS
First you need to find the Virtual box guest additions iso. It’s harder to find than it should be. In the host OS (not in the CentOS VM) go to download.virtualbox.org/virtualbox and navigate to your version of VirtualBox
Download the VBoxGuestAdditions_[version].iso. (Mine is VBoxGuestAdditions_5.1.22.iso)
In the VirtualBox VM manager, load this iso into the optical drive of the CentOS VM. (Screenshot coming soon)
In The CentOS VM
Everything here needs to be done as root so either log in as root or put “sudo” in front of every command.
Update your system
Specifically you want to the latest kernel otherwise your VirtualBox modules might be built for the wrong kernel version:
Now reboot to make sure you are are running the latest kernel.
Get all the stuff required to build the VirtualBox Guest additions
yum groupinstall "Development Tools" yum install kernel-devel
You also need dkms from the epel repository
yum install epel-release yum install dkms
Install the guest additions
Make a place to mount the iso and then mount it.
mkdir /mnt/VBoxLinuxAdditions mount /dev/cdrom /mnt/VBoxLinuxAdditions
Run the install script
That’s it. If everything went well, you can now use the additional functionality provided by the VirtualBox Guest Additions.
If you find this site helpful, please consider supporting my efforts by clicking My Amazon Affiliate Link and buying whatever you would normally buy or maybe Try Amazon Prime 30-Day Free Trial