How to Install Oracle VM VirtualBox on Ubuntu 22.04

This article shows you how to install and configure Oracle VM VirtualBox 6.1 on Linux / Ubuntu 22.04 operating system, which allows you to run Windows, Linux, or other systems in a virtual machine.

VirtualBox virtual machine software allows running Apple Mac OS X, Microsoft Windows, Oracle Linux, Oracle Solaris, other Linux operating systems, and legacy operating systems on hosts in a virtual environment.

Undoubtedly, the most widely used Linux operating system is the Ubuntu distribution. There’s nothing you can’t do with this system, thanks to Ubuntu’s community and support forums.

You can install the VirtualBox program developed by Oracle company on your Ubuntu and create and run more than one virtual computer on your physical computer.

In this way, you can use another system on your operating system without the need to restart your physical computer without switching to the other system.

What’s New in Oracle VM VirtualBox 6.1?

  1. Oracle Cloud Infrastructure Support for Import Appliance.
  2. Advanced support for Oracle Cloud Infrastructure, Export Appliance.
  3. Infested support for Nested Virtualization.
  4. Improved 3D support (VBoxSVGA and VMSVGA).
  5. Embedded editors, mouse pointer enhancements.
  6. Virtual Machine Groups and advanced storage settings.
  7. Linux Host/Guest: Linux Kernel 5.4 support.
  8. EFI support for virtual machines.
  9. Hardware-based virtualization core.

After installing VirtualBox software on a popular Linux distribution such as Ubuntu, you can run many old or new operating systems with ease.

After installing a new operating system with the Oracle VM, you need to install Guest Additions to use your host device’s hardware more efficiently. Thus, you can share files between your host device and the virtual machine more efficiently. In addition, the screen resolution of the Guest machine gives better results thanks to this package.

Additionally, to use USB 3.0 devices and other hardware, you must download and install the Extension Pack after installation.

How to Configure and Use VirtualBox 6.1 in Ubuntu

You can follow this video tutorial or the steps below to install and configure Oracle virtualization software to create virtual machines in Ubuntu version 22.04.

Step 1: First of all, to download the latest version of VirtualBox to your Linux computer, visit the website and click the “Download” image on the home page.

Step 2: On the Platform Packages page, click on the Linux Distributions option and click on Ubuntu 19.10 / 20.04 / 20.10 / 21.04 from the distribution versions listed there.

Step 3: Once you click on Ubuntu 19.10 / 20.04 / 20.10 / 21.04, the download will start immediately. Click the Save button to save the program to your computer and wait for the download.

Step 4: You can find the downloaded file with deb extension in the Downloads section. Now, open the terminal in the desktop location and go to the Downloads location. To install the deb extension setup file, execute the command sudo dpkg -i virtualbox-6.1_6.1.34-150636.1~Ubuntu~eoan_amd64.deb.

sudo dpkg -i virtualbox-6.1_6.1.34-150636.1~Ubuntu~eoan_amd64.deb

Step 5: After the dpkg command, run the sudo apt install -f command to install some dependent packages and confirm the installation of the packages to be downloaded, and press Enter.

sudo apt install -f

Step 6: At this step, VirtualBox should now run smoothly. However, some Linux distributions encounter kernel module errors. So you can see the vboxdrv kernel module error in the terminal.

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (5.15.0-27-generic) or it failed to
load. Please recompile the kernel module and install it by

sudo /sbin/vboxconfig

You will not be able to start VMs until this problem is fixed.

Step 7: To resolve the vboxdrv kernel module error, you must first download and install the corresponding package. This package is linux-libc-dev_5.8.0-25.26_amd64.deb, to download and install it, execute this command in the terminal.

sudo dpkg -i linux-libc-dev_5.15.0-27.28_amd64.deb

Step 8: Then you will get the error that you want to run VirtualBox again because you need to install the Linux kernel-headers packages. To install this package, execute the following command in the terminal, also execute vboxconfig command and wait to recompile the kernel modules.

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

Step 9: After recompiling the kernel modules, you can now run Oracle VM VirtualBox without any problems.

Step 10: After completing the installation, go to the VirtualBox website and download the Extension Pack this time. After clicking the “All supported platforms” option on the Downloads page, the relevant file will be downloaded to your computer immediately.

Step 11: To install the Extension Pack, double click the downloaded file and accept the license agreement and click the Install button and complete the installation.

How to Create a New Virtual Machine with Oracle VM in Ubuntu

Step 1: Now click on the Machine / New option to create a new virtual machine in Ubuntu.

Step 2: When the “Create Virtual Machine” window opens, first specify an operating system type and version.

Step 3: For example, if you want to run a Windows 10 operating system on Ubuntu, select it and also configure the kernel version. Next, adjust the amount of RAM based on your computer’s performance.

Step 4: Create a new virtual disk and configure the file type to VDI. The VirtualBox team recommends that you choose the VDI virtual disk file.

Step 5: In the next step, you need to set the virtual disk as a fixed size or dynamically allocated structure. Continue by selecting the relevant option depending on your purpose of using the virtual machine.

Step 6: In the file location window, configure the folder and size of the files of the virtual computer to be backed up. For example, if you install the VM only once and then remove it, set the HDD value here to the minimum amount.

Step 7: After configuring the size and location of the virtual disk, click the Create button and open the VM’s settings.

Step 8: In the virtual computer’s settings, enable the Shared Clipboard and Drag and Drop options for 3D acceleration, use of USB 3.0 devices, file sharing between host and guest. Also, remove the floppy device from the boot order and move the HDD to the first place.

Step 9: To add the ISO file for Windows 10 or another version to the virtual machine, click the empty device in the Storage section, click the CD/DVD icon and click Choose/Create a Virtual Optical Disk. In the Optical Disc Chooser window, navigate to the location of the ISO file and add the image file.

Step 10: Finally, after selecting the ISO image, run the virtual computer and start the installation of the operating system you added.

How to Uninstall VirtualBox

You may need to uninstall the VirtualBox program you installed to create virtual machines on your Linux/Ubuntu computer to use another program.

It is much easier to uninstall a program on Windows systems, and unnecessary files usually need to be deleted from Program Files.

However, it is easy to uninstall a program in Ubuntu as well, but the location of files or folders can now be in many different places after uninstallation.

Using a terminal to uninstall Oracle VM VirtualBox virtualization software gives you an advantage.

Now, watch this video or follow the steps below to delete VirtualBox from Ubuntu.

Step 1: First of all, if you created a shortcut in the Ubuntu desktop location, delete it manually because you will get an error for that shortcut location during the uninstallation process.

Step 2: After deleting the VirtualBox desktop shortcut, open the terminal and use the command below and confirm the packages to be uninstalled. At this stage, packages such as Extension Pack or DKMS will be deleted.

sudo apt remove --purge *virtualbox*

Step 3: In this step, you need to delete unnecessary files left on the system after the uninstallation. First, delete the “VirtualBox VMs” folder where you created the virtual machines.

sudo rm -rf ~/"VirtualBox VMs"

Step 4: Delete the configuration file that keeps all the user settings you made on VirtualBox. Also delete the VBox folder in /usr/lib.

sudo rm -rf ~/.config/VirtualBox/
sudo rm -rf /usr/lib/"virtualbox"

Step 5: Finally, you need to delete the user group that was created automatically on your system when you installed VirtualBox. First, check the existing group with the compgen command and then delete the vboxusers group with the groupdel command.

compgen -g | grep -i "vbox"
sudo groupdel vboxusers

   Related Articles

1. Running Exe in Ubuntu
2. Installing Linux Mint with VirtualBox
3. Installing VM Tools in Ubuntu
4. Installing VMware on Ubuntu
5. Installing Chrome in Ubuntu



In my personal blog, I will explain the solutions to the problems I encounter in the system, network, and information technologies for you. If you want to contact me or consult about a problem, you can send an e-mail to [email protected]