How to Install VirtualBox on Linux

Setting up a virtual machine can be a great way to test alternative software or operating systems on a computer without altering or putting the existing system at risk.

Follow these instructions to install VirtualBox on Linux and create your first virtual machine.

Download and Install VirtualBox on Linux

Before you start, you need to have VirtualBox installed on your system. You can download it directly from Oracle or, in some cases, install from the distribution's package manager.

Install VirtualBox through the system package manager

If VirtualBox is available in the distribution's software repositories, then installing through the package manager will be the fastest, easiest and safest way. The prepackaged version has better integration with specific operating system and provides better performance.

To see if VirtualBox is available directly through the distribution, open a Terminal and enter the appropriate command depending on the Linux distribution you are currently using.

For Debian-based systems like Ubuntu and Linux Mint:

sudo apt install virtualbox

For RHEL-based systems like CentOS and Fedora:

sudo dnf install virtualbox

On Arch Linux and its derivatives:

sudo pacman -S virtualbox

If VirtualBox is available, answer yes to any installation prompts and everything will be installed in a moment. When the installation is complete, you need to reboot the system. You can then skip to the next section and jump right into the tutorial on how to set up your first virtual machine.

If you get an error stating that VirtualBox cannot be found, continue to follow the section below to download and install it from the official website.

Download and install VirtualBox from Oracle

To download VirtualBox from Oracle and install it, you need to visit the VirtualBox Linux download page. From there, choose the installation package that best suits your operating system.

Download VirtualBox here.

Once you have downloaded the installation package, open a Terminal and switch to the folder where the file was saved. Enter the appropriate command below to start the installation process (replace with the exact name of the file you downloaded).

For Debian-based systems like Ubuntu and Linux Mint:

sudo dpkg -i VirtualBox-Version.XXdeb

For RHEL-based systems like CentOS and Fedora:

sudo rpm -i VirtualBox-Version.XXrpm

Your system can download the necessary support packages before the installation process begins. After the installation is complete, you need to reboot your system before launching VirtualBox.

Create virtual machines with VirtualBox

Once you've installed VirtualBox, setting up your first virtual machine is relatively easy. When you launch VirtualBox for the first time, you will see a short menu. From there, just click the New button.

Picture 1 of How to Install VirtualBox on Linux

VirtualBox will ask you to name your new virtual machine. Choose a storage location for the virtual machine files and select the operating system you will install.

Picture 2 of How to Install VirtualBox on Linux

VirtualBox has built-in support for nearly all major operating systems, including Windows, Linux, macOS, and even BSD and Solaris.

After selecting the operating system, VirtualBox will ask you to choose how much RAM to allocate to the virtual machine while it is running. Normally you should give your guest OS at least 4GB of RAM.

If you have a large amount of RAM, you can get better performance by increasing the amount allocated to your guest system. However, you should not use more than half of your system's physical RAM for virtual machines.

VirtualBox will then ask if you want to create a virtual hard drive for your new virtual machine. Since this is the first virtual machine, you should choose Create a virtual hard disk now. When asked what type of hard drive you want to create, just leave this setting as default, VDI or VirtualBox disk image.

Next, VirtualBox will ask you if you want the hard drive to be dynamically allocated or set to a fixed size.

If you set the hard drive to dynamically allocated, VirtualBox will boot the machine with a relatively small virtual hard drive, which will increase as more space is needed (up to the maximum you have set). Fixed-size virtual drives generally perform better, but the difference is only really noticeable if you're creating a large drive.

Picture 3 of How to Install VirtualBox on Linux

On the next screen, set the maximum hard drive size for the virtual machine. For many systems, VirtualBox will default to 8GB. While this number may be fine for minimal installations of some operating systems, if you plan to do more than just use your new virtual machine for casual testing, you should set a The maximum hard drive limit is a bit higher, to at least 15 or 20GB.

With the configuration set up, VirtualBox will return to the main menu and you will see an entry for your new virtual machine on the left side of the VirtualBox window.

Click on the virtual machine and you will see a button labeled Start in the top right.

Picture 4 of How to Install VirtualBox on Linux

Click Start to power up the virtual machine. VirtualBox will open a dialog asking you to select the boot drive. The boot drive will be the installation drive for whatever operating system you want to install.

Just click on the folder icon and select the image you want to use. Click the Add button at the top left and navigate to the folder where you have stored your installation media.

Picture 5 of How to Install VirtualBox on Linux

Select the drive you want to use. Then, click Choose to continue.

Picture 6 of How to Install VirtualBox on Linux

Back to the selected boot drive screen, you should now see the selected installation image. Click Start, then the new virtual machine will boot and load the installation media.

From there, all you need to do is just follow the on-screen instructions for whatever operating system you're installing. Once the installation is complete, reboot the virtual machine and it will load up the new guest OS, ready for you to use.

From this point on, whenever you want to use your new virtual machine, all you need to do is load VirtualBox and click Start.

Update 20 November 2021
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile