1080*80 ad

Rocky Linux 8: Installing VirtualBox Guest Additions

How to Install VirtualBox Guest Additions on Rocky Linux 8: A Step-by-Step Guide

Running Rocky Linux 8 in a VirtualBox environment is a powerful way to test applications, manage servers, or learn a new operating system. However, to unlock its full potential and create a seamless experience between your host and guest machines, installing VirtualBox Guest Additions is an essential step.

This guide provides a clear, straightforward walkthrough for installing VirtualBox Guest Additions on your Rocky Linux 8 virtual machine. Following these steps will improve performance, enable critical features, and make your virtual environment significantly more user-friendly.

Why Install VirtualBox Guest Additions?

Before diving into the installation process, it’s important to understand the benefits. VirtualBox Guest Additions are a set of device drivers and system applications that optimize the guest operating system for better performance and usability.

Key benefits include:

  • Dynamic Screen Resolution: Your VM’s display will automatically resize as you adjust the window, eliminating the need for manual changes and scrollbars.
  • Shared Clipboard: Effortlessly copy and paste text and other content between your host machine and the Rocky Linux VM.
  • Seamless Mouse Integration: Move your mouse pointer smoothly between the host and guest operating systems without having to capture or release it.
  • Shared Folders: Easily share files and directories between your host and the virtual machine.
  • Improved Video Performance: Guest Additions provide enhanced video drivers for better graphics performance and acceleration.

Prerequisites: Preparing Your Rocky Linux System

The most common reason for a failed Guest Additions installation is a system that isn’t properly prepared. Before you begin, you must install the necessary build tools and kernel headers that allow the installer to compile the required kernel modules.

Step 1: Update Your System

First, ensure your system is fully up-to-date. Open a terminal and run the following command to update all packages, including the kernel:

sudo dnf update -y

Important: If this command updates the kernel, you must reboot the system before proceeding. This ensures you are running the latest kernel version for which you will install the development headers.

sudo reboot

Step 2: Install Required Dependencies

Next, install the essential development tools and kernel headers. The kernel-devel package must match your currently running kernel version. The DKMS (Dynamic Kernel Module Support) package is also crucial, as it allows the Guest Additions kernel modules to be automatically rebuilt whenever the kernel is updated.

Run this command to install all necessary packages:

sudo dnf install epel-release -y
sudo dnf install gcc make perl kernel-devel kernel-headers bzip2 dkms -y

With these dependencies in place, your system is now ready for the Guest Additions installation.

Installing Guest Additions: The Core Process

Step 3: Insert the Guest Additions CD Image

In the VirtualBox window menu for your running Rocky Linux VM, navigate to Devices -> Insert Guest Additions CD Image….

This action will mount a virtual CD containing the installation files inside your Rocky Linux 8 guest operating system. You may see a pop-up asking if you want to run the software automatically; you can close this, as we will be running the installation manually from the terminal for better control.

Step 4: Mount the Image and Run the Installer

If the virtual CD did not mount automatically, you can do it manually. First, create a mount point:

sudo mkdir -p /mnt/cdrom

Next, mount the device to the directory you just created:

sudo mount /dev/cdrom /mnt/cdrom

Now, navigate to the mounted directory and run the installation script. The script needs root privileges to install the necessary files and drivers.

cd /mnt/cdrom
sudo ./VBoxLinuxAdditions.run

The installer will now begin compiling and installing the kernel modules. You will see output in the terminal showing the progress. Wait for the process to complete successfully.

Step 5: Reboot and Verify the Installation

For the changes to take full effect, a final reboot is required.

sudo reboot

Once your Rocky Linux 8 VM has restarted, the Guest Additions should be fully active. You can verify the installation by:

  1. Resizing the VM window: The desktop resolution inside Rocky Linux should adjust automatically.
  2. Testing the shared clipboard: Try copying text from your host machine and pasting it into a text editor within the VM.

Troubleshooting Common Issues

  • “Kernel headers not found” error: This is the most frequent problem. It almost always means the kernel-devel package is missing or doesn’t match the running kernel. Ensure you have run sudo dnf update, rebooted, and then installed the dependencies as described in Steps 1 and 2.
  • Guest Additions stop working after a kernel update: This is where DKMS proves its value. It should automatically rebuild the VirtualBox modules after a system update. If it fails for any reason, you can manually trigger a rebuild by running: /sbin/rcvboxadd setup. After that, reboot the VM.

By following this guide, you have successfully integrated your Rocky Linux 8 virtual machine with your host system, creating a more productive and efficient development environment.

Source: https://kifarunix.com/install-virtualbox-guest-additions-on-rocky-linux-8/

900*80 ad

      1080*80 ad