Linux build instructions
While we try to not favor any distribution, we only build with certain distributions. These include Debian, Ubuntu and Oracle Linux. Things should not be much different for other distributions though. If you want to supply specific build instructions (especially package names) for other distributions, please contact the VirtualBox team.
These instructions will also build the Guest Additions - the Linux parts only, and for the bit count your host system is using. To only build the Additions (this requires a lot less dependencies, though sadly
configure does not know that) add the make file parameter
VBOX_ONLY_ADDITIONS=1 to the
kmk command line. To create an Additions disk image installer, do a second
kmk run with
packing on the command line. And to do a 32-bit build on a 64-bit host, add the parameter
KBUILD_TARGET_ARCH=x86. Output goes to the folder
out/linux.*/*/bin/additions. The Additions built will generally not work on a system older than the one they were built on (e.g. a build on Ubuntu 16.10 will cause problems on an Ubuntu 14.04 guest). Build in a chroot environment or on the target virtual machine to solve this.
- GCC 3.3.3 or later (except for the GCC 4.0.x series). GCC 4.4.1 is recommended.
- IASL (Intel ACPI compiler)
- Yasm 1.3 or later (yasm, Yasm Modular Assembler Project)
- xsltproc (libxslt, XML style sheet processor)
- libxml2 (required for VBox version >= 1.6, XML file handling)
- libxslt1 (required for VBox version >= 1.6, XML file transformation)
- libXcursor (required to support color mouse pointers in the guest)
- Qt 5.x.y (with x >= 6, including the OpenGL part; required for VBox version >= 5.2)
- libSDL (SDL frontend)
- ALSA (audio backend)
- PulseAudio (audio backend)
- libhal (detect host floppy/DVD)
- libcap (CAP_NET_RAW for ICMP sockets in NAT)
- libpam0g (PAM support for the guest additions, required for VBox version >= 3.2)
- python-dev (Python bindings)
- gsoap (webservice API, version 2.8.50 or higher)
- Java SE 6 JDK (Java API bindings, both webservice and XPCOM)
- Xmu (for OpenGL)
- Mesa (for OpenGL)
- glslangValidator (for 3D acceleration)
- cURL (version 7.16.1 or higher, required for VBox version >= 3.0)
- Java JDK (required to generate the Java bindings)
- makeself (for creating the generic installer package, required for VBox version >= 4.0)
- pdflatex (normally provided by texlive-latex-base)
- ia32-libs or lib32z1 (various libraries needed for compiling the 32-bit guest additions, newer versions of Debian/Ubuntu use lib32z1)
- libc6-dev-i386 (libc6 i386 development headers)
- lib32gcc1 (gcc support for i386)
- gcc-multilib (gcc support for i386)
- lib32stdc++6 (libstdc++ for i386)
- g++-multilib (g++ support for i386)
On Debian-based systems, the following command should install the required packages:
apt-get install acpica-tools chrpath doxygen g++-multilib libasound2-dev libcap-dev \ libcurl4-openssl-dev libdevmapper-dev libidl-dev libopus-dev libpam0g-dev \ libpulse-dev libqt5opengl5-dev libqt5x11extras5-dev qttools5-dev libsdl1.2-dev libsdl-ttf2.0-dev \ libssl-dev libvpx-dev libxcursor-dev libxinerama-dev libxml2-dev libxml2-utils \ libxmu-dev libxrandr-dev make nasm python3-dev python-dev qttools5-dev-tools \ texlive texlive-fonts-extra texlive-latex-extra unzip xsltproc \ \ default-jdk libstdc++5 libxslt1-dev linux-kernel-headers makeself \ mesa-common-dev subversion yasm zlib1g-dev glslang-tools \ ia32-libs libc6-dev-i386 lib32gcc1 lib32stdc++6
- For python hacking:
apt-get install pylint python3-psycopg2 python3-willow python-psycopg2 python-pil
On Fedora (tested with pre-37 rawhide), the following should do:
yum install gcc-c++ subversion subversion-gnome kernel-devel which tar gzip bzip2 \ doxygen mscgen wine-core \ glibc-devel libcap-devel libcurl-devel libIDL-devel \ libstdc++-static libxslt-devel libvpx-devel libXmu-devel \ pam-devel pulseaudio-libs-devel python-devel qt5-qtbase-devel qt5-qtbase-gui qt5-qtx11extras-devel \ qt5-qttools-devel libXrender-devel libXinerama-devel libXcursor-devel rpm-build SDL_ttf-devel \ SDL-static device-mapper-devel glibc-static zlib-static \ glibc-devel.i686 libstdc++.i686 alsa-lib-devel pulseaudio-libs-devel \ texlive texlive-latex texlive-latex-bin texlive-ec \ texlive-collection-fontsrecommended texlive-pdftex-def texlive-fancybox texlive-tabulary \ libpng-devel openssl-devel acpica-tools opus opus-devel java-1.8.0-openjdk-devel glslang
To get the beramono.sty LaTeX style which is missing in Fedora (thanks to Perry):
cd /usr/share/texmf/tex/latex/ mkdir bera cd bera/ wget http://www.tug.org/texlive/devsrc/Master/texmf-dist/tex/latex/bera/beramono.sty texhash
On Gentoo, the following should do (sorry, not quite up to date):
emerge -av sys-devel/bin86 sys-devel/dev86 sys-power/iasl libxslt xerces-c \ xalan-c libXcursor dev-qt/qtgui:5.6 libIDL libsdl hal alsa-lib pulseaudio \ app-cdr/cdrtools app-arch/makeself sys-fs/lvm2 dev-util/glslang
On Arch Linux, try the following:
# 64-bit: pacman -S --needed binutils bison flex pkg-config multilib-devel wget yasm nasm \ libidl2 linux-headers texlive-most sdl sdl_ttf \ lib32-glibc lib32-libstdc++5 lib32-gcc-libs gcc-multilib qt5 \ glslang
Special tweaks for 64 bit binaries
Building on a 64bit host still requires 32bit libraries and build tools as the Guest Additions which are part of the build process are 32bit. Note that on 64bit Ubuntu systems some links to shared libraries are missing. This can be fixed with
ln -s libX11.so.6 /usr/lib32/libX11.so ln -s libXTrap.so.6 /usr/lib32/libXTrap.so ln -s libXt.so.6 /usr/lib32/libXt.so ln -s libXtst.so.6 /usr/lib32/libXtst.so ln -s libXmu.so.6 /usr/lib32/libXmu.so ln -s libXext.so.6 /usr/lib32/libXext.so
- Change to the root directory of the sources and execute the configure script:
./configure --disable-hardeningIf it finds everything it needs, it will create a file called 'AutoConfig.kmk' containing paths to the various tools on your system. Also, it will create an environment setup script called
env.sh. This step only has to be done once (if something changes in your build tool setup, you might have to repeat it but keep in mind that both output files will be overwritten).
The switch --disable-hardening should not be used for building packages for redistribution or for production use.
- Whenever you want to build VirtualBox, you have to open a shell and source the generated environment setup script 'env.sh', i.e. do
- To build a release package, type
kmk allThis produces the required binaries in
out/linux.x86/release/bin/. If you want to build a debug version, type
kmk BUILD_TYPE=debugIn case you have more than one CPU core, kmk will automatically do a parallel build.
- Running a hardened build from the bin/ directory will not work because all hardened binaries do explicit link against libraries from /opt/VirtualBox (fixed path).
Building VirtualBox packages for distribution
Never disable hardening (see previous section) when creating packages for redistribution.
To be more LSB-compliant, change the default pathes which are used by the VirtualBox binaries to find their components. Add the following build variables to LocalConfig.kmk:
- VBOX_PATH_APP_PRIVATE_ARCH := /usr/lib/virtualbox
- This is the application's private directory, architecture-dependent.
- VBOX_PATH_SHARED_LIBS := $(VBOX_PATH_APP_PRIVATE_ARCH)
- Where to put the shared libraries, usually the same directory as the private path as the VirtualBox shared libraries are normally not used by any other application.
- VBOX_WITH_ORIGIN :=
- Disable RPATH=$ORIGIN and use a fixed RUNPATH.
- VBOX_WITH_RUNPATH := $(VBOX_PATH_APP_PRIVATE_ARCH)
- Set RUNPATH to the directory where our shared libraries can be found.
- VBOX_PATH_APP_PRIVATE := /usr/share/virtualbox
- This is the applications's private directory, not architecture-dependent.
- VBOX_PATH_APP_DOCS := /usr/share/doc/virtualbox
- Set the directory containing the documentation. The file VirtualBox.chm and UserManual.pdf are searched within this directory.
- VBOX_WITH_TESTCASES :=
- Save compile time by not building the testcases.
- VBOX_WITH_TESTSUITE :=
- Save compile time by not building the testsuite.
Running your build
You can run VirtualBox directly from the build target directory (
out/linux.x86/release/bin/) if the build was not hardened. But first of all, you must build and install the VirtualBox kernel module, whose sources will have been copied to the build target directory.
So, issue the following:
cd out/linux.x86/release/bin/src make sudo make install cd ..
Then it should have been installed to your modules directory and you can load it using
modprobe vboxdrv. Make sure you give yourself read and write access to
Finally, you can start one of the frontends, e.g.