The VirtualBox Guest Additions provides some device drivers and application for the optimization of performance and usability of Guest operating systems. It is installed inside the Guest operating system. So you need to install on each Virtual Machines running on your system.
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.
### On CentOS/RHEL 7 ### sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ### On CentOS/RHEL 6 ### sudo rpm -Uvh http://epel.mirror.net.in/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step 2 – Upgrade Kernel
Upgrade your system to use latest available kernel. To upgrade kernel just execute one of the followings commands on system terminal.
### On CentOS/RHEL 7/6 ### sudo yum update kernel* ### On Fedora 27/26/25/24/23/22 ### dnf update kernel*
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.
### On CentOS/RHEL 7/6 ### yum install make gcc perl dkms bzip2 kernel-headers kernel-devel ### On Fedora 27/26/25/24/23/22 ### dnf install make gcc dkms bzip2 perl kernel-headers kernel-devel
Step 4 – Setup Environment Variable
Set the KERN_DIR environment variable to kernel source code. In my case, latest kernel source is available in 2.6.32-504.3.3.el6.x86_64 directory under /usr/src/kernels/ .
sudo export KERN_DIR=/usr/src/kernels/`uname -r`
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.
sudo mount -r /dev/cdrom /media
Step 6 – Run Installer
Your system is ready to run the installer. Execute commands to install latest VirtualBox guest additions on your system.
cd /media sudo ./VBoxLinuxAdditions.run
Verifying archive integrity... All good. Uncompressing VirtualBox 5.2.8 Guest Additions for Linux........ VirtualBox Guest Additions installer Removing installed version 5.2.6 of VirtualBox Guest Additions... Copying additional installer modules ... Installing additional modules ... VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrong VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrong
All done. The latest VirtualBox guest additions package has been installed on your system.