Quantcast
Viewing all articles
Browse latest Browse all 461

How to Install VirtualBox 5.1 on CentOS 7 / RHEL 7 / Fedora 26

VirtualBox is a free and open-source virtualization software for x86 hardware. It is available for both Windows and Linux like operating system, it is one the most popular virtualization software used at Desktop level. VirtualBox provides a Graphical User interface (GUI) through which we can create and manage virtual machines, apart from this we can also create Snapshots of VMs, Cloning of the VMs and can create our own customize network for the VMs.

In this article we will discuss how to install latest version of VirtualBox (VirtualBox-5.1.26) on CentOS 7 / RHEL7 and Fedora 26.

Installation Steps of VirtualBox-5.1 on CentOS 7 / RHEL 7

Virtualbox rpm package and its dependencies are not available in the default CentOS 7 and RHEL 7 yum repositories, so we have to set virtualbox repository using the beneath command.

[root@linuxtechi ~]# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo -P /etc/yum.repos.d/

Before start installing virtualbox, first we should install all dependencies of virtualbox, some of the dependencies are available in EPEL repository. So let’s first enable epel repository and install the virtualbox dependencies.

Enable EPEL repository and Install all Virtualbox dependencies

[root@linuxtechi ~]# yum install epel-release -y
[root@linuxtechi ~]# yum update -y && reboot
[root@linuxtechi ~]# yum install gcc make patch  dkms qt libgomp kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel  -y

Now Install VirtualBox-5.1 with yum Command

[root@linuxtechi ~]# yum install VirtualBox-5.1 -y

Once the VirtualBox package is installed then rebuild the kernel modules using the following command.

[root@linuxtechi ~]# /usr/lib/virtualbox/vboxdrv.sh setup
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.
[root@linuxtechi ~]#

Above command will automatically create a group with name “vboxusers“. If any local user wants to use virtualbox then he/she has to be part of vboxusers group. Let’s assume ‘linuxtechi’ wants to use virtualbox

[root@linuxtechi ~]# usermod -a -G vboxusers linuxtechi
[root@linuxtechi ~]#

Now try accessing VirtualBox

Image may be NSFW.
Clik here to view.
Access-VirtualBox-CentOS7

Image may be NSFW.
Clik here to view.
VirtualBox-5-1-CentOS7

Note: If you get an error related to ‘KERN_DIR’ while installing and rebuilding kernel module then set the following variable manually and again try to install and rebuild kernel module for VirtualBox.

[root@linuxtechi ~]# export KERN_DIR=/usr/src/kernels/$(uname -r)

Installation steps of VirtualBox-5.1 on Fedora 26

Installation steps of VirtualBox-5.1 on Fedora 26 are similar to CentOS 7 or RHEL 7.  Let’s first set VirtualBox repository using the following wget command.

[linuxtechi@nixworld ~]$ sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -P /etc/yum.repos.d/

Update the repository list using the beneath dnf command.

[linuxtechi@nixworld ~]$ sudo dnf repolist

Image may be NSFW.
Clik here to view.
dnf-repolist-fedora26

Update your system and reboot

[linuxtechi@nixworld ~]$ sudo dnf update -y
[linuxtechi@nixworld ~]$ reboot

After Reboot our system will boot with latest kernel.

Install Virtualbox dependencies with below dnf command

[linuxtechi@nixworld ~]$ sudo dnf install binutils make gcc patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms -y

Now Install VirtualBox 5.1 via dnf command

[linuxtechi@nixworld ~]$ sudo dnf install VirtualBox-5.1 -y

Note: We may get errors while building Kernel modules. After resolving the errors, run the beneath command to rebuild kernel modules for VirtualBox.

[linuxtechi@nixworld ~]$ sudo /usr/lib/virtualbox/vboxdrv.sh setup

Access VirtualBox

Image may be NSFW.
Clik here to view.
Search-VirtualBox-Fedora26

Click on Oracle VM VirtualBox Icon

Image may be NSFW.
Clik here to view.
VirtualBox-Fedora26

This concludes that VirtualBox 5.1 has been installed successfully. Now start creating your machines and manage your virtual environment from virtualbox GUI.


Viewing all articles
Browse latest Browse all 461