HowTo build VirtualBox OSE 3 for CentOS 5

We are going to build the RPM with VirtualBox OSE 3 for CentOS 5. We are using some RPMs, which doesn't exists in the official CentOS repository. Due to different licenses please also take a look at some legal stuff regarding to VirtualBox. I used the work of rpmfusion for Fedora VirtualBox OSE packages as template for the spec files, so my work was here minor. The RPMs and HowTo were created with best effort, so some things here are probably not “clean”.

Software versions

  • VirtualBox OSE 3.2.8 i386
  • CentOS 5.5 i386 release
  • QT 4.7
  • SDL 1.2.13
  • Curl 7.16.4

Install build dependencies

Install from repository

Following dependencies are included in the standard centos repository.

yum -y install libxml2-devel libxslt-devel libXcursor-devel libIDL-devel libXinerama-devel openssl-devel libXmu-devel libpng-devel dbus-devel libXfixes-devel libXft-devel libXi-devel python-devel libcap-devel kernel-devel kernel-PAE-devel libidn-devel nss-devel libXext-devel libXrandr-devel libjpeg-devel libmng-devel mesa-libGLU-devel arts-devel audiofile-devel esound-devel gettext-devel nasm pam-devel

Building from source rpms

CUPS

We need curl-devel >= 7.16.1 to build VirtualBox OSE. It's not included in the standard CentOS repository, so we are going to build it by ourself. Download curl-7.16.4-8.fc8.src.rpm install the source, build it, deinstall the old version and install the rpm

rpm -i curl-7.16.4-8.fc8.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -bb --target=i686 curl.spec
rpm -e --nodeps curl-7.15.5-9.el5
rpm -i /usr/src/redhat/RPMS/i686/curl-7.16.4-8.i686.rpm
rpm -i /usr/src/redhat/RPMS/i686/curl-devel-7.16.4-8.i686.rpm

IASL

Download iasl-20090123-1.el5.src.rpm install the source, build it and install the rpm

rpm -i iasl-20090123-1.el5.src.rpm
cd /usr/src/redhat/SPECS
rpmbuild -bb --target=i686 iasl.spec
rpm -i /usr/src/redhat/RPMS/i686/iasl-20090123-1.i686.rpm

SDL

Download SDL-1.2.13-10.fc12.src.rpm install the source

rpm -i --nomd5 sdl-1.2.13-10.fc12.src.rpm
cd /usr/src/redhat/SPECS

Apply this patch and build it

patch
--- SDL.spec	2009-07-24 18:41:21.000000000 +0200
+++ /tmp/SDL.spec	2010-11-08 12:55:41.000000000 +0100
@@ -28,7 +28,7 @@
 BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildRequires: arts-devel audiofile-devel
 BuildRequires: esound-devel alsa-lib-devel
-BuildRequires: pulseaudio-libs-devel
+#BuildRequires: pulseaudio-libs-devel
 BuildRequires: libXext-devel libX11-devel
 BuildRequires: libGL-devel libGLU-devel
 BuildRequires: libXrender-devel libXrandr-devel gettext-devel
@@ -96,7 +96,7 @@
    --enable-dlopen \
    --enable-arts-shared \
    --enable-esd-shared \
-   --enable-pulseaudio-shared \
+   --disable-pulseaudio-shared \
    --enable-alsa \
    --disable-rpath
 make %{?_smp_mflags}
patch < /tmp/patch
rpmbuild -bb --target=i686 SDL.spec
rpm -i /usr/src/redhat/RPMS/i686/SDL-1.2.13-10.i686.rpm
rpm -i /usr/src/redhat/RPMS/i686/SDL-devel-1.2.13-10.i686.rpm

Install binary RPMs

QT 4.7

Download:

Install it

rpm -U fontconfig-2.5.93-7.i386.rpm fontconfig-devel-2.5.93-7.i386.rpm
rpm -i qt4-4.7.0-0.i686.rpm qt4-devel-4.7.0-0.i686.rpm qt4-sqlite-4.7.0-0.i686.rpm

Build VirtualBox OSE

Comment out the prelinking of libs

comment out the following line in /etc/rpm/macros.prelink. details

%__prelink_undo_cmd     /usr/sbin/prelink prelink -y library

Install the source rpms

rpm -i virtualbox-ose-3.2.8-5.src.rpm
rpm -i virtualbox-ose-kmod-3.2.8-5.src.rpm
rpm -i virtualbox-ose-guestadditions-3.2.8-5.src.rpm

Build VirtualBox

cd /usr/src/redhat/SPECS
rpmbuild -bb --target=i686 VirtualBox-OSE.spec

Install sources for kernel module

rpm -i /usr/src/redhat/RPMS/i686/VirtualBox-OSE-kmodsrc-3.2.8-5.i686.rpm

Build the kernel modules

update the VirtualBox-OSE-kmod.spec with the kernel version and build it

rpmbuild -bb --target=i686 VirtualBox-OSE-kmod.spec

Build the guest additions

rpmbuild -bb --target=i686 VirtualBox-OSE-guestadditions.spec

That's all

you have compiled virtualbox OSE and kernel modules for it

[root@bnhpap3i SPECS]# ls /usr/src/redhat/RPMS/i686/VirtualBox-OSE-*
/usr/src/redhat/RPMS/i686/VirtualBox-OSE-3.2.8-5.i686.rpm
/usr/src/redhat/RPMS/i686/VirtualBox-OSE-debuginfo-3.2.8-5.i686.rpm
/usr/src/redhat/RPMS/i686/VirtualBox-OSE-devel-3.2.8-5.i686.rpm
/usr/src/redhat/RPMS/i686/VirtualBox-OSE-guest-3.2.8-5.i686.rpm
/usr/src/redhat/RPMS/i686/VirtualBox-OSE-kmodsrc-3.2.8-5.i686.rpm
/usr/src/redhat/RPMS/i686/VirtualBox-OSE-guestadditions-3.2.8-5.i686.rpm
[root@bnhpap3i SPECS]# ls /usr/src/redhat/RPMS/i686/kmod-VirtualBox-OSE-*
/usr/src/redhat/RPMS/i686/kmod-VirtualBox-OSE-3.2.8-5.i686.rpm
/usr/src/redhat/RPMS/i686/kmod-VirtualBox-OSE-PAE-3.2.8-5.i686.rpm

Download the binaries

You can also download the binaries here

Bugs

  • This version is not up to date. I don't have enough time to build RPMs and to update this HowTo with every release of VirtualBox.
  • There is one stability problem probably with high loaded VMs. If you restart/shutdown your VM daily you will be probably not affected. But anyway some details, the GUI gets froozen with some .NET applications, or just with Windows 7 and IE and uptime about a week. It's only the GUI frontend, because you can still connect to VM via RDP(with binary edition) and use it. I spent a lot of time with this issue. I have actually no idea for the reason and no time, knowhow of VirtualBox sources to continue the research this issue. If somebody are ready to it, let me know;) Ticket in virtualbox bugtracker

Discussion

Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.