Install VirtualBox on CentOS / Scientific Linux

Red Hat Lizard - VirtualBox on Linux

This how-to is about installing VirtualBox on CentOS 6.2. Provided instructions should also work on Scientific Linux and Red Hat Enterprise Linux (RHEL).

It is possible to install VirtualBox from rpm packages, which can be downloaded on the VirtualBox Linux downloads page. However, a yum-style repository is also provided – we'll use the latter.

DKMS, RPMForge, sudo

Before installing VirtualBox, one should install DKMS, as VirtualBox will build its own kernel module. If you didn't install RPMForge, please follow this tutorial first. This howto also supposes that you have added yourself to the sudoers list (of course, you may as well use su or log in as root).

DKMS has some important dependencies like gcc and kernel-devel. Use the following command line to install DKMS and its dependancies:
sudo yum install dkms

Install Virtualbox

Once DKMS an its dependencies are installed, we can download and add the repo file to /etc/yum.repos.d/:
sudo wget -P /etc/yum.repos.d http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo

Finally, VirtualBox is ready to install:
sudo yum install VirtualBox-4.1

Add yourself to the vboxusers group using the “Users and Groups” application or the command line:
sudo usermod -a -G vboxusers your_user_name

VirtualBox should now be available in the menu or running VirtualBox. Don't forget to install the non-free Extension Pack via the File→Preferences→Extensions menu.

VirtualBox running on CentOS

Miscellaneous: USB, Network drives

If you get problems using USB, take a look at the CentOS Wiki.

To share any folder as a network drive, just enter the following command at the MSDOS prompt:
net use x: \\vboxsvr\your_shared_folder

 

By Johannes Eva, 2012
This article has been linked on LXer.com and some more...

Picture copyright: chameleon with a red hat, detail from this VirtualBox original artwork, unknown license.