How to Install VirtualBox on CentOS 8 Linux
In the following tutorial, we will install VirtualBox on CentOS 8 / CentOS Stream.
We can install VirtualBox on CentOS Linux 8 using the
dnf install command after setting up the VirtualBox repository. We also need to install the VirtualBox Extension Pack, which provides some extra functionality for our virtual machine environment.
Create VirtualBox DNF Repository
To set up the dnf repository, we need to create a file called
virtualbox.repo in the
/etc/yum.repos.d directory. Then we need to add the following block to the repo file.
[virtualbox] name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
We can do this by using one single command as follows:
wget -P /etc/yum.repos.d https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
dnf repolist command, and you should see the VirtualBox repository in the list.
After adding the repository, run the
dnf search command to get the list of VirtualBox versions available for CentOS 8.
dnf -y search virtualbox
In my case, I have VirtualBox-6.1 as the latest version.
We will install it by running the following command:
dnf -y install VirtualBox-6.1.x86_64
After installing VirtualBox, add your user account(or any other user who wants to run VirtualBox) to the vboxusers group.
gpasswd -a user_name vboxusers
Downloading and installing the Extension Pack
Go to the following URL www.virtualbox.org/wiki/Downloads and click the All supported platforms link under the section " … Oracle VM VirtualBox Extension Pack".
Select Open with Oracle VM VirtualBox and click OK.
Confirm that you want to install the extension pack.
The extension pack provides VirtualBox's virtual machine extra features, such as USB 2.0 and 3.0 support, RDP, shared clipboard, and several interesting features.