How to Install VirtualBox 7 on Ubuntu 22.04 : A Step-by-Step Guide
In this short article we will learn how to install Oracle VM VirtualBox 7.0 on Ubuntu 22.04 operating system.
VirtualBox is a popular virtualization software that allows users to run multiple operating systems on a single machine. If you’re an Ubuntu user and want to harness the power of VirtualBox, this step-by-step guide will walk you through the installation process.
Step 1: Update System Packages
Before installing any new software, it’s essential to ensure that your system is up to date. Open a terminal and run the following commands:
sudo apt update sudo apt upgrade
This will update the package lists and upgrade any outdated packages on your Ubuntu system.
Step 2: Add the VirtualBox Repository
By default, Ubuntu includes an older version of VirtualBox in its official repositories. To get the latest version, you need to add the VirtualBox repository. Open a terminal and enter the following commands:
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 - sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib"
These commands will download and add the necessary keys and repository to your system.
Output of this commands are as shown below :
ramans@dev01:~$ wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add - [sudo] password for ramans: Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). OK
ramans@dev01:~$ wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add - Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)). OK
ramans@dev01:~$ sudo add-apt-repository "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" Repository: 'deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian jammy contrib' Description: Archive for codename: jammy components: contrib More info: http://download.virtualbox.org/virtualbox/debian Adding repository. Press [ENTER] to continue or Ctrl-c to cancel. Adding deb entry to /etc/apt/sources.list.d/archive_uri-http_download_virtualbox_org_virtualbox_debian-jammy.list
Step 3: Install VirtualBox
Once the repository is added, you can install VirtualBox by running the following command:
sudo apt install virtualbox-7.0
This command will download and install the latest version of VirtualBox on your Ubuntu machine.
The output will be shown below :
ramans@dev01:~$ sudo apt install virtualbox-7.0 Reading package lists... Done Building dependency tree... Done Reading state information... Done The following package was automatically installed and is no longer required: docker-scan-plugin Use 'sudo apt autoremove' to remove it. The following additional packages will be installed: libdouble-conversion3 libmd4c0 libpcre2-16-0 libqt5core5a libqt5dbus5 libqt5gui5 libqt5help5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5widgets5 libqt5x11extras5 libqt5xml5 libsdl-ttf2.0-0 libsdl1.2debian libxcb-xinerama0 libxcb-xinput0 qt5-gtk-platformtheme qttranslations5-l10n Suggested packages: qt5-image-formats-plugins qtwayland5 The following NEW packages will be installed: libdouble-conversion3 libmd4c0 libpcre2-16-0 libqt5core5a libqt5dbus5 libqt5gui5 libqt5help5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5widgets5 libqt5x11extras5 libqt5xml5 libsdl-ttf2.0-0 libsdl1.2debian libxcb-xinerama0 libxcb-xinput0 qt5-gtk-platformtheme qttranslations5-l10n virtualbox-7.0 0 upgraded, 23 newly installed, 0 to remove and 7 not upgraded. Need to get 105 MB of archives. After this operation, 271 MB of additional disk space will be used. Do you want to continue? [Y/n] Y Get:1 http://download.virtualbox.org/virtualbox/debian jammy/contrib amd64 virtualbox-7.0 amd64 7.0.8-156879~Ubuntu~jammy [92,6 MB] Get:2 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 libdouble-conversion3 amd64 3.1.7-4 [39,0 kB] Get:3 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5core5a amd64 5.15.3+dfsg-2ubuntu0.2 [2.006 kB] Get:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy/main amd64 libpcre2-16-0 amd64 10.40-1+ubuntu22.04.1+deb.sury.org+1 [212 kB] Get:5 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 libmd4c0 amd64 0.4.8-1 [42,0 kB] Get:6 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5dbus5 amd64 5.15.3+dfsg-2ubuntu0.2 [222 kB] Get:7 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5network5 amd64 5.15.3+dfsg-2ubuntu0.2 [731 kB] Get:8 http://id.archive.ubuntu.com/ubuntu jammy/main amd64 libxcb-xinerama0 amd64 1.14-3ubuntu3 [5.414 B] Get:9 http://id.archive.ubuntu.com/ubuntu jammy/main amd64 libxcb-xinput0 amd64 1.14-3ubuntu3 [34,3 kB] Get:10 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5gui5 amd64 5.15.3+dfsg-2ubuntu0.2 [3.722 kB] Get:11 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5widgets5 amd64 5.15.3+dfsg-2ubuntu0.2 [2.561 kB] Get:12 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 libqt5svg5 amd64 5.15.3-1 [149 kB] Get:13 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5sql5 amd64 5.15.3+dfsg-2ubuntu0.2 [123 kB] Get:14 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 libqt5help5 amd64 5.15.3-1 [162 kB] Get:15 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5opengl5 amd64 5.15.3+dfsg-2ubuntu0.2 [153 kB] Get:16 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5printsupport5 amd64 5.15.3+dfsg-2ubuntu0.2 [214 kB] Get:17 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 libqt5x11extras5 amd64 5.15.3-1 [10,9 kB] Get:18 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5xml5 amd64 5.15.3+dfsg-2ubuntu0.2 [124 kB] Get:19 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 libqt5sql5-sqlite amd64 5.15.3+dfsg-2ubuntu0.2 [53,0 kB] Get:20 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 libsdl1.2debian amd64 1.2.15+dfsg2-6 [177 kB] Get:21 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 libsdl-ttf2.0-0 amd64 2.0.11-6 [15,1 kB] Get:22 http://id.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 qt5-gtk-platformtheme amd64 5.15.3+dfsg-2ubuntu0.2 [130 kB] Get:23 http://id.archive.ubuntu.com/ubuntu jammy/universe amd64 qttranslations5-l10n all 5.15.3-1 [1.983 kB] Fetched 105 MB in 60s (1.750 kB/s) Preconfiguring packages ... Selecting previously unselected package libdouble-conversion3:amd64. (Reading database ... 289891 files and directories currently installed.) Preparing to unpack .../00-libdouble-conversion3_3.1.7-4_amd64.deb ... Unpacking libdouble-conversion3:amd64 (3.1.7-4) ... Selecting previously unselected package libpcre2-16-0:amd64. Preparing to unpack .../01-libpcre2-16-0_10.40-1+ubuntu22.04.1+deb.sury.org+1_amd64.deb ... Unpacking libpcre2-16-0:amd64 (10.40-1+ubuntu22.04.1+deb.sury.org+1) ... Selecting previously unselected package libqt5core5a:amd64. Preparing to unpack .../02-libqt5core5a_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5core5a:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libmd4c0:amd64. Preparing to unpack .../03-libmd4c0_0.4.8-1_amd64.deb ... Unpacking libmd4c0:amd64 (0.4.8-1) ... Selecting previously unselected package libqt5dbus5:amd64. Preparing to unpack .../04-libqt5dbus5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5dbus5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libqt5network5:amd64. Preparing to unpack .../05-libqt5network5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5network5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libxcb-xinerama0:amd64. Preparing to unpack .../06-libxcb-xinerama0_1.14-3ubuntu3_amd64.deb ... Unpacking libxcb-xinerama0:amd64 (1.14-3ubuntu3) ... Selecting previously unselected package libxcb-xinput0:amd64. Preparing to unpack .../07-libxcb-xinput0_1.14-3ubuntu3_amd64.deb ... Unpacking libxcb-xinput0:amd64 (1.14-3ubuntu3) ... Selecting previously unselected package libqt5gui5:amd64. Preparing to unpack .../08-libqt5gui5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5gui5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libqt5widgets5:amd64. Preparing to unpack .../09-libqt5widgets5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5widgets5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libqt5svg5:amd64. Preparing to unpack .../10-libqt5svg5_5.15.3-1_amd64.deb ... Unpacking libqt5svg5:amd64 (5.15.3-1) ... Selecting previously unselected package libqt5sql5:amd64. Preparing to unpack .../11-libqt5sql5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5sql5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libqt5help5:amd64. Preparing to unpack .../12-libqt5help5_5.15.3-1_amd64.deb ... Unpacking libqt5help5:amd64 (5.15.3-1) ... Selecting previously unselected package libqt5opengl5:amd64. Preparing to unpack .../13-libqt5opengl5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5opengl5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libqt5printsupport5:amd64. Preparing to unpack .../14-libqt5printsupport5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5printsupport5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libqt5x11extras5:amd64. Preparing to unpack .../15-libqt5x11extras5_5.15.3-1_amd64.deb ... Unpacking libqt5x11extras5:amd64 (5.15.3-1) ... Selecting previously unselected package libqt5xml5:amd64. Preparing to unpack .../16-libqt5xml5_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5xml5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package virtualbox-7.0. Preparing to unpack .../17-virtualbox-7.0_7.0.8-156879~Ubuntu~jammy_amd64.deb ... Unpacking virtualbox-7.0 (7.0.8-156879~Ubuntu~jammy) ... Selecting previously unselected package libqt5sql5-sqlite:amd64. Preparing to unpack .../18-libqt5sql5-sqlite_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking libqt5sql5-sqlite:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package libsdl1.2debian:amd64. Preparing to unpack .../19-libsdl1.2debian_1.2.15+dfsg2-6_amd64.deb ... Unpacking libsdl1.2debian:amd64 (1.2.15+dfsg2-6) ... Selecting previously unselected package libsdl-ttf2.0-0:amd64. Preparing to unpack .../20-libsdl-ttf2.0-0_2.0.11-6_amd64.deb ... Unpacking libsdl-ttf2.0-0:amd64 (2.0.11-6) ... Selecting previously unselected package qt5-gtk-platformtheme:amd64. Preparing to unpack .../21-qt5-gtk-platformtheme_5.15.3+dfsg-2ubuntu0.2_amd64.deb ... Unpacking qt5-gtk-platformtheme:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Selecting previously unselected package qttranslations5-l10n. Preparing to unpack .../22-qttranslations5-l10n_5.15.3-1_all.deb ... Unpacking qttranslations5-l10n (5.15.3-1) ... Setting up libdouble-conversion3:amd64 (3.1.7-4) ... Setting up libxcb-xinput0:amd64 (1.14-3ubuntu3) ... Setting up libpcre2-16-0:amd64 (10.40-1+ubuntu22.04.1+deb.sury.org+1) ... Setting up libxcb-xinerama0:amd64 (1.14-3ubuntu3) ... Setting up qttranslations5-l10n (5.15.3-1) ... Setting up libsdl1.2debian:amd64 (1.2.15+dfsg2-6) ... Setting up libqt5core5a:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5dbus5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libmd4c0:amd64 (0.4.8-1) ... Setting up libsdl-ttf2.0-0:amd64 (2.0.11-6) ... Setting up libqt5network5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5sql5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5xml5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5sql5-sqlite:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5gui5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5widgets5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5help5:amd64 (5.15.3-1) ... Setting up qt5-gtk-platformtheme:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5printsupport5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5opengl5:amd64 (5.15.3+dfsg-2ubuntu0.2) ... Setting up libqt5x11extras5:amd64 (5.15.3-1) ... Setting up libqt5svg5:amd64 (5.15.3-1) ... Setting up virtualbox-7.0 (7.0.8-156879~Ubuntu~jammy) ... Adding group `vboxusers' (GID 143) ... Done. vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong. There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfig as root. If your system is using EFI Secure Boot you may need to sign the kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load them. Please see your Linux system's documentation for more information. Processing triggers for desktop-file-utils (0.26-1ubuntu3) ... Processing triggers for hicolor-icon-theme (0.17-2) ... Processing triggers for gnome-menus (3.36.0-1ubuntu3) ... Processing triggers for libc-bin (2.35-0ubuntu3.1) ... Processing triggers for shared-mime-info (2.1-2) ... Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
Step 4: Verify Installation
After the installation is complete, you can verify if VirtualBox is installed correctly. Open VirtualBox from the Applications menu or by running the command virtualbox in the terminal. If VirtualBox opens without any errors, it means the installation was successful.
Step 5: Install VirtualBox Extension Pack (Optional)
The VirtualBox Extension Pack provides additional features and functionality, such as USB 2.0/3.0 support, VirtualBox Remote Desktop Protocol (VRDP) support, and more. To install the extension pack, download it from the VirtualBox website (https://www.virtualbox.org/wiki/Downloads), then open VirtualBox and go to File -> Preferences -> Extensions. Click on the “Add Package” button and select the downloaded extension pack.
Step 6: Optional – Add User to VirtualBox Group
To use USB devices and access other advanced features in VirtualBox without using sudo, you can add your user to the vboxusers group. Run the following command:
sudo usermod -aG vboxusers <username>
Replace <your_username> with your actual username, as shown below :
ramans@dev01:~$ sudo usermod -aG vboxusers ramans
Conclusion
By following these steps, you can easily install VirtualBox on your Ubuntu machine. VirtualBox provides a powerful platform for running virtual machines and exploring different operating systems and applications. Enjoy the flexibility and convenience of virtualization with VirtualBox on Ubuntu!