How to install VirtualBox GuestAddition on a guiless CentOs

https://www.if-not-true-then-false.com/2010/install-virtualbox-guest-additions-on-fedora-centos-red-hat-rhel/

  1. sudo yum update kernel* -y
  2. mkdir /media/cdrom
  3. mount -r /dev/cdrom /media/cdrom
  4. sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
  5. sudo yum install gcc kernel-devel kernel-headers dkms make bzip2 perl -y
  6. KERN_DIR=/usr/src/kernels/uname -r
  7. export KERN_DIR
  8. cd /media/cdrom
  9. ./VBoxLinuxAdditions.run
  10. reboot