CentLinux | Learn How to Install CentOS/Rocky Linux Servers

Saturday, October 29, 2022

How to install VirtualBox on Rocky Linux 9

How to install VirtualBox 7.0 on Rocky Linux 9

In this configuration guide, you will learn how to install VirtualBox on Rocky Linux 9.

 

Table of Contents:

 

What is VirtualBox?:

Oracle VM VirtualBox (formerly Sun VirtualBox, Sun xVM VirtualBox and Innotek VirtualBox) is a type-2 hypervisor for x86 virtualization developed by Oracle Corporation.

VirtualBox was originally created by Innotek GmbH, which was acquired by Sun Microsystems in 2008, which was in turn acquired by Oracle in 2010.

VirtualBox may be installed on Microsoft Windows, macOS, Linux, Solaris and OpenSolaris. There are also ports to FreeBSD and Genode. It supports the creation and management of guest virtual machines running Windows, Linux, BSD, OS/2, Solaris, Haiku, and OSx86, as well as limited virtualization of macOS guests on Apple hardware. For some guest operating systems, a "Guest Additions" package of device drivers and system applications is available, which typically improves performance, especially that of graphics, and allows changing the resolution of the guest OS automatically when the window of the virtual machine on the host OS is resized.

Released under the terms of the GNU General Public License and, optionally, the CDDL for most files of the source distribution, VirtualBox is free and open-source software, though the Extension Pack is proprietary software. The License to VirtualBox was relicensed to GPLv3 with linking exceptions to the CDDL and other GPL incompatible licenses.


Environment Specification:

We are using a minimal Rocky Linux 9 virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Rocky Linux release 9.0 (Blue Onyx)
  • Hostname – virtualbox-01.centlinux.com
  • IP Address - 192.168.116.131/24

 

Checking CPU Support for Virtualization:

By using a ssh client, connect with your Linux server as root user.

By executing lscpu command, you can easily verify that, Is your CPU is supporting virtualization or not?

# lscpu | grep Virtualization
Virtualization:                  VT-x
Virtualization type:             full

If you get the above output, then it means that your CPU supports virtualization and you can setup a KVM virtualization host thereon.

However, if the above command returns no result on your server then:

  • In case of bare-metal machine, you have to enable the VT support from system BIOS.
  • In case of virtual machine, you have to enable the VT support from VM's CPU Settings.

 

Setting Machine Hostname:

By using hostnamectl command, set the hostname of your Linux server.

# hostnamectl set-hostname virtualbox-01.centlinux.com

 

Updating Linux Software Packages:

Refresh cache of your enabled yum repositories with the help of dnf command.

# dnf makecache --refresh
Rocky Linux 9 - BaseOS                          376 kB/s | 1.7 MB     00:04
Rocky Linux 9 - AppStream                       398 kB/s | 6.0 MB     00:15
Rocky Linux 9 - Extras                          1.5 kB/s | 2.9 kB     00:01
Metadata cache created.

Now, execute following command to update your Linux software packages.

# dnf update -y

The above command may also updates your Linux Kernel. In this case, you should reboot your operating system with the new Linux Kernel.

# reboot

Check the versions of your Linux operating system and Kernel as follows.

# cat /etc/rocky-release
Rocky Linux release 9.0 (Blue Onyx)

# uname -r
5.14.0-70.26.1.el9_0.x86_64

 

Installing EPEL Yum Repository:

Some required packages of VirtualBox software are not available in Standard yum repositories.

Therefore, you need to install EPEL (Extra Packages for Enterprise Linux) yum repository.

# dnf install -y epel-release

 

Installing VirtualBox Yum Repository:

VirtualBox RPM packages are available at https://www.virtualbox.org/wiki/Linux_Downloads.

oracle-vm-virtualbox-downloads

Besides that Vendor also provides an official yum repository for Red Hat based Linux distros.

You can download virtualbox.repo file and place it in /etc/yum.repos.d directory for immediate addition to dnf repolist.

# wget https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo
--2022-10-28 21:46:47--  https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
Resolving download.virtualbox.org (download.virtualbox.org)... 23.36.48.85
Connecting to download.virtualbox.org (download.virtualbox.org)|23.36.48.85|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 259 [text/plain]
Saving to: ‘/etc/yum.repos.d/virtualbox.repo’

/etc/yum.repos.d/vi 100%[===================>]     259  --.-KB/s    in 0s

2022-10-28 21:46:49 (875 KB/s) - ‘/etc/yum.repos.d/virtualbox.repo’ saved [259/259]

You have added new yum repositories, therefore, you should rebuild your yum cache now.

# dnf makecache
Extra Packages for Enterprise Linux 9 - x86_64  658 kB/s |  11 MB     00:16
Rocky Linux 9 - BaseOS                          990  B/s | 3.6 kB     00:03
Rocky Linux 9 - AppStream                       1.9 kB/s | 3.6 kB     00:01
Rocky Linux 9 - Extras                          873  B/s | 2.9 kB     00:03
Oracle Linux / RHEL / CentOS-9 / x86_64 - Virtu 174  B/s | 181  B     00:01
Oracle Linux / RHEL / CentOS-9 / x86_64 - Virtu 1.3 kB/s | 1.7 kB     00:01
Importing GPG key 0x98AB5139:
 Userid     : "Oracle Corporation (VirtualBox archive signing key) <info@virtualbox.org>"
 Fingerprint: 7B0F AB3A 13B9 0743 5925 D9C9 5442 2A4B 98AB 5139
 From       : https://www.virtualbox.org/download/oracle_vbox.asc
Is this ok [y/N]: y
Oracle Linux / RHEL / CentOS-9 / x86_64 - Virtu  36 kB/s |  33 kB     00:00
Metadata cache created.

 

Installing VirtualBox Prerequisites:

You have successfully setup required yum repositories on your Rocky Linux server. Therefore, you can now easily install all VirtualBox prerequisites by executing a single dnf command.

# dnf -y install kernel-devel kernel-headers glibc-headers glibc-devel binutils libgomp make patch gcc dkms

 

Installing VirtualBox 7.0:

Search for the available versions of VirtualBox by using dnf command.

# dnf search virtualbox
Last metadata expiration check: 0:07:29 ago on Fri 28 Oct 2022 09:49:34 PM CDT.
====================== Name & Summary Matched: virtualbox ======================
VirtualBox-6.1.x86_64 : Oracle VM VirtualBox
VirtualBox-7.0.x86_64 : Oracle VM VirtualBox

You can now install VirtualBox 7.0 on your Linux server by executing following command.

# dnf install -y VirtualBox-7.0

The VirtualBox installation process creates a systemd unit vboxdrv.service.

Check the status of vboxdrv.service.

# systemctl status vboxdrv.service
● vboxdrv.service - VirtualBox Linux kernel module
     Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: di>
     Active: active (exited) since Fri 2022-10-28 22:07:30 CDT; 2min 12s ago
    Process: 718 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, s>
        CPU: 30.588s

Oct 28 22:06:35 virtualbox-01.centlinux.com systemd[1]: Starting VirtualBox Lin>
Oct 28 22:07:11 virtualbox-01.centlinux.com vboxdrv.sh[718]: vboxdrv.sh: Starti>
Oct 28 22:07:30 virtualbox-01.centlinux.com vboxdrv.sh[899]: VirtualBox service>
Oct 28 22:07:30 virtualbox-01.centlinux.com systemd[1]: Started VirtualBox Linu>

VirtualBox 7.0 has been successfully installed on your Rocky Linux 9 machine.

 

Installing VirtualBox 7.0 Extension Pack:

VirtualBox extension pack extends the VirtualBox support for VirtualBox RDP, disk encryption, NVMe and PXE boot for Intel cards.

You can download VirtualBox 7.0 Extension Pack for your preferred Linux distribution from VirtualBox website.

Alternatively, you can use wget command to download VirtualBox Extension Pack direct from Linux commandline.

# cd /tmp
# wget https://download.virtualbox.org/virtualbox/7.0.2/Oracle_VM_VirtualBox_Extension_Pack-7.0.2.vbox-extpack
--2022-10-28 22:12:52--  https://download.virtualbox.org/virtualbox/7.0.2/Oracle_VM_VirtualBox_Extension_Pack-7.0.2.vbox-extpack
Resolving download.virtualbox.org (download.virtualbox.org)... 104.119.104.89
Connecting to download.virtualbox.org (download.virtualbox.org)|104.119.104.89|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 18515967 (18M) [text/plain]
Saving to: ‘Oracle_VM_VirtualBox_Extension_Pack-7.0.2.vbox-extpack’

Oracle_VM_VirtualBo 100%[===================>]  17.66M  1.22MB/s    in 15s

2022-10-28 22:13:08 (1.19 MB/s) - ‘Oracle_VM_VirtualBox_Extension_Pack-7.0.2.vbox-extpack’ saved [18515967/18515967]

Now, install VirtualBox extension pack by executing following Linux command.

# VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-7.0.2.vbox-extpack
VirtualBox Extension Pack Personal Use and Evaluation License (PUEL)

License version 11, 21 May 2020

PLEASE READ THE FOLLOWING ORACLE VM VIRTUALBOX EXTENSION PACK PERSONAL
USE AND EVALUATION LICENSE CAREFULLY BEFORE DOWNLOADING OR USING THE
ORACLE SOFTWARE. THESE TERMS AND CONDITIONS CONSTITUTE A LEGAL AGREEMENT
BETWEEN YOU AND ORACLE.

ORACLE AMERICA, INC. ("ORACLE") IS WILLING TO LICENSE THE PRODUCT DEFINED
IN SECTION 1 BELOW ONLY ON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS
CONTAINED IN THIS VIRTUALBOX EXTENSION PACK PERSONAL USE AND EVALUATION
LICENSE AGREEMENT ("AGREEMENT").

IF YOU ARE AGREEING TO THIS LICENSE ON BEHALF OF AN ENTITY (RATHER THAN
AS AN INDIVIDUAL HUMAN BEING), YOU REPRESENT THAT YOU HAVE THE APPROPRIATE
AUTHORITY TO ACCEPT THESE TERMS AND CONDITIONS ON BEHALF OF SUCH ENTITY.

1 SUBJECT OF AGREEMENT. This Agreement governs your use of the binary
software package called "Oracle VM VirtualBox Extension Pack" (the
"Product"), which contains a set of additional features for "Oracle
VM VirtualBox" that enhance the operation of multiple virtual machines
("Guest Computers") on a single physical computer ("Host Computer"). The
Product consists of executable files in machine code, script files,
data files, and all documentation and updates provided to You by Oracle.

2 GRANT OF LICENSE. Oracle grants you a personal, non-exclusive,
non-transferable, limited license without fees to reproduce, install,
execute, and use internally the Product on Host Computers for
your Personal Use, Educational Use, or Evaluation. "Personal Use"
is noncommercial use solely by the person downloading the Product
from Oracle on a single Host Computer, provided that no more than one
client or remote computer is connected to that Host Computer and that
client or remote computer is used solely to remotely view the Guest
Computer(s). "Educational Use" is any use by teachers or students in
an academic institution (schools, colleges and universities) as part of
the institution's educational curriculum. "Evaluation" means testing the
Product for up to thirty (30) days; after expiry of that term, you are
no longer permitted to use the Product. Personal Use and/or Educational
Use expressly exclude any use of the Product for commercial purposes or
to operate, run, or act on behalf of or for the benefit of a business,
organization, governmental organization, or educational institution.

Oracle reserves all rights not expressly granted in this license.

3 RESTRICTIONS AND RESERVATION OF RIGHTS.

(1) The Product and copies thereof provided to you under this Agreement
are copyrighted and licensed, not sold, to you by Oracle.

(2) You may not do any of the following: (a) modify any part of the
Product, except to the extent allowed in the documentation accompanying
the Product; (b) rent, lease, lend, re-distribute, or encumber the
Product; (c) remove or alter any proprietary legends or notices contained
in the Product; or (d) decompile, or reverse engineer the Product
(except to the extent permitted by applicable law).

(3) The Product is not designed, licensed or intended for use in the
design, construction, operation or maintenance of any nuclear facility
and Oracle and its licensors disclaim any express or implied warranty
of fitness for such uses.

(4) No right, title or interest in or to any trademark, service mark, logo
or trade name of Oracle or its licensors is granted under this Agreement.

4 TERMINATION. The Agreement is effective on the date you receive the
Product and remains effective until terminated. Your rights under this
Agreement will terminate immediately without notice from Oracle if
you materially breach it or take any action in derogation of Oracle's
and/or its licensors' rights to the Product. Oracle may terminate this
Agreement immediately should any part of the Product become or in Oracle's
reasonable opinion likely to become the subject of a claim of intellectual
property infringement or trade secret misappropriation. Upon termination,
you will cease use of and destroy all copies of the Product under your
control and confirm compliance in writing to Oracle. Neither termination
of this Agreement nor any deletion or removal of the Product shall limit
any obligations you may have to Oracle, or any rights and/or remedies that
Oracle may have with respect to any past or future infringing use of the
Product (including but not limited to any use of the Product outside the
scope of the license provided in the Agreement). Sections 3-9, inclusive,
will survive termination of the Agreement.

5 DISCLAIMER OF WARRANTY. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW,
ORACLE PROVIDES THE PRODUCT "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED. WITHOUT LIMITING THE FOREGOING, ORACLE SPECIFICALLY
DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT. The entire risk as
to the quality and performance of the Product is with you. Should it
prove defective, you assume the cost of all necessary servicing, repair,
or correction.

6 LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW,
IN NO EVENT WILL ORACLE OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
PROFIT, DATA, OR DATA USE, OR FOR SPECIAL, INDIRECT, CONSEQUENTIAL,
INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED REGARDLESS OF THE THEORY
OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR INABILITY TO
USE THE PRODUCT, EVEN IF ORACLE HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES. In no event will Oracle's liability to you, whether in
contract, tort (including negligence), or otherwise, exceed the amount
paid by you for the Product under this Agreement.

7 SEPARATELY LICENSED THIRD PARTY TECHNOLOGY. The Product may contain
or require the use of third party technology that is provided with
the Product. Oracle may provide certain notices to you in the Product's
documentation, readmes or notice files in connection with such third party
technology. Third party technology will be licensed to you either under
the terms of this Agreement or, if specified in the documentation, readmes
or notice files, under Separate Terms. Your rights to use Separately
Licensed Third Party Technology under Separate Terms are not restricted
in any way by this Agreement. However, for clarity, notwithstanding the
existence of a notice, third party technology that is not Separately
Licensed Third Party Technology shall be deemed part of the Product and
is licensed to You under the terms of this Agreement. "Separate Terms"
refers to separate license terms that are specified in the Product's
documentation, readmes or notice files and that apply to Separately
Licensed Third Party Technology. "Separately Licensed Third Party
Technology" refers to third party technology that is licensed under
Separate Terms and not under the terms of this Agreement.

8 EXPORT. Export laws and regulations of the United States and any other
relevant local export laws and regulations apply to the Product. You
agree that such export laws govern your use of the Product (including
technical data) provided under this Agreement, and you agree to comply
with all such export laws and regulations (including "deemed export" and
"deemed re-export" regulations). You agree that no data, information,
and/or Product (or direct product thereof) will be exported, directly or
indirectly, in violation of these laws, or will be used for any purpose
prohibited by these laws including, without limitation, nuclear, chemical,
or biological weapons proliferation, or development of missile technology.

9 U.S. GOVERNMENT END USERS. Oracle programs, including the Product,
any operating system, integrated software, any programs installed on
hardware, and/or documentation, delivered to U.S. Government end users
are "commercial computer software" pursuant to the applicable Federal
Acquisition Regulation and agency-specific supplemental regulations. As
such, use, duplication, disclosure, modification, and adaptation of
the programs, including any operating system, integrated software,
any programs installed on the hardware, and/or documentation, shall
be subject to license terms and license restrictions applicable to the
programs. No other rights are granted to the U.S. Government.

10 MISCELLANEOUS. This Agreement is the entire agreement between you
and Oracle relating to its subject matter. It supersedes all prior or
contemporaneous oral or written communications, proposals, representations
and warranties and prevails over any conflicting or additional terms
of any quote, order, acknowledgment, or other communication between
the parties relating to its subject matter during the term of this
Agreement. No modification of this Agreement will be binding, unless in
writing and signed by an authorized representative of each party. If any
provision of this Agreement is held to be unenforceable, this Agreement
will remain in effect with the provision omitted, unless omission would
frustrate the intent of the parties, in which case this Agreement will
immediately terminate. This Agreement is governed by the laws of the
State of California, USA, and you and Oracle agree to submit to the
exclusive jurisdiction of, and venue in, the courts of San Francisco
or Santa Clara counties in California in any dispute arising out of or
relating to this Agreement. Upon 45 days written notice, Oracle may
audit your use of the Product to confirm that you are in compliance
with the terms of this Agreement. You agree to cooperate with Oracle's
audit and provide reasonable assistance and access to information. Any
such audit shall not unreasonably interfere with your normal business
operations. You agree to pay within 30 days of written notification
any fees applicable to your unlicensed use of the Product. You agree
that Oracle shall not be responsible for any of your costs incurred in
cooperating with the audit. If a legal action or proceeding is commenced
by either party in connection with the enforcement of this Agreement,
the prevailing party shall be entitled to its costs and attorneys'
fees actually incurred in connection with such action or proceeding.

Do you agree to these license terms and conditions (y/n)? y

License accepted. For batch installation add
--accept-license=33d7284dc4a0ece381196fda3cfe2ed0e1e8e7ed7f27b9a9ebc4ee22e24bd23c
to the VBoxManage command line.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully installed "Oracle VM VirtualBox Extension Pack".

VirtualBox 7.0 Extension Pack has been installed on your Rocky Linux server.

Although, it is quiet convenient to use VirtualBox in a Graphical User Interface (GUI). But you can also manage your VirtualBox environment on a headless server from Linux commandline (CLI).

For this purpose, VirtualBox provides a set of commands prefixed with vbox*.

If you want to learn more about Oracle VirtualBox, then you should read VirtualBox Made Easy: Virtualize Your Environment with Ease (Computers Made Easy) by James Bernstein.

 

Conclusion:

By following this configuration guide, you have successfully installed Oracle VirtualBox on Rocky Linux 9 server.

If you find this article useful? Consider supporting us by Buy Me A Coffee


2 comments:

  1. I have an error because `modprobe vboxdrv` failed.

    ReplyDelete
    Replies
    1. The command you are executing is not mentioned in above tutorial. Therefore, there isn't any need to execute this command.

      Delete

© 2023 CentLinux. All Rights Reserved.