Header Ads

How to Install Oracle VirtualBox 5.1 on CentOS/RHEL 7

The Oracle VirtualBox is basically a  virtualization application that runs  on all platforms. What makes it more reliable and commonly used is beause it works well on all computers including the ones with low specs. It can run on Windows, Mac, Linux or Solaris operating systems

The latest VirtualBox version (as of this writing) is 5.1.2 which was released on on July 21st, 2016. This new VirtualBox version has come with an improved stability and fixes a few  regressions.
If you have been reading our past tutorials, we have covered basic installation in all main operating systems, including fixing of some issues that arose when running virtualbox.

This tutorial will help you install Oracle VirtualBox 5.1 on CentOS, Redhat and Fedora systems using Yum.

Add Yum Repositories

The first thing you wanna do is  add VirtualBox yum repository in your system. To do so, Download repository file from the official website and store it in /etc/yum.repos.d/virtualbox.repo .First go to /etc/yum.repos.d/ directory and use one of below commands as per your operating system.

# cd /etc/yum.repos.d/

For CentOS/RHEL Systems:
# wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

For Fedora Systems:
# wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo

If you are using CentOS/RHEL then you need  to add EPEL yum repository by typing the following command.

CentOS/RHEL 7, 64 Bit (x86_64): 
# rpm -Uvh http://download.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm

CentOS/RHEL 6, 64 Bit (x86_64): 

# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Install Packages

Before you install VirtualBox, you need to  make sure to install all required packages to run VirtualBox like kernel-headers, kernel-devels etc.This can be done by typing in the following commands

# yum install gcc make patch  dkms qt libgomp

# yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel

 Setting up Environment Variable

Installing VirtualBox requires kernel source code to install required modules, So you first  need to configure environment variables KERN_DIR this is where VirtualBox will get kernel source code. In my case latest kernel source can be found at 2.6.32-504.3.3.el6.x86_64 directory under /usr/src/kernels/ . Make sure you are using correct source path.

# export KERN_DIR=/usr/src/kernels/2.6.32-504.3.3.el6.x86_64
Step 4 – Install Oracle VirtualBox and Setup

Use following command for installing VirtualBox 5.1 using the yum command line tool. It will install latest version of VirtualBox 5.1.x

# yum install VirtualBox-5.1

After installation we need to rebuild kernel modules using following command.

# service vboxdrv setup
Step 5 – Start VirtualBox

No comments:

Powered by Blogger.