WindowsMacSoftwareSettingsSecurityAndroidProductivityLinuxPerformanceAppleDevice Manageme.. All

How to Install VirtualBox on Linux

Edited 5 days ago by ExtremeHow Editorial Team

VirtualBoxLinuxInstallationSetupBeginnerSoftwareOperating SystemWalkthrough

How to Install VirtualBox on Linux

This content is available in 7 different language

VirtualBox is a powerful free virtualization software that allows you to run multiple operating systems on a single machine. It is useful for developers, testers, and anyone who needs to run multiple operating systems without needing separate hardware for each. In this guide, we will explain how to install VirtualBox on a Linux system. We will cover common Linux distributions including Ubuntu, Fedora, and CentOS. By the end of this walkthrough, you will be able to confidently install and run VirtualBox on your Linux machine.

What is VirtualBox?

VirtualBox is an open-source virtualization platform that allows users to create and manage virtual machines. With VirtualBox, you can run different operating systems on your single host machine, making it easy to work with different software environments. This makes it a very flexible tool for developers, testers, and IT professionals.

VirtualBox supports a wide range of guest operating systems, including Windows, macOS, Linux, Solaris, and more. It also has robust features such as seamless mode, shared folders, support for USB devices, and snapshots, which allow you to save the state of your virtual machine and return to it later when needed.

Prerequisites

Before we get into the installation, there are a few pre-requisites that you need to ensure:

  1. You must have a Linux-based operating system installed on your machine.
  2. You need administrative privileges on the system to install the software.
  3. You will need an internet connection to download VirtualBox packages and dependencies.
  4. It is useful to have a basic understanding of using the terminal and package manager on Linux.

Steps to install VirtualBox

Step 1: Update your system

The first step to installing any new software on your Linux machine is to update your system's package list and upgrade existing packages. This ensures that all software dependencies are up-to-date, which helps in the smooth installation of new programs.

To do this, run the following command:

sudo apt update && sudo apt upgrade

For non-Ubuntu systems, you can use similar commands like `sudo dnf update` or `sudo yum update`.

Step 2: Add the VirtualBox repository

VirtualBox provides its own repository for all supported distributions. Adding this repository to your package manager makes installation and upgrades easier.

For Ubuntu and Debian based systems:

Open your terminal and add the repository:

sudo sh -c 'echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" > /etc/apt/sources.list.d/virtualbox.list'

Then download and add Oracle's public key:

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

For Fedora based systems:

Add VirtualBox Repository:

sudo dnf install -y https://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

For CentOS based systems:

You will first need to install the EPEL repository and the RPM Fusion repository to cover the wide range of packages that VirtualBox depends on.

sudo yum install epel-release
sudo yum install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm

Then add the VirtualBox repository:

sudo yum-config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo

Step 3: Install VirtualBox

After installing the repository, proceed to install VirtualBox using the package manager specific to your Linux distribution.

On Ubuntu/Debian:

Now, update your package list and install VirtualBox:

sudo apt update
sudo apt install virtualbox-6.1

On Fedora:

For Fedora, you will need to install the latest “Development Tools” and required packages before installing VirtualBox:

sudo dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
sudo dnf install VirtualBox-6.1

On CentOS:

For CentOS, use the following command:

sudo yum install VirtualBox-6.1

Step 4: Set up the Oracle VM VirtualBox Extension Pack

The Oracle VM VirtualBox Extension Pack provides additional functionalities such as support for USB 2.0/3.0 devices, VirtualBox RDP, disk encryption, and more. This is a valuable addition, especially if you plan to maximize the functionalities of your virtual machines.

First, download the extension pack using the wget command:

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

Then, install it with the VBoxManage tool that comes with VirtualBox:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.28.vbox-extpack

Follow the on-screen prompts to accept the license terms and confirm the installation.

Step 5: Start and use VirtualBox

After VirtualBox is installed, you are now ready to start creating and using virtual machines! Open VirtualBox from your Applications menu. You should see the Oracle VM VirtualBox Manager interface.

To create a new virtual machine, click the "New" button and follow the steps to set up a virtual environment. You'll need to choose which operating system you want to install, allocate system resources (such as CPU and memory) and create a virtual disk.

Troubleshooting

If VirtualBox does not start, it may be due to the lack of necessary kernel modules. You can try loading them with the following command:

sudo /sbin/vboxconfig

If you have problems related to kernel updates, make sure to rebuild the VirtualBox kernel modules:

sudo /sbin/vboxconfig

Additionally, consult the VirtualBox manual and online forums for further troubleshooting steps if necessary.

Conclusion

Installing VirtualBox on a Linux machine may seem complicated as it requires adding repositories and managing dependencies, but it becomes simple by following these steps. With VirtualBox, you can explore different operating systems, test software in different environments, and gain extensive flexibility on your Linux host machine. Enjoy the unlimited potential that VirtualBox provides in your computing environment!

If you find anything wrong with the article content, you can


Comments