CentOS 7 – Setting up VirtualBox virtualization on CentOS 7

How to Activate Windows Server 2019

Oracle VirtualBox is a virtualization application that has the capacity to run on multiple computer architectures (Intel, AMD-based systems) and on almost every available OS (OSX, Linux, Windows, Solaris, and so on), where it allows its users to run multiple operating systems on the same physical machine. Basically, virtual box is a full virtualization technology.

Most people count on it while using multiple systems and need to export and import template virtual machines, where virtual box offers a variety of options to exchange virtual machines between all kinds of infrastructures.

Source: http://www.oracle.com

This section will show you how to install Oracle VirtualBox 5.0.2 on CentOS 7. Firstly, we need to add the VirtualBox yum repository to our system. So, we need to create its repo file in the YUM repository directory:

$ sudo nano /etc/yum.repos.d/virtualbox.repo

Then, we need to put the following code into the file and save it:

name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox

We should also have the EPEL repository installed:

$ sudo rpm -ivh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

Before we start the installation, we need to install some necessary packages to make sure that VirtualBox works fine:

$ sudo yum install gcc make kernel-headers kernel-devel fontforge binutils patch  dkms glibc-headers glibc-devel qt libgomp

Then, we set up an environment variable called KERN_DIR, from which VirtualBox will get the kernel source code:

$ export KERN_DIR=/usr/src/kernels/3.10.0-229.14.1.el7.x86_64


My latest kernel version is stored in this directory: 3.10.0-229.14.1.el7.x86_64. It might change over time due to upgrades.

Then, we can start the installation of VirtualBox using YUM:

$ sudo yum install VirtualBox-5.0

After the installation, we need to rebuild the kernel modules using the following command:

$ sudo systemctl start vboxdrv

Now, we have VirtualBox installed and ready for use. Still, VirtualBox only supports graphical interfaces, so we need to have one installed and then we can start it and use it.

We need to have a graphical interface installed on our server and we have a long list to choose from. I would recommend Gnome, as it is one of the most used interfaces with its user-friendliness and its low resources consumption.

Using Gnome as the graphical interface, we can start VirtualBox:

$ sudo virtualbox &

Then, we can go ahead and create a new virtual machine. We give it a name and a type, as shown here:

Next, we proceed to configure the amount of RAM to give it, as shown in the following screenshot:

Then comes the amount of disk space, as follows:

VirtualBox offers some extra services that allow the mouse and the keyboard of the original system to switch between the physical and the virtual machine. To install those tools, we can go to the VM menu, then the Guest option, and then install the virtual machine guest tools. It will take some time to get installed, then we need to restart the virtual machine so that those tools can start working.

To finish, we have our virtual machine ready to be executed, as shown in the following screenshot:

Comments are closed.