Use your favorite text editor (e.g., nano
or vi
) to create a new .repo
file:
sudo nano /etc/yum.repos.d/virtualbox.repo
Add the following lines to the file:
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=https://download.virtualbox.org/virtualbox/rpm/fedora/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
If you're using nano
, press Ctrl+O
, hit Enter to save, and then Ctrl+X
to exit.
Run the following commands:
sudo dnf clean all
sudo dnf makecache
Confirm the repository is added:
sudo dnf repolist
Finally, install VirtualBox:
sudo dnf install VirtualBox