How to Install VirtualBox on Linux Mint: A Detailed Guide

How to Install VirtualBox on Linux Mint: A Detailed Guide

VirtualBox is a powerful open-source software that allows you to run multiple operating systems on your computer simultaneously. It’s particularly useful for developers, testers, and anyone who needs to use different operating systems without rebooting their machine. If you’re using Linux Mint, inVirtualBox is a popular open-source virtualization software that allows you to run multiple operating systems on a single machine. If you’re using Linux Mint, this guide will help you install VirtualBox with ease. The steps are clear and straightforward, ensuring you can follow along without any confusion.

Step 1: Update Your System

Before installing VirtualBox, it’s essential to ensure that your system is up to date. This will help avoid any compatibility issues.

Type the following command to update your package list:

sudo apt update 

After updating the package list, upgrade the installed packages by running:

sudo apt upgrade -y 

This step ensures that your system is ready for the installation process.

Step 2: Add the Oracle VirtualBox Repository

Linux Mint doesn’t include the latest version of VirtualBox in its default repositories. To get the latest version, you need to add the official Oracle VirtualBox repository.

First, install the necessary dependencies:

sudo apt install -y software-properties-common apt-transport-https wget 

Next, add the Oracle VirtualBox repository to your system by running:

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - 

Then, add the repository to your system’s software sources:

sudo add-apt-repository "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" 

This step ensures that your system can download and install the latest version of VirtualBox directly from Oracle.

Step 3: Install VirtualBox

With the repository added, you can now install VirtualBox.

First, update your package list again to include the new repository:

sudo apt update 

Install the latest version of VirtualBox by running:

sudo apt install -y virtualbox-7.0 

Note: Replace “7.0” with the latest version number if it has changed.

After the installation is complete, verify that VirtualBox is installed by checking the version:

virtualbox --version 

This command should display the installed version of VirtualBox, confirming that the installation was successful.

Step 4: Install the Extension Pack (Optional)

The VirtualBox Extension Pack adds additional features, such as USB 2.0 and 3.0 support, remote desktop capabilities, and more. While optional, it’s highly recommended.

Download the Extension Pack from the VirtualBox official website. You can do this by running:

wget https://download.virtualbox.org/virtualbox/7.0.8/Oracle_VM_VirtualBox_Extension_Pack-7.0.8.vbox-extpack 

Note: Replace “7.0.8” with the latest version number if necessary.

Once downloaded, install the Extension Pack with the following command:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.8.vbox-extpack 

Follow the on-screen prompts to accept the license agreement and complete the installation.

This step enhances VirtualBox’s capabilities, allowing you to use advanced features.

Step 5: Add Your User to the vboxusers Group

To use USB devices in your virtual machines, you need to add your user to the vboxusers group.

Run the following command to add your user:

sudo usermod -aG vboxusers $USER 

After running the command, log out of your session and log back in for the changes to take effect.

This step is crucial for using USB devices within your virtual machines.

Step 6: Launch VirtualBox

Now that everything is set up, you can start using VirtualBox.

To launch VirtualBox, either search for “VirtualBox” in the application menu or run the following command in the terminal:

virtualbox 

The VirtualBox interface should appear, allowing you to create and manage virtual machines.

This final step confirms that everything is installed and ready to use.

Creating Your First Virtual Machine

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

  1. In the VirtualBox interface, click on the “New” button.
  2. Name your virtual machine and select the operating system you want to install.
  3. Allocate the necessary amount of RAM. The recommended minimum is 1024 MB.
  4. Create a virtual hard disk. The default option is usually sufficient.
  5. Follow the on-screen prompts to complete the setup.

You can now start your virtual machine and begin installing your chosen operating system.

Troubleshooting Common Issues

During the installation or usage of VirtualBox, you may encounter some issues. Here are common problems and their solutions:

1. Kernel Driver Not Installed (rc=-1908):

If you receive an error related to the kernel driver, run the following command:

sudo apt install -y dkms linux-headers-$(uname -r) sudo /sbin/vboxconfig 

2. VirtualBox Not Starting:

If VirtualBox doesn’t start, try reinstalling it:

sudo apt remove --purge virtualbox sudo apt install -y virtualbox-7.0 

3. USB Devices Not Recognized:

Ensure you have added your user to the vboxusers group. Also, check that the Extension Pack is installed.

Script for Automatic Installation

For users who prefer automation, here’s a script that installs VirtualBox along with the Extension Pack:

#!/bin/bash

# Update system
sudo apt update && sudo apt upgrade -y

# Install dependencies
sudo apt install -y software-properties-common apt-transport-https wget

# Add Oracle VirtualBox repository
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"

# Install VirtualBox
sudo apt update
sudo apt install -y virtualbox-7.0

# Install Extension Pack
wget https://download.virtualbox.org/virtualbox/7.0.8/Oracle_VM_VirtualBox_Extension_Pack-7.0.8.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.8.vbox-extpack

# Add user to vboxusers group
sudo usermod -aG vboxusers $USER

echo "VirtualBox installation complete. Please log out and log back in."

Save this script as install_virtualbox.sh, make it executable (chmod +x install_virtualbox.sh), and run it.

Conclusion

Installing VirtualBox on Linux Mint is a simple yet powerful way to expand your computing capabilities. Whether you’re testing software, experimenting with different operating systems, or just curious about other environments, VirtualBox provides a safe and flexible platform to do so. By following this guide, you should now have VirtualBox installed and ready to use. Happy virtualizing!

Fedya Serafiev

Fedya Serafiev

Fedya Serafiev owns the website linuxcodelab.eu. He finds satisfaction in helping people solve even the most complex technical problems. His current goal is to write easy-to-follow articles so that such problems do not arise at all.

Thank you for reading the article! If you found the information useful, you can donate using the buttons below: