This tutorial shows how to install Oracle VirtualBox in Ubuntu 22.04 and/or Ubuntu 23.10.
VirtualBox is a popular free open-source tool for running different operating systems in virtual machines.
The tool is available in Ubuntu system repositories, but old. So, here’s the step by step how to install guide for latest version for beginners.
NOTE: VirtualBox so far only support x86_64 (amd64) CPU architecture type. Meaning for modern Intel & AMD CPUs.
Step 1: Download & Install the .deb package (Optional)
Oracle provides official .deb & .rpm packages for installing the software in Debian/Ubuntu & Fedora based systems.
User can select download the package by going to its website via the link below:
For Ubuntu 22.04, 23.04, 23.10, and their based systems, such as Linux Mint 21, just select download the package for ‘Ubuntu 22.04’.
Then, either double click or use right-click menu “Open With Other Application“, to select open the .deb
package you downloaded via Software Install.
Ubuntu 23.10 so far does NOT have “Software Install”. In the case, press Ctrl+Alt+T on keyboard to open terminal, and run command to install the downloaded package:
sudo apt install ~/Downloads/virtualbox-*amd64.deb
Once installed, search for and launch it either from start menu or ‘Activities’ overview depends on your desktop environment.
Step 2: Add VirtualBox repository to keep it up-to-date
The .deb package you installed via ‘Step 1’ used to automatically add the repository. However, it does NO longer do the trick in recent versions.
So, here’s how to do it step by step via the new Ubuntu PPA policy.
1. Download & install the key
First, press Ctrl+Alt+T on keyboard to open up a terminal window.
When it opens, run command to make sure “/etc/apt/keyrings” directory exist:
sudo mkdir -p /etc/apt/keyrings
Then, run command to use wget
to download key, dearmor it (so unreadable), and finally save it to that directory:
wget -q -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /etc/apt/keyrings/oracle-virtualbox-2016.gpg
You can finally verify the key file, by running command:
cat /etc/apt/keyrings/oracle-virtualbox-2016.gpg
As the screenshot above shows you, it should outputs unreadable text.
2. Add VirtualBox repository
Before adding the source repository, first run command to get system code name:
cat /etc/os-release
The apt repository so far only support Debian Stable (& old stable), Ubuntu 22.04 & 20.04 LTS (focal, jammy). For all their based systems, use the code-name you got via this command.
Then, in terminal window, run command to create & edit a sources file:
sudo nano /etc/apt/sources.list.d/virtualbox.sources
Then in the terminal window, paste following lines:
Types: deb URIs: https://download.virtualbox.org/virtualbox/debian Suites: jammy Components: contrib Architectures: amd64 Signed-By: /etc/apt/keyrings/oracle-virtualbox-2016.gpg
Replace jammy (for 22.04, Mint 21.x) according to last command output. The repository does not support for Ubuntu 23.10 (mantic), 23.04 (lunar), so just use jammy for them.
When done, press either Ctrl+S or Ctrl+O and hit Enter to save file, then press Ctrl+X to exit.
Finally, verify the sources file by running command:
cat /etc/apt/sources.list.d/virtualbox.sources
It should outputs the content you just added into that file.
3. Update system package cache
After setup the source repository, run command to refresh your system package cache:
sudo apt update
The terminal output should print a line looks like:
“Hit:5 https://download.virtualbox.org/virtualbox/debian jammy InRelease”
4. Install or Update Virtualbox
If you skipped the “Step 1”, then you can install it (7.0.x series at the moment) by running command in terminal:
sudo apt install virtualbox-7.0
Finally, when a newer release is out, you’ll be able to update it through Software Updater (Update Manager) tool.
Uninstall
To remove VirtualBox, open terminal (Ctrl+Alt+T) window and run command:
sudo apt remove --autoremove virtualbox virtualbox-7.0
And, remove the source repository by simply deleting the key & sources files:
sudo rm /etc/apt/keyrings/oracle-virtualbox-2016.gpg /etc/apt/sources.list.d/virtualbox.sources
Also, run sudo apt update
to refresh package cache.
The post How to Install VirtualBox 7.0.x in Ubuntu 22.04/23.10 & Keep it Updated appeared first on Osgrove.
Discover more from Ubuntu-Server.com
Subscribe to get the latest posts sent to your email.