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. Thanks to Ubuntu’s community and support forums, there’s nothing you can’t do with this system.
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 restarting your physical computer without switching to the other plan.
What’s New in Oracle VM VirtualBox 6.1?
- Oracle Cloud Infrastructure Support for Import Appliance.
- Advanced support for Oracle Cloud Infrastructure, Export Appliance.
- Infested support for Nested Virtualization.
- Improved 3D support (VBoxSVGA and VMSVGA).
- Embedded editors and mouse pointer enhancements.
- Virtual Machine Groups and advanced storage settings.
- Linux Host/Guest: Linux Kernel 5.4 support.
- EFI support for virtual machines.
- Hardware-based virtualization core.
After installing VirtualBox software on a widespread Linux distribution such as Ubuntu, you can quickly run many old or new operating systems.
After installing a new operating system with the Oracle VM, you must 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: To download the latest version of VirtualBox to your Linux computer, visit the virtualbox.org 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: The download will start immediately after you click Ubuntu 19.10 / 20.04 / 20.10 / 21.04. Click the Save button to save the program to your computer and wait for the download.
Step 4: The downloaded file with the deb extension is 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, confirm the installation of the boxes 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.
wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_5.15.0-27.28_amd64.deb
sudo dpkg -i linux-libc-dev_5.15.0-27.28_amd64.deb
Step 8: You will get the error that you want to rerun VirtualBox because you must install the Linux kernel-headers packages. To install this package, execute the following command in the terminal, run the vboxconfig command, and wait to recompile the kernel modules.
sudo apt install linux-headers-$(uname -r) build-essential dkms
sudo /sbin/vboxconfig
Step 9: You can run Oracle VM VirtualBox without problems after recompiling the kernel modules.
Step 10: After completing the installation, go to the VirtualBox website and download the Extension Pack this time. The relevant file will be downloaded to your computer immediately after clicking the “All supported platforms” option on the Downloads page.
Step 11: To install the Extension Pack, double-click the downloaded file, accept the license agreement, click the Install button, and complete the installation.
How to Create a New Virtual Machine with Oracle VM in Ubuntu
Step 1: Now click the Machine / New option to create a new virtual machine in Ubuntu.
Step 2: When the “Create Virtual Machine” window opens, specify an operating system type and version.
Step 3: To run a Windows 10 operating system on Ubuntu, select it and 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 must set the virtual disk as a fixed size or dynamically allocated structure. Continue by selecting the appropriate option depending on your purpose of using the virtual machine.
Step 6: In the file location window, configure the folder and size of the virtual computer files to be backed up. For example, if you install the VM only once and 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, and 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 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: After selecting the ISO image, run the virtual computer and install 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 must be deleted from Program Files.
However, it is easy to uninstall a program in Ubuntu, 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.
Watch this video or follow the steps below to delete VirtualBox from Ubuntu.
Step 1: First, 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, use the command below, and confirm the packages to be uninstalled. Packages like Extension Pack or DKMS will be deleted at this stage.
sudo apt remove --purge *virtualbox*
Step 3: In this step, you must 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 must delete the user group 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