How to Install VirtualBox on Linux Mint?


VirtualBox is an open-source and cross-forum tool that can be installed on operating systems, including Windows, macOS, Solaris, and Linux, such as Linux Mint, Ubuntu, and other distributions. VirtualBox enables the user to create and run multiple virtual machines for different operating systems,i.e., Linux Mint on a single host simultaneously without rebooting.

In this guide, we will discuss the process of installing VirtualBox on the Linux Mint distribution.

 

How to Install VirtualBox on Linux Mint?

VirtualBox is available on the Linux Mint’s repository and can also be installed from a third-party PPA. Both of these methods are explained below one by one. Let’s start with the official/standard repository method.

 

Approach 1: How to Install VirtualBox on Linux Mint From Standard Repository?

To install the VirtualBox on Linux Mint from the standard repository, follow the provided instructions.

 

Step 1: Update Repository

Ensure that all the system packages are updated by running the following command:


 

Step 2: Install VirtualBox and Extension Pack

Install the VirtualBox along with the extension pack (adds some interactive features to the VirtualBox during/post installation) via the command:

sudo apt install virtualbox virtualbox-ext-pack

Select “OK” and press the “Enter” key to proceed to the next window (here just terms written which you have to accept in the next step)

Next, choose the “Yes” option and hit the “Enter” key to accept the terms:

The below-given output shows that the VirtualBox has been installed successfully on the Linux Mint system:

 

Step 3: Launch VirtualBox

To launch a VirtualBox using the terminal, execute the provided command:


Virtualbox can be launched from the GUI of Linux Mint as follows:

  • First, hit the menu button and type the term Virtualbox in the search bar.
  • Select the Virtualbox that appeared in the search results.

 

Approach 2: How to Install VirtualBox on Linux Mint From Oracle’s Official VirtualBox Repository?

To install the VirtualBox on Linux Mint from Oracle’s official VirtualBox repository, users need to follow the provided step-by-step instructions:

 

Step 1: Import Virtualbox Repository

The Virtualbox repository can be imported via the following easy steps:

  • Update and upgrade the repository to ensure that all the available packages are updated.
  • Then, install all required dependencies.
  • Next, import the GPG key.
  • Lastly, import the Virtualbox repository.

Now, move ahead and check out the procedure with a practical demonstration!

Use the provided command to update and upgrade the repository::

sudo apt update && sudo apt upgrade

Install the following set of prerequisites, via the command:

sudo apt install dirmngr dkms ca-certificates software-properties-common apt-transport-https curl wget gnupg2 -y

Next, import the GPG key by executing the given command to verify the authenticity of the packages and ensure all the installing packages are from the official VirtualBox repository:

curl -fSsL https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg –dearmor | sudo tee /usr/share/keyrings/virtualbox.gpg > /dev/null

Finally, import the official VirtualBox repository by running the given command:

echo deb [arch=amd64 signed-by=/usr/share/keyrings/virtualbox.gpg] http://download.virtualbox.org/virtualbox/debian jammy contrib | sudo tee /etc/apt/sources.list.d/virtualbox.list

Additional Information: Use the suitable command to add the VirtualBox Virtualbox repository depending on your Linux Mint distribution version. In our case, we have the Linux Mint 21.2 version. For the Linux Mint 20.xx version, the following command can be used:

echo deb [arch=amd64 signed-by=/usr/share/keyrings/virtualbox.gpg] http://download.virtualbox.org/virtualbox/debian focal contrib | sudo tee /etc/apt/sources.list.d/virtualbox.list

Lastly, update your system repository list to add the newly imported VirtualBox repository:

As you can see, the imported VirtualBox repo has been added successfully:

 

Step 2: Installation of VirtualBox

After adding the VirtualBox repository, install the VirtualBox and appropriate Linux header for the system’s kernel version through the provided command:

sudo apt install virtualbox-7.0 linux-headers-$(uname -r) -y

Note: The Linux headers are essential for VirtualBox to function accurately.

Use the below-given command to verify the VirtualBox installation that is pulled from the source repository:

apt-cache policy virtualbox-7.0

After running the above command, users will get the package’s priority, version number, and the source repository:

Check the VirtualBox service status by using the “systemctl status” command along with the “vboxdrv” service (The “vboxdrv” service is used to manage the VirtualBox kernel modules):


Sometimes, the “vboxdrv” service may not be active by default after the VirtualBox installation. If users want to start and enable it, then run the given command:

sudo systemctl enable vboxdrv –now

 

Step 3: Get Started With VirtualBox

Virtualbox can be launched using one of the following methods:

The above-listed methods are already provided in the previously given VirtualBox installation approach.

 

Step 4: Installation of VirtualBox Extension Pack

The VirtualBox extension pack is not necessary for running the VirtualBox and it is an optional add-on that offers multiple features to enhance the VirtualBox experience, such as Oracle cloud infrastructure integration, VirtualBox remote desktop protocol, and host webcam passthrough. Let’s follow the provided process for its installation.

Before downloading the VirtualBox extension pack, first, check the currently installed version of the VirtualBox on your system because the version of the extension pack should match it:

vboxmanage -v | cut -dr -f1

Now, execute the “wget” command to download the particular extension pack version:

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

After doing so, use the “vboxmanage” command to install the downloaded VirtualBox extension pack:

sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.12.vbox-extpack

The below-given output shows that the VirtualBox extension pack has been installed successfully:

Execute the “vboxmanage” command to list the extension pack for verification:


Next, run the following command to add a local user to the group in Linux Mint for granting the appropriate permissions instead of managing the permissions of each user:

sudo usermod -a -G vboxusers $USER

Here:

  • -a” refers to the add user, and the “-G” flag represents the group name, i.e., “vboxusers.
  • $USER” shows that the currently logged-in user will be added to the group named “vboxusers”.

After doing so, reboot your system by executing the “reboot” command. Then, run the following command to check the list of user account groups and ensure that the newly added “vboxusers” exist in the list:


It can be seen that the “$USER” users belong to the “vboxusers” group and exist in the list:

 

How to Completely Uninstall\Remove VirtualBox From Linux Mint?

If users want to uninstall the VirtualBox from the Linux Mint including the data of its associated database, then run the “apt autoremove” command along with the “–purge” flag:

sudo apt autoremove virtualbox* –purge

The following output shows that the VirtualBox has been deleted successfully:

Note: As we described above, the “–purge” option is used for removing the entire data including the associated database with the VirtualBox. However, if users want to keep their data, they need to skip the “–purge” flag.

To verify if the VirtualBox has been uninstalled or not, use the given command:

apt-cache policy virtualbox-7.0

If you have installed VirtualBox from Oracle’s official Virtual repository, then the following steps are applicable for removing the source repository and GPG key from the Linux Mint.

To delete the VirtualBox source repository, use the following command:

sudo rm /etc/apt/sources.list.d/virtualbox.list

Then, execute the below-provided command to remove the GPG key from Linux Mint:

sudo rm /usr/share/keyrings/virtualbox.gpg

 

Bonus Tip:

 

How to Update VirtualBox on Linux Mint?

The below command is used for updating the VirtualBox installation on Linux Mint:

sudo apt update && sudo apt upgrade

According to the provided output, currently, no update is available:

 

How to Create a New Virtual Machine on Linux Mint?

If you want to create a new virtual machine on the Linux system, then follow the below-given procedure.

Step 1: Open VM VirtualBox Manager

First of all, open the VM VirtualBox Manager and hit the below highlighted “New” button:

Step 2: Specify Machine Name

Then, a wizard will appear on the screen to specify the Name for a new machine, choose Machine Folder, and select its Type, the Version sections will automatically match, and press the “Next” button:

Step 3: Allocate Memory to the Virtual Machine

Next, specify the memory size according to the capacity of your host system for the virtual system and click on the “Next” button to continue the process:

Step 4: Create a Virtual Hard Disk

After that, choose the below-highlighted option, and hit “Create”:

Step 5: Choose Hard Disk File Type

Then, select the hard disk file type. Here, we have selected the “VDI (VirtualBox Disk Image)” type and click on the “Next” button:

Now, select the “Dynamically allocated” option to dynamically allocate the disk space as much as it requires from disk capacity and proceed further by pressing the “Next” button:

Step 6: File Allocation and Size

Specify the file allocation and necessary size of the virtual hard disk according to the requirement and create it:

After doing so, the new Virtual Machine will be created. To use it, press the “Start” button:

 

How to Remove Virtual Machine From VirtualBox on Linux Mint?

If you want to remove any Virtual machine from the VirtualBox, first, right-click on it. Then, choose the “Remove…” option from the menu. For instance, we want to delete the “Linux_demo” virtual machine:

Click on the “Delete all files” button to confirm the removal operation for all files:

The provided output shows that the deleted Virtual machine no longer exists:

 

Wrapping-Up

The installation of VirtualBox on Linux Mint is a straightforward procedure that allows users to extend their system to run multiple operating systems at the same time. To use the VirtualBox on Linux Mint, users need to install it first on their operating systems. For that purpose, there are two methods, such as installation from the standard repository and second is from Oracle’s official VirtualBox repository.

In this write-up, we have described how to install the VirtualBox on LinuxMint.

Print Friendly, PDF & Email