How to Download & Install VirtualBox in Ubuntu?

Install VirtualBox on Ubuntu

VirtualBox is a container that allows you to host multiple operating systems on the current operating system. Unlike booting a second OS, you can host and run the operating system simultaneously while using the current desktop using the VirtualBox; this comes in handy when you want to use Windows on Linux or vice versa. However, installing VirtualBox on Ubuntu or other Linux-based systems is a little confusing for non-tech geeks. If you are facing trouble with how to install VirtualBox on Ubuntu, this is the guide for you.

Also read: 10 Best & Free Screen Recorders for Linux/Ubuntu

How to Install VirtualBox on Ubuntu?

Virtualisation is a great technique to host guest operating systems on your PC. It allows you to use 2 or more operating systems without hard booting them on your storage unit. Mainly used for development and monitoring operations such as Network Analysis and pen-testing, a second OS comes in handy and helps to test specific features.

There are a couple of methods to install a VirtualBox on a Linux-like operating system such as Ubuntu. Unlike Windows operating system, there is no GUI based option and a couple of commands are enough to do it all.

1. How to Install VirtualBox using .deb Files

Debian files is a faster way to install VirtualBox or any other software on UNIX operating system. The .deb files are a form of zip or compressed files and require additional software to use them. Since these are ready-to-use binary files, downloading and installing them doesn’t require greater effort.

The .deb file for the VirtualBox can be found on the official website of Oracle. There is also a method to install VirtualBox using the Oracle repositories which we shall discuss later in the article.

Additionally, there are a few ways you can use to install a .deb file on your UNIX system; in this article, we use the command line method as it is the best and reliable.

install VirtualBox Using .deb file

Download the .deb file for VirtualBox from the official website.

Remember the path to file and rename it to something shorter and easier; ensure you do not change the extension.

Now, open the command terminal and type the following,

dpkg -i /path/to/filename.deb

Here, you need to replace the “path to” with the actual path of the file and use the correct filename.

sudo apt install -f

If you are facing a dependency error while installing VirtualBox using the .deb file; use the following command

Once done, you are ready to set up the VirtualBox on your Ubuntu desktop.

One of the problems with this method is you cannot get automatic updates. So, if there is a newer version of VirtualBox, you will have to uninstall the current one and reinstall the newer one. This is a risky method if you forget to backup your machine on VirtualBox and overwrite it with a new one.

Also read: Things to do after installing Kali Linux – Most Important


2. Install VirtualBox using Ubuntu Repositories

The second and easiest method to install VirtualBox on Ubuntu or any other Linux based system is using the “apt” method. This is the most common way to install a majority of the software on Linux OS but it does with a drawback. When you are installing using the “apt” method, you don’t get to install the latest version since the software centre has an older version on it.

If you are looking forward to installing the latest version of VirtualBox, you can try the other methods in the list. However, if you are more interested in installing than the version, you can follow the below steps.

Install VirtualBox Using Ubuntu Repositories

Open the terminal on your Ubuntu system and type the following code,

sudo apt-get update

This step is done to ensure the package management tool is up to date. An outdated version can sometimes make it hard to perform installing or other operations. Besides, it needs a faster internet connection and sufficient storage space to install all the packages.

The second step is what we use to install the VirtualBox using the repository; to perform this operation, enter the following code

sudo apt-get install virtualbox

Using this step, the VirtualBox is successfully installed on your Linux/Ubuntu system. However, this is not where you can entirely stop the installation process. You can also install an extension pack and enhance the VirtualBox experience.

To install the VirtualBox extension, use the following code,

sudo apt-get install virtualbox—ext–pack
Install VirtualBox Extension Pack on Linux

Click on “Ok” to confirm you have read the license and accept the terms and conditions if you do. Then you can find the successful installation message in your terminal window.

The VirtualBox extension pack is a great way to add support for additional components; these include USB 2.0 and USB 3.0, encryption mechanism, and remote desktop feature.

Also read: How to Rename Files and Directories in Linux?


3. How to Install VirtualBox using Oracle Repository

A little complicated to use but the most efficient way is to install VirtualBox using Oracle repository. In the second method, we did the installation using the Ubuntu repository but one of the downsides was not being able to automatically update the VirtualBox. Since Oracle is the parent company of VirtualBox and if we install it directly from the Oracle repository with support for GPG Keys; the software can regularly update itself.

When you set up GPG Keys, the Ubuntu or Linux system can capably communicate with Oracle. So, when there are new updates available for VirtualBox, they can be installed with preserving the machines and other data.

But how do you install VirtualBox using Oracle repository? Below are the steps.

Install VirtualBox using Oracle Repository

We will first start with installing supporting software for VirtualBox; begin with typing the following code in the terminal window.

sudo apt-get install software–properties–common

The software properties package allows you to install software such as VirtualBox on Ubuntu and use them seamlessly.

Now, we will install GPG keys which shall allow Ubuntu to connect with the VirtualBox repository. Type the following command in the terminal.

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 –

We also need to add the VirtualBox repository to the Ubuntu operating system. For this, we will use the following command,

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

We have added the VirtualBox repository; now, let’s install the latest version of VirtualBox on your Ubuntu operating system. Type the following command in the terminal.

sudo apt-get install virtualbox–6.1
sudo apt-get install virtualbox–5.2 (For 32-bit users)

Let’s also install the VirtualBox extension pack to make it much smoother and add more features and operations. Type the following command.

wget https://download.virtualbox.org/virtualbox/6.1.26/Oracle_VM_VirtualBox_Extension_Pack-6.1.26.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.26.vbox-extpack

Confirm the installation by typing “y” and then wait until the process is complete.

That’s it. We have successfully installed VirtualBox on Ubuntu with automatic updates to the latest version.

Also read: How to Delete Files and Directories in Linux – Simple Guide


How to Setup VirtualBox on Ubuntu?

In the above steps we complete the installation of VirtualBox but how do we setup up a machine? More importantly, how do we start a VirtualBox on Ubuntu or Linux after you install it? There are a couple of questions but it is quite an easy task.

To launch the VirtualBox, use the following command

virtualbox

Once you open the VirtualBox on your Linux, you can find a couple of options such as importing a machine, adding a new one, deleting and making other configurations. However, when you are adding a new virtual machine, you need to have the ISO file of the operating system. For example, if you wish to run a different Linux version or Windows 11 on your VirtualBox, you can download the ISO file from the official website and then add it as a guest operating system.

However, if you wish to run Linux on Windows, it is not necessary to have VirtualBox unless other reasons. You can install the Windows Subsystem for Linux (WSL2) on Windows 10 and above and use it efficiently.

How to add a Virtual Machine to the VirtualBox?

  1. Open the VirtualBox on your Ubuntu system and wait until the GUI is loaded.
  2. Now, click on the “Add” or “New” option to create a new virtual machine.

    Install VirtualBox on Ubuntu

  3. You can now find the list of operating systems and versions, select the one you want to create and then click on the “Next” option.
  4. You also need to select the hardware configurations such as allocation of memory, hard drive space, and other resources. If you are unsure, you can also select the default options.
  5. Once done, you can find the virtual machine in the left column; you can upload several virtual machines for different operating systems. Select the one you wish to run.
  6. Under the “Settings” options, you can find the storage menu; tap on it and then click on “Optical Drive,” here you will choose the ISO file which you have earlier downloaded.
  7. After all the configurations, you can find the “Run” button in the right-top; click on it and the virtual machine is launched.

How to Remove Virtual Machine from VirtualBox?

Once you are done using a virtual machine on your Ubuntu or Linux system, do you need command lines to uninstall it? No, if you wish to remove virtual machines, you can do it easily with the GUI options; however, if you wish to uninstall VirtualBox itself, there are a few commands that we shall discuss in the later section of this article.

Most of the time, there is a common confusion; if you remove the virtual machine, will the data associated with it will also be deleted? Which is the correct way to uninstall virtual machines on VirtualBox using Ubuntu? Can you reconfigure the specifications? and a dozen more.

Also read: How To Zip A Folder In Linux Distribution Using Compression Levels

Reconfiguring Virtual Machines

For reconfiguration, you can click on the machine and change the hardware specifications and adjust the memory or space which is being utilised. So, if you have allocated 2GB of RAM earlier and want to later change it to 4GB, you don’t have to reinstall the entire machine.

To reconfigure your Virtual Machine in VirtualBox,
  1. Open VirtualBox on your Ubuntu system.
  2. On the left column, you can find all the virtual machines that you have installed.
  3. Now, click on the machine that you wish to reconfigure.
  4. On the right-top, you can find the “Settings” option. Click on it and you can reconfigure all the possible changes you can do to the virtual machines; these include changing memory space, choosing different network bridge, and also adjusting the hard drive allocation.
  5. Once done, you can click on the “Run” or. “Start” option and use your favourite or preferable operating system on the Linux or Ubuntu system.

Sometimes, users wish to remove the entire virtual machine to make some space or install a newer version. Though this sound to be complicated, it can be done easily.

Also read: How to Use Clubhouse on PC | Windows, Mac, and Linux


How to Uninstall Virtual Machine?

To uninstall a virtual machine, you need to know any special codes or commands. This can be done using the GUI options and is the same for any operating system running VirtualBox.

To uninstall a virtual machine,

  1. Open VirtualBox on your Ubuntu or Linux system.
  2. From the left column of the VirtualBox, click on the virtual machine that you wish to delete.
  3. After clicking on the virtual machine, you can find the delete option on the right-top under the “Machine tools” section.
  4. You can now see a prompt asking if you are sure and want to delete the virtual machine. Click on “Yes” and the machine will be removed.
  5. The allocated memory and CPU are now available for other virtual machines which you can upload in the similar way as described above.

How to Uninstall VirtualBox from Ubuntu?

If you wish to entirely remove the VirtualBox from your Ubuntu or Linux system, there are a couple of commands you need to use. Now, before reading any further, it is important to note that these commands include “sudo” and “remove” together and a wrong command can mess your system. We advise you to carefully proceed ahead.

To uninstall VirtualBox on Ubuntu,

Open the terminal window and type the following command,

sudo apt-get remove --purge virtualbox

The command is used for uninstalling the VirtualBox from your Ubuntu system. If you wish to remove all the virtual machines and related settings along with hard drives, use the below commands.

sudo rm ~/"VirtualBox VMs" -Rf 
sudo rm ~/.config/VirtualBox/ -Rf

A simple system restart after this should be enough to remove any ongoing processes in the background. However, if you are willing to kill the ghost processes, you can use the following command.

sudo pkill VBox*

Also read: Best WiFi Range Extender and Internet Signal Boosters


Frequently Asked Questions [faqs]

Is VirtualBox good for Ubuntu?

VirtualBox is a great tool to host virtual machines/guest operating systems for free on any Windows, Mac, or Linux OS. It is safe to use VirtualBox but if the ISO files are corrupted, there is a good chance to ruin your experience and system.

Which is the best alternative for VirtualBox on Ubuntu?

VMware is one of the best alternatives to host guest operating systems on Ubuntu or any other Linux system. However, VMware is a paid tool while VirtualBox is free to use.

Where you can download VirtualBox for Ubuntu?

You can download and install VirtualBox for Ubuntu using various methods; these include .deb file, apt installation, and installation using Oracle and Ubuntu repositories.

Is Boxes better than VirtualBox for Ubuntu?

There are a couple of alternatives for VirtualBox on ubuntu, Boxes is one of them. However, Boxes lack the wide configuration options that VirtualBox has to offer.

QEMU is better than VirtualBox?

QEMU is much better than VirtualBox as it is faster and offers hardware-assisted virtualisation and paravirtualisation without altering the hardware.

Also read: How to Delete Files and Directories in Linux

Conclusion | Download & Install VirtualBox on Ubuntu

You should now have a working Virtual Machine on your Linux or Ubuntu system. There are a couple of things you need to take care of when you are configuring these virtual machines as per your hardware system. For instance, the memory and CPU to allocate, the storage space, network bridges, and more. If you are unaware of how much to allocate or configure, the safe option is to keep the default settings.

Got questions for us on how to install VirtualBox on Ubuntu or Linux? Drop them in the comments and answer them for you. Also, do subscribe to the newsletter below and get exciting updates on tech from us.

Share
Share
Tweet
Share
Pin it
Share
Share
Previous Post
Bark vs Qustodio

Bark vs Qustodio: Which is the Best Parental Control App?

Next Post
Ubuntu screen recorders

10 Best & Free Screen Recorders for Linux/Ubuntu in 2022

Related Posts
Popup subscribe Form Tiny Quip

Connect

Some Catchy Line to Grab your Attention

Get Our Prime Content Delivered to your Inbox for Free!! Join the Ever-Growing Community… Right Now.

Total
23
Share