Installing VirtualBox 2 on a Linux Host

From Virtuatopia
Revision as of 21:12, 5 March 2009 by Neil (Talk | contribs) (Installing VirtualBox on Fedora, CentOS and Red Hat Enterprise Linux)

Jump to: navigation, search

This chapter of VirtualBox 2 Essentials covers the requirements for and steps to install the full, pre-built binrary edition of VirtualBox on a Linux host.

VirtualBox may be installed on Linux using either Linux distribution specific package archives, or manually using a distribution neutral shell script based installer. Each of these methods will be covered in this chapter.

VirtualBox Linux Host Requirements

Before embarking on an installation of VirtualBox on a Linux host, there a couple of pre-requisites. The following packages are required if access to the VirtualBox graphical interface is required. If only the headless VRDP server is required, the following packages are not mandated:

  • Qt toolkit - Version 4.3.0 or newer of the Qt toolkit must be installed.
  • SDL - Version 1.2.7 or newer of the libsdl graphics library must be installed.

Another, optional package is Dynamic Kernel Module Support (DKMS). As part of the installation process, VirtualBox installed two kernel modules (vboxdrv and vboxnetflt) onto the host system. These modules must match the running Linux kernel at all times for VirtualBox to function. This can be an issue when the host kernel is updated at any point in the future. Whilst not required to install and run VirtualBox the presence of the DKMS package will ease the transition to future kernel updates. When installed, DKMS ensures that the VirtualBox kernel modules are rebuilt automatically when the Linux kernel is updated. Without this package, the VirtualBox kernel module will need to be rebuilt manually each time a kernel update is applied to the host system.

The DKMS package is not supported on all Linux distributions, but may be installed on those that do as follows:


sudo apt-get install dkms


yum install dkms


urpmi dkms

In addition to the above requirements, USB device support requires that the user account from which VirtualBox is running have read and write access to the usbfs USB filesystem. Also, if the virtual machines will be required to have access to host network adapters, the user must also have aread and write access to the /dev/net/tun device.

Downloading VirtualBox for Linux

The binary version of VirtualBox, pre-packaged for a wide variety of Linux distributions may be downloaded from the VirtualBox web site. Select the package which matches your Linux distribution (Fedora, Ubuntu, Red Hat, CentOS etc) and host architecture (i386 or AMD64) and download the archive to a suitable temporary location. If your Linux distribution is not listed download the appropriate archive for the All distributions option.

Installing VirtualBox on Fedora, CentOS and Red Hat Enterprise Linux

The packaged version of VirtualBox for Fedora, CentOS and Red Hat Enterprise Linux is supplied in the form of a Red Hat Package Management (rpm) file. When the link to download this archive is clicked, the browser will display a dialog providing the option to install the package using the Software Installer, or saving the file to disk. If the Software Installer is selected, a dialog similar to the following will appear once the download has completed.

Installing the VirtualBox RPM package using the software installer on Red Hat based systems

To begin the installation, select the VirtualBox package and click the Apply button to initiate the installation process. If, during this process, the installer is unable to find pre-built kernel modules for the host operating system, it will attempt to build compatible modules from source code. If the installation is successful, a Software Installed Successfully dialog will appear and VirtualBox is ready to run.

If the installation fails, a log of the installation process, including any errors which were encountered, is stored in /var/log/vbox-install.log. Review any errors reported in the log file and take appropriate corrective action. If the installation failed attempting to built the VirtualBox kernel modules, the most likely explanation is that the Kernel development sources and headers necessary to build kernel modules are not installed on the system. To install these files, execute the following command:

yum install kernel-devel

Once any problems relating to the build of the kernel modules have been rectified, the build can be restarted by executing the following command:

su -
/etc/init.d/vboxdrv setup

Installing VirtualBox on Ubuntu