How to Install VirtualBox Guest Additions on CentOS 8

When you first install a virtual machine with a GUI on VirtualBox, the screen size is usually scaled-down and the user experience is usually quite bland. To improve the appearance and functionality of a virtual machine, VirtualBox provides a set of software packages and drivers known as VirtualBox guest additions in the form of an ISO image known as VBoxGuestAdditions.iso. The image is then mounted onto the guest system and the guest additions are thereafter installed.
The VirtualBox guest additions enable the functionalities listed below:

  • Improved the graphical display/appearance.
  • Mouse pointer integration between the host and guest machine.
  • Shared folders between the host and guest system.
  • Copy & paste and cut & paste functionality between the host and the guest system.

Requirements

VirtualBox guest additions can be installed on both Linux and Windows systems. In this guide, we will walk you through the installation of VirtualBox guest additions on CentOS 8.

Step 1: Installing EPEL on CentOS 8

To start off, begin by installing the EPEL repository, in short for Extra Packages for Enterprise Linux, which is a repository that provides extra open-source software packages for RedHat flavors such as CentOS and Fedora.

To install the EPEL repository on CentOS 8, run the following dnf command on the terminal.

$ sudo dnf install epel-release
Install Epel in CentOS 8

Install Epel in CentOS 8

Once installed, confirm the version installed by running the command.

$ rpm -q epel-release
Confirm EPEL Repository

Confirm EPEL Repository

Step 2: Installing Kernel Headers and Build Tools

With the EPEL repository installed, proceed and install the kernel headers and build tools required to install the guest additions as shown.

$ sudo dnf install gcc make perl kernel-devel kernel-headers bzip2 dkms
Install Kernel Headers in CentOS 8

Install Kernel Headers in CentOS 8

Once installed, confirm that the version of kernel-devel corresponds to the version of your Linux kernel by running these commands:

$ rpm -q kernel-devel
$ uname -r
Confirm Kernel Version

Confirm Kernel Version

The output clearly indicates a conflict between the two versions. The kernel-devel version is 4.18.0-147.8.1.el8_1.x86_64 whilst the Linux kernel version is 4.18.0-80.el8.x86_64.

To resolve the issue, update the Linux kernel by running the command:

$ sudo dnf update kernel-*
Update Kernel in CentOS 8

Update Kernel in CentOS 8

Once prompted, press 'Y' and hit ENTER to continue with the update. When the update the complete, reboot your CentOS 8 system.

$ sudo reboot

During the reboot, be sure to boot into the latest kernel entry that corresponds to the kernel-devel version. This is usually the first entry as you can see.

CentOS Grub Menu

CentOS Grub Menu

Once the system is done with booting, log in and once again confirm that the kernel-devel version now matches the version of the Linux kernel.

$ rpm -q kernel-devel
$ uname -r
Check Kernel Version

Check Kernel Version

The two versions are now in sync. Great! Now you can go ahead and install VirtualBox guest additions.

Step 3: Install VirtualBox Guest Additions in CentOS 8

There are two ways to install guest additions, and we will cover both ways here:

Install VirtualBox Guest Additions Graphically

To install the VirtualBox guest additions, Head out to the menu bar and click Devices –> Insert Guest Additions CD image.

Select Guest Additions

Select Guest Additions

A pop will appear as shown. From here, you can take two approaches:

Run Guest Additions

Run Guest Additions

You can hit ‘Run‘ and later authenticate when prompted. Thereafter, you will see some verbose output on the terminal. Once the installation is done, reboot the system and boot into a full-screen.

Install VirtualBox Guest Additions Manually

The second option is to install a command-line. To achieve this, choose ‘Cancel’ option and thereafter, open your terminal and create a mount point for the guest additions ISO image.

$ sudo mkdir -p /mnt/cdrom

Next, mount the ISO image on the mount point.

$ sudo mount /dev/cdrom /mnt/cdrom

Then finally navigate to the mount location and run the VirtualBox installer script.

$ cd /mnt/cdrom
$ sudo ./VBoxLinuxAdditions.run 

Once the script is done running, you will immediately observe the screen panning to full size. If this doesn’t happen in your case, reboot your system and finally boot into your full-screen CentOS 8 virtual machine :-)

CentOS Desktop in Full View

CentOS Desktop in Full View

To enable mouse pointer integration, navigate to ‘Shared Clipboard‘ –> ‘Bidirectional‘. This enables you to copy and paste content between the host and guest system.

Share Clipboard in Virtualbox

Share Clipboard in Virtualbox

We hope this article has been helpful to you, If you encounter any challenges, please reach out to us. Thank you.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

2 Responses

  1. Chris Buckridge says:

    Before rebooting, run the command below.

    $ sudo usermod -aG vboxsf userName in your guest Linux VM.
    

    Where userName is the account name in Linux.

    This will add the user to the appropriate group to allow them to share a folder between the host and the guest operating systems

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.