Install Oracle VirtualBox on CentOS/RedHat 6/5


Oracle VirtualBox is a cross-platform virtualization application(windows/linux). It extends the capabilities of your existing operating system so that it can run multiple operating systems at the same time.

Here we are going to see how to install VirtualBox on CentOS/RHEL using repoistory.

Step 1: Required yum repositories

First we need to create VirtualBox yum repository on linux server.

[root@server.local ~]#cd /etc/yum.repos.d/
[root@server.local ~]#wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

Download and install CentOS/RHEL EPEL repository

CentOS/RHEL 6, 32 Bit (i386):
[root@server.local ~]#rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

CentOS/RHEL 6, 64 Bit x86_64):
[root@server.local ~]#rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

CentOS/RHEL 5, 32 Bit (i386):
[root@server.local ~]#rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

CentOS/RHEL 5, 64 Bit (x86_64):
[root@server.local ~]#rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Step 2: Install dependency packages

Oracle VirtualBox requried some dependency packages to run virtualbox.

[root@server.local ~]#yum install gcc make patch dkms qt libgomp
[root@server.local ~]#yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel

Step 3: Environment variable configuration

VirtualBox installation required kernel source code to install required modues, so we need to configure environment variable KERN_DIR.

[root@server.local ~]#KERN_DIR=/usr/src/kernels/2.6.32-220.2.1.el6.i686
[root@server.local ~]#export KERN_DIR

Step 4: Install VirtualBox

The below command is used to install Oracle VirtualBox

[root@server.local ~]#yum install VirtualBox-4.3

Finally re-run vboxdrv setup. This step may take a while to complete:

[root@server.local ~]#/etc/init.d/vboxdrv setup

Step 5: Start VirtualBox

Use following command to start VirtualBox from X windows. You can switch to GUI mode using init 5 or startx commands from terminal.

[root@server.local ~]# virtualbox &