How to Install VirtualBox in CentOS 6.3

Home » Linux » How to Install VirtualBox in CentOS 6.3
Linux 1 Comment

You want to run a Windows Virtual Machine in your CentOS computer? or want to try out another linux distribution without going through the hassle of installing the whole system? Here is a solution. VirtualBox is a very easy to use open source virtualization software package developed by Oracle. So in this article i will guide you through the process of installing virtualbox in a CentOS computer.

* First up you have to download and install the rpmforge repository in your computer. Download the appropriate version that matches your host’s architecture.


Installing these rpms is very easy in CentOS. Just open the rpm file and rpm manager will take care of the installation process.

* Get the root access. Type

“su” and enter the password when prompted. 

* Now install the DAG’s GPG key. Type

rpm –import

* Install DKMS and it’s dependencies. (DKMS has some important dependencies like kernel-headers kernel-devel etc) Type

yum install dkms

* Along the installation you will be prompted for some “yes or no” questions. Type y and continue

Now we are going to add the virtualbox repo to the yum repository. This way you can install and update virtualbox through yum.

*  Navigate to /etc/yum.repos.d directory. Type

cd /etc/yum.repos.d 

* Add the virtualbox repo to yum


* Now we have to install virtualbox. Type

yum install VirtualBox-4.1

* Again the system will prompt you for some yes or no questions along the installation process. Type y and continue.

* Check your Kernel version. Type

uname -r

* Check /usr/src/kernels to confirm that a directory for your current kernel version exists. Type

ls /usr/src/kernels

If the result of this matches up with the output from “uname -r” you are good.

* Now specify the KERN_DIR environment variable. Type


export KERN_DIR

* Rebuild the Kernel modules. Type

/etc/init.d/vboxdrv setup (Instead you can use “service vboxdrv setup” too)

* Add yourself to the VirtualBox user group. Type

usermod -a -G vboxusers “your_user_name”

(Type your OS login username instead of the “your_user_name”)


That should do it. Now go ahead and fire up VirtualBox and it should work perfectly. Let me know if you have any questions.


Facebook Twitter

One thought on “How to Install VirtualBox in CentOS 6.3”

  • This worked well, and I’ll note it uses RPMForge, which CentOS recommends as generally ‘safe’ (meaning it doesn’t interfere with CentOS packages as some other source may).