FedoraRHEL Based

How To Install VirtualBox on Fedora 42

Install VirtualBox on Fedora 42

VirtualBox stands as one of the most powerful open-source virtualization platforms available today, enabling users to run multiple operating systems simultaneously on a single machine. For Fedora 42 users seeking to test software, develop applications, or simply explore other operating systems without dual-booting, VirtualBox presents an ideal solution. This comprehensive guide will walk you through installing VirtualBox 7.1.8 on Fedora 42, optimizing its configuration, and resolving common issues you might encounter along the way.

Prerequisites

Before beginning the installation process, it’s essential to ensure your system meets the necessary requirements for running VirtualBox efficiently.

System Requirements

  • Processor: A 64-bit multi-core processor with virtualization technology support (Intel VT-x or AMD-V)
  • Memory: Minimum 2GB RAM, though 4GB or more is recommended for optimal performance
  • Storage: At least 25GB of free disk space for VirtualBox and virtual machines
  • Network: Stable internet connection for downloading packages
  • User Permissions: Administrator (sudo) access on your Fedora system

Verifying Hardware Compatibility

To confirm your processor supports virtualization technology:

egrep -c '(vmx|svm)' /proc/cpuinfo

Any result greater than 0 indicates your processor supports virtualization. If virtualization is disabled, you’ll need to enable it in your system’s BIOS/UEFI settings.

Preparing Your Fedora 42 System

Proper preparation ensures a smooth installation process and helps avoid common pitfalls.

Updating Your System

Always start with an updated system to prevent compatibility issues:

sudo dnf -y upgrade
sudo reboot

This updates all packages and applies any kernel changes that might affect VirtualBox installation.

Backing Up Important Data

Although installing VirtualBox is generally safe, it’s always prudent to back up important data before making system changes. Create backups of critical files to external storage or cloud services before proceeding.

Checking Kernel Version

Verify your current kernel version with:

uname -r

This information will be valuable if you encounter kernel module issues later.

Installing Required Dependencies

VirtualBox requires several dependencies to function correctly on Fedora 42.

Development Tools and Kernel Headers

Install the development tools package group and kernel-related packages:

sudo dnf -y install @development-tools
sudo dnf -y install kernel-headers kernel-devel dkms elfutils-libelf-devel

These packages are essential for building the VirtualBox kernel modules.

GUI Libraries and Additional Dependencies

For the VirtualBox graphical interface:

sudo dnf -y install qt5-qtx11extras

Verify that all dependencies installed correctly before proceeding.

Adding the VirtualBox Repository

While there are multiple installation methods available, using the official VirtualBox repository ensures you get the authentic, up-to-date version.

Importing the VirtualBox GPG Key

First, import Oracle’s GPG key to verify package authenticity:

sudo rpm --import https://www.virtualbox.org/download/oracle_vbox_2016.asc

This step ensures your system can verify the digital signature of VirtualBox packages.

Creating the Repository Configuration

Add the VirtualBox repository to your system:

sudo wget -P /etc/yum.repos.d/ https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

This configuration file tells DNF where to find the VirtualBox packages.

Updating Repository Information

Refresh your package database to include the new repository:

sudo dnf check-update

Installing VirtualBox 7.1.8

With preparations complete, you can now install VirtualBox using one of two methods.

Method 1: Installing from Repository (Recommended)

The simplest approach is to install directly from the repository:

sudo dnf install VirtualBox-7.1

This command will download and install VirtualBox 7.1.8 along with any remaining dependencies.

Method 2: Installing from Downloaded RPM Package

Alternatively, you can download and install the RPM package manually:

1. Download the VirtualBox RPM for Fedora:

wget https://download.virtualbox.org/virtualbox/7.1.8/VirtualBox-7.1-7.1.8_164728_fedora40-1.x86_64.rpm

2. Install the downloaded package:

sudo dnf install ./VirtualBox-7.1-7.1.8_164728_fedora40-1.x86_64.rpm

This method works well when you need a specific version or when repository access is limited.

Verifying the Installation

After installation completes, verify that VirtualBox installed correctly:

vboxmanage --version

The command should return “7.1.8” or your installed version.

Post-Installation Configuration

Several important configuration steps remain to ensure VirtualBox functions properly.

Adding Your User to the vboxusers Group

To access USB devices and other VirtualBox features, add your user to the vboxusers group:

sudo usermod -aG vboxusers $USER

Log out and log back in for this change to take effect.

Configuring VirtualBox Kernel Modules

Ensure the VirtualBox kernel modules are properly built and loaded:

sudo /usr/lib/virtualbox/vboxdrv.sh setup

This command compiles and loads the necessary kernel modules for VirtualBox.

Setting Up Autostart (Optional)

If you want VirtualBox services to start automatically at boot:

sudo systemctl enable vboxdrv

Note that this might slightly increase your system’s boot time.

Installing the VirtualBox Extension Pack

The VirtualBox Extension Pack adds essential features like USB 3.0 support, disk encryption, and boot PXE ROM support.

Downloading the Extension Pack

Download the Extension Pack that matches your VirtualBox version:

VER=$(vboxmanage -v | cut -d 'r' -f 1)
wget https://download.virtualbox.org/virtualbox/$VER/Oracle_VM_VirtualBox_Extension_Pack-$VER.vbox-extpack

Ensure you download the version that exactly matches your installed VirtualBox version.

GUI Installation Method

  1. Open VirtualBox from your applications menu
  2. Navigate to File → Preferences → Extensions
  3. Click the “Add” button (plus icon)
  4. Browse to the downloaded Extension Pack file and select it
  5. Follow the prompts and accept the license agreement when prompted

Command-Line Installation Method

Alternatively, install via command line:

sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-*.vbox-extpack

This method is useful for scripted or remote installations.

Verifying Extension Pack Installation

Confirm the Extension Pack installed correctly:

vboxmanage list extpacks

The output should display information about the installed Extension Pack, including its version and enabled features.

Creating Your First Virtual Machine

With VirtualBox installed and configured, you can create your first virtual machine.

Install VirtualBox on Fedora 42

Basic VM Creation Process

  1. Launch VirtualBox from the applications menu
  2. Click “New” to start the VM creation wizard
  3. Name your VM and select the operating system type and version
  4. Allocate RAM (start with at least 2GB for most modern operating systems)
  5. Create a virtual hard disk (VDI format is recommended)
  6. Configure the virtual disk size (minimum 20GB for most OS installations)
  7. Complete the wizard and start your new VM

Memory Allocation Recommendations

  • Windows VMs: 2GB minimum, 4GB+ recommended
  • Linux VMs: 1GB minimum, 2GB+ recommended
  • macOS VMs: 4GB minimum, 8GB+ recommended

Network Configuration Basics

VirtualBox offers several networking modes:

  • NAT: Simplest option, allows VMs to access the internet but not directly accessible from the network
  • Bridged: VM appears as a separate device on your network
  • Host-only: Communication only between the host and VMs
  • NAT Network: Similar to NAT but allows VMs to communicate with each other

Troubleshooting Common Issues

Even with careful installation, you might encounter some challenges. Here are solutions to common problems.

Kernel Module Loading Failures

If you see “vboxdrv kernel module is not loaded” errors:

sudo dnf reinstall kernel-devel-$(uname -r)
sudo /usr/lib/virtualbox/vboxdrv.sh setup

This rebuilds the kernel modules for your current kernel version.

Secure Boot Conflicts

Fedora 42 with Secure Boot enabled may prevent VirtualBox kernel modules from loading. You have two options:

  1. Disable Secure Boot in your BIOS/UEFI settings
  2. Sign the VirtualBox kernel modules with a custom key:
# Generate a signing key
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VirtualBox/"

# Register the key with UEFI
sudo mokutil --import MOK.der

# After reboot, sign the modules
sudo /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 MOK.priv MOK.der $(modinfo -n vboxdrv)

This allows the modules to load while maintaining Secure Boot protection.

USB Device Access Issues

If USB devices aren’t appearing in your VMs:

  1. Ensure you’re a member of the vboxusers group
  2. Install the Extension Pack if you haven’t already
  3. Add USB filters in the VM settings
  4. For persistent USB permission issues, try:
sudo chmod -R 777 /proc/bus/usb

This is a temporary solution; adding proper udev rules is preferable for a permanent fix.

Network Connectivity Problems

For network-related issues:

  1. Try different network adapter types in VM settings
  2. Reset the VirtualBox network service:
sudo systemctl restart vboxdrv
  1. For NAT network issues, create a new NAT network with a different name and IP range.

Updating VirtualBox

Keeping VirtualBox updated ensures optimal performance and security.

Checking for Updates

Check for available updates:

sudo dnf check-update VirtualBox-7.1

Update Process

Update VirtualBox to the latest version:

sudo dnf update VirtualBox-7.1

When updating, remember to also update the Extension Pack to the matching version.

Version Compatibility Considerations

Major version updates might require additional configuration. Always back up your virtual machines before major upgrades, and consider exporting them to OVA format for added safety.

Performance Optimization Tips

Maximize your VirtualBox experience with these optimization suggestions.

System-Level Optimizations

For better overall performance:

# Disable kernel mitigations (security trade-off)
sudo grubby --update-kernel=ALL --args="mitigations=off"

# Disable NetworkManager-wait-online for faster boot
sudo systemctl disable NetworkManager-wait-online.service

These changes can significantly improve performance, particularly on multi-threaded systems.

Virtual Machine Optimizations

  • Allocate multiple CPU cores to CPU-intensive VMs
  • Enable nested paging in VM processor settings
  • Use dynamically allocated storage for efficient disk space usage
  • Install Guest Additions inside VMs for better integration and performance
  • Disable unnecessary VM features when not needed (audio, USB, etc.)

Congratulations! You have successfully installed VirtualBox. Thanks for using this tutorial for installing the VirtualBox on Fedora 42 Linux system. For additional help or useful information, we recommend you check the VirtualBox website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button