VirtualBox is an open source cross-platform virtualization software, it can be installed on any operating system and enable you to install and run multiple guest operating systems on same computer. For example, if you install it on your Linux system, you can run Windows XP operating system under it as a Guest OS or run Linux OS on your Windows system and so on. This way, you can install and run as many as guest operating systems as you like, the only limit is disk space and memory.
You can see the complete new change log details about VirtualBox 4.2.10 on their Official Changelog Page.
This guide explains how to install VirtualBox 4.2.10 on RHEL 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6, CentOS 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6 and Fedora 18,17,16,15,14,13,12 systems using VirtualBox’s own repository with YUM tool.
Adding VirtualBox Repository
We use VirtualBox own repository to install latest VirtualBox 4.2.10 on following systems.
For RHEL/CentOS 6.4-5.9
## RHEL 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6 and CentOS 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6 ## # cd /etc/yum.repos.d/ # wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
For RHEL/CentOS 5
## RHEL 5 and CentOS 5 ## # wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm # rpm -Uvh epel-release-5-4.noarch.rpm
For Fedora 18,17,16,15,14,13,12
## Fedora 18,17,16,15,14,13,12 ## # cd /etc/yum.repos.d/ # wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
Install Dependency Packages for VirtualBox
VirtualBox uses vboxdrv kernel module to control and allocate physical memory for execution of guest operating systems. Without this module, you can still use the VirtualBox to create and configure virtual machines, but they will not work. So, to make VirtualBox fully functional you will need to update your system first, then install some additional modules like DKMS, kernel-headers and kernel-devel and some dependency packages.
# yum update # yum install binutils qt gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel dkms
Install VirtualBox 4.2.10
Once you’ve installed all the needed dependency packages, you can install latest version of VirtualBox using following command.
# yum install VirtualBox-4.2
Rebuild Kernel Modules for VirtualBox 4.2.10
The below command will automatically create vboxusers group and user and also search and automatically rebuild required kernel modules. If the below build process fails, you will get a warning messages. Please have a look at /var/log/vbox-install.log to trace why the build process failed.
# /etc/init.d/vboxdrv setup OR # service vboxdrv setup
Start VirtualBox
Simply execute following command to start it from the terminal or use launcher from menu to start.
# VirtualBox
VirtualBox Screenshots
Troubleshooting
If you get any error message like KERN_DIR or if your kernel source directory not detected automatically by build process, you can set it by using following command. Make sure you change kernel version according to your system as shown in red color.
## RHEL / CentOS / Fedora ## KERN_DIR=/usr/src/kernels/2.6.18-194.11.1.el5-x86_64 ## Export KERN_DIR ## export KERN_DIR
Update VirtualBox
If you want to update the VirtualBox with latest version in the future, you can simply run the yum update command to update it.
# yum update VirtualBox-4.2
Remove VirtualBox
If in case you want to remove VirtualBox completely, just use the following command to remove it completely from your system.
# cd /etc/yum.repos.d/ # rm -rf virtualbox.repo # yum remove VirtualBox-4.2



This was perfect! Thanks for publishing, it really saved me a lot of time. I didn’t see anything in the docs on how to pull down all of the dependencies and I was constantly failing installs. This time I received errors on the DKMS not being there, but it still compiled and I was able to import an appliance built on an OSX computer without a problem.
I’ve been everywhere trying to get this to work and it won’t no matter what I do.
I’ve set the KERN_DIR variable. see:
[root@derwood kernels]# set | grep KERN
KERN_DIR=/usr/src/kernels/2.6.32-279.11.1.el6.centos.plus.x86_64
[root@derwood kernels]# ls
2.6.32-279.11.1.el6.centos.plus.x86_64
[root@derwood kernels]# pwd
/usr/src/kernels
Yet when I try to set up vboxdev, I get this:
Error! Your kernel headers for kernel 2.6.32-279.el6.x86_64 cannot be found at
/lib/modules/2.6.32-279.el6.x86_64/build or /lib/modules/2.6.32-279.el6.x86_64/source.
[FAILED]
(Failed, trying without DKMS)
Recompiling VirtualBox kernel modules [FAILED]
It points to the wrong directory.. This is on a fresh install of Centos 6.3. No updates applied to it.
Any ideas would be appreciated.
@Darin – Have you installed required dependency packages like kernel-headers kernel-devel?
If not please install it, The error clearly saying that “kernel headers cannot be found”.
Please install and try again..
@Ravi
Yeah.. I had the headers and kernel-devel installed. I figured out the problem.
For some reason, the kernel headers were for a newer kernel.. I uninstalled the headers, did a full yum update, then reinstalled everything and it worked properly. Don’t know why yum did that but its fixed.
The reboot did the trick because the yum update caused you to have a higher kernel version. Next time u should just reboot and you will see that your kernel will be updated also (uname -r and ls in the src dir)
btw thx for the tutorial u might want to add the part about rebooting when the kernel is not updated
Rebooting fixed the problem. Thanks!
Thank you very much Ravi . It perfectly worked and once again thank you……..
I am very impressed by your achivements, I was greatly helpfull to me , I just transfer a virtual box (cloned) from a win 7 ultimate host to a centos host , inside my vm i had a centos server running my web sites,
, then to fix it I have removed the installation and follow your steps on how to install and works just great!!!! May God Bless you Greatly!!!!!.. Thank you!!!…
Thank you so much!!!! I had a kernell problem when I moved and try to install the clone files (vdi) , Because I am a newbie on linux, and I am loving it, but I don’t quite understand how everything works, But I made it , Thanks to God, and your nice explanation here , I find it out that you have to do by rpm and repo files otherwise will not work at all, at the begin I had installed by the binary package …
Thank you so much! This really helped me out.
Thanks Ravi you are a star , thanks a ton……
@Prasad,
Thanks for your compliment.
Hello Friends,
I am getting the below error while yum update after downloading virtualbox.repo
[root@025 yum.repos.d]# yum -y update
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify,
: versionlock
Loading support for CentOS kernel ABI
Loading mirror speeds from cached hostfile
* base: mirror.nbrc.ac.in
* epel: mirrors.ispros.com.bd
* extras: mirror.nbrc.ac.in
* updates: mirror.nbrc.ac.in
virtualbox/primary | 226 B 00:00
http://download.virtualbox.org/virtualbox/rpm/el/6/x86_64/repodata/primary.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/primary.xml.gz from virtualbox: [Errno 256] No more mirrors to try.
Please Help.
I think you need to clear yum meta cache, run the following command to clear the cache and run the update.
I hope it will work out..
Hello Ravi,
I tried out yum clean metadata; yum clean all , After this i am facing the below error.
Trying other mirror.
updates | 3.5 kB 00:00
updates/primary_db | 5.1 MB 00:35
virtualbox | 951 B 00:00
virtualbox/primary | 226 B 00:00
http://download.virtualbox.org/virtualbox/rpm/el/6/x86_64/repodata/primary.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
virtualbox/primary | 218 B 00:00
http://download.virtualbox.org/virtualbox/rpm/el/6/x86_64/repodata/primary.xml.gz: [Errno -1] Metadata file does not match checksum
Trying other mirror.
Error: failure: repodata/primary.xml.gz from virtualbox: [Errno 256] No more mirrors to try.
Hi,
I am also not able to install virtualbox4.2, and I have update kernel-devel,
and successfully able to /etc/init.d/vboxdrv setup but when i trying to open VirtualBox but not able to start. also i tried from gui mode but not run and alos no error coming.
please guide me on the same.
restart the server will fix this issue..
Ravi,
Centos 6.4 is out and so is VirtualBox 4.2.10. Any pointers for upgrading from Centos 6.3 and VirtualBox 4.2.6?
I figure a yum update and a reboot to go to Centos 6.4. Then what? Do a service vboxdrv setup? and a yum update VirtualBox-4.2?
Think anything else will be needed?
@Derwood,
I have already written a fair article that show you how to upgrade from any CentOS 6.x to CentOS 6.4.
I have updated this article to Virtualbox 4.2.10, simple follow the above steps to install it. If any please do let me know..
Well, I upgraded from CentOS 6.3 to CentOS 6.4, and also update Virtualbox to 4.2.10. Everything went fine except for one small problem.
I have no text visible in any window or on any of the task bars.
I managed to get Virtualbox started by blind guessing where its icon was and I got the VMs to start after it started. So they’re up, but still no text in the windows.
here’s a screenshot from a vnc session:
http://i11.photobucket.com/albums/a188/derwood5555/desktop_zps3676fb15.png
Any ideas?
No idea man, try rebooting the machine may work..
Yeah.. I tried rebooting.. It’s apparently a problem with the nouveau driver. It has issues.
I’m either going to have to put a different video card in or install nvidia proprietary drivers.
Thank you very much!!!
I figured it out.. I had to blacklist the nouveau module on the grub line, and then do Xorg -configure to generate a new xorg.conf.
It’s working again.
I am glad finally it worked for you.