
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to Install VirtualBox on CentOS?
VirtualBox is an open-source, cross-platform virtualization tool by Oracle which allows us to create and run multiple operating systems simultaneously on a single physical machine.
As a Type-2 Hypervisor, VirtualBox is installed on top of an operating system such as Windows, Linux or Mac and provides both headless interface and GUI (Graphical User Interface) for creating and managing virtual machines.
Installing VirtualBox
Step-by-step process for installing VirtualBox on a CentOS 9 machine is as follows:
Initially, check if your system supports virtualization with the command below:
$ lscpu | grep -i virtualization Virtualization type: full $
In case, there's no output after this command, then you need to enable virtualization from BIOS settings.
Make sure to update your system with the latest available packages before proceeding further. If there are Kernel related updates, ensure to reboot the system.
$ sudo dnf update
Add the VirtualBox official package repository on your Linux system using the command below:
$ sudo dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
Next, import VirtualBox public key using rpm --import command:
$ sudo rpm --import https://www.virtualbox.org/download/oracle_vbox.asc
We also need to enable EPEL repository for additional packages that will be needed for VirtualBox installation to succeed. You can install and enable EPEL repository for CentOS 9, if not already available and enabled, using the command below:
$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
There are some packages that must be available on your system for VirtualBox setup to complete, including packages required for building of custom Kernel modules for VirtualBox, which can be installed as below:
$ sudo dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms
We can now look for available VirtualBox versions from its official repository using dnf search command.
$ sudo dnf search virtualbox Last metadata expiration check: 0:01:34 ago on Thursday 28 November 2024 12:11:14 PM. =========================================================================== Name & Summary Matched: virtualbox =========================================================================== VirtualBox-6.1.x86_64 : Oracle VM VirtualBox VirtualBox-7.0.x86_64 : Oracle VM VirtualBox VirtualBox-7.1.x86_64 : Oracle VirtualBox $
From the list of versions available from last command, choose the required version from the list and install it using dnf install command as shown below:
$ sudo dnf install VirtualBox-7.0
Post installation of VirtualBox package, build the required kernel modules for VirtualBox by using the vboxconfig command:
$ sudo /sbin/vboxconfig
For additional functionality, you can install VirtualBox Extension Pack. First download extension pack binary package (extpack) matching your VirtualBox's version using wget command.
$ wget https://download.virtualbox.org/virtualbox/7.0.0/Oracle_VM_VirtualBox_Extension_Pack-7.0.0.vbox-extpack
Next, you can run VBoxManage command to install the Extension Pack. During the VirtualBox Extension Pack installation, you will need to accept license terms and conditions in between to complete the Extension Pack installation. VirtualBox Extension Pack can also be installed from its GUI as a later step, if needed.
$ sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.2.vbox-extpack
(Optional) Once VirtualBox installation is completed, you can add the local user to vboxusers group to allow a user to access the USB subsystem from VirtualBox. You would need to logout and login from your user session on CentOS for the change to be effective.
$ sudo usermod -aG vboxusers $USER
You should now be able to launch VirtualBox by clicking on Activities menu and searching for Oracle VM VirtualBox or typing virtualbox& in a terminal window.
Using the GUI interface, you can start creating and installing new virtual machines on VirtualBox or import existing VMs. VirtualBox also offers extensive CLI support to manage these virtual machines from its terminal window or via SSH sessions.
Conclusion
VirtualBox is one of the most popular virtualization platforms available which is free to use and is available for most common operating systems. Using VirtualBox to create VMs is relatively simple task for anyone with basic knowledge of operating systems, using its graphical interface while offering a stable platform to the end user.
This article covered how to install VirtualBox on CentOS 9 using its official repository.