Wednesday, July 08, 2009

Install VirtualBox on CentOS 5

Go to the conclusions if you have no time for BS. If you have time the details of my installation of VirtualBox 2.2.4 on CentOS 5.3 are below.

1. I downloaded VirtuaBox rpm form virtualbox.org. In my case I downloaded VirtualBox-2.2.4_47978_rhel5-1.i386.rpm

2. Installed the rpm as a rootsu root -c "rpm -ivh VirtualBox-2.2.4_47978_rhel5-1.i386.rpm"
But I got the errorerror: Failed dependencies:
libSDL-1.2.so.0 is needed by VirtualBox-2.2.4_47978_rhel5-1.i386


3. So I installed SDL su root -c "yum install SDL" and I tried again su root -c "rpm -ivh VirtualBox-2.2.4_47978_rhel5-1.i386.rpm" and the installation failed Preparing... ########################################### [100%]
1:VirtualBox ########################################### [100%]

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Compilation of the kernel module FAILED! VirtualBox will not start until this
problem is fixed. Please consult /var/log/vbox-install.log to find out why the
kernel module does not compile. Most probably the kernel sources are not found.
Install them and execute

/etc/init.d/vboxdrv setup

as root.
The reason is that kernel-headers and kernel-develop packages were missing, so I installed them su root -c "yum install kernel-headers kernel-devel" Be sure that the install packages correspond to your kernel version! You can check this as follows: [W@localhost ~]$ uname -a
Linux localhost.localdomain 2.6.18-128.1.16.el5 #1 SMP Tue Jun 30 06:10:28 EDT 2009 i686 i686 i386 GNU/Linux
[W@localhost ~]$ rpm -q kernel-headers kernel-devel
kernel-headers-2.6.18-128.1.16.el5
kernel-devel-2.6.18-128.1.16.el5


4. I removed failed installation of VirtualBox su root -c "rpm -e VirtualBox-2.2.4_47978_rhel5-1.i386" and I tried again to install it. Again I got the same error. But this time the reason was that I did not have gcc installed. So I installed it su root -c "yum install gcc", removed failed installation of VirtualBox and tried again to install it: [W@localhost ~]$ su root -c "rpm -ivh VirtualBox-2.2.4_47978_rhel5-1.i386.rpm"
Password:
Preparing... ########################################### [100%]
1:VirtualBox ########################################### [100%]

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Success!
This time it worked!!

Concussion

First, download VirtualBox from virtualbox.org. Second, install four missing packages (at least I did not have these packages installed, they are on CentOS CDs/DVD, you can use pirut or yum to install them) su root -c "yum install SDL kernel-devel kernel-headers gcc" Third, install VirtualBox su root -c "rpm -e VirtualBox-2.2.4_47978_rhel5-1.i386" Fourth, add yourself to the vboxusers group su root -c "/usr/sbin/usermod -a -G vboxusers yourusername"Finally, start VirtualBox:[W@localhost ~]$ VirtualBox

1 comment:

  1. Anonymous4:02 AM

    Third, install VirtualBox
    su root -c "rpm -e VirtualBox-2.2.4_47978_rhel5-1.i386"

    Typo? Change the -e option with -ivh. ;)

    ReplyDelete