Installing VirtualBox Guest Additions on Ubuntu Server

Installing VirtualBox Guest Additions is necessary to enable folder sharing between host and guest operating systems on VirtualBox. This is a quick how-to install the additions from the command line on the Ubuntu Server virtual machine:

  1. Start the Ubuntu Server VM and insert the Guest Additions CD image (Devices menu, Install Guest Additions).

  2. Mount the CD Rom with the shell command:

    $ sudo mount /dev/cdrom /media/cdrom
    

    After that the install scripts should be accessible in the /media/cdrom/ directory:

    $ ls -l /media/cdrom/
    total 41942
    dr-xr-xr-x 3 root root     2048 Dec 19 13:11 32Bit
    dr-xr-xr-x 2 root root     2048 Dec 19 13:11 64Bit
    -r-xr-xr-x 1 root root      647 Aug 16  2011 AUTORUN.INF
    -r-xr-xr-x 1 root root     6966 Dec 19 13:02 autorun.sh
    -r-xr-xr-x 1 root root     5523 Dec 19 13:02 runasroot.sh
    -r-xr-xr-x 1 root root  7361995 Dec 19 13:06 VBoxLinuxAdditions.run
    -r-xr-xr-x 1 root root 14634496 Dec 19 13:08 VBoxSolarisAdditions.pkg
    -r-xr-xr-x 1 root root 13270208 Dec 19 12:55 VBoxWindowsAdditions-amd64.exe
    -r-xr-xr-x 2 root root   278832 Dec 19 12:48 VBoxWindowsAdditions.exe
    -r-xr-xr-x 1 root root  7383936 Dec 19 12:49 VBoxWindowsAdditions-x86.exe
    
  3. Install necessary build tools and build dependencies:

    $ sudo apt-get install -y dkms build-essential linux-headers-generic linux-headers-$(uname -r)
    

    Note

    Getting the headers solves a potential build error that is reported in /var/log/vboxadd-install.log

    Failed to install using DKMS, attempting to install without
    /tmp/vbox.0/Makefile.include.header:94: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.
    
  4. Build and install the Guest Additions:

    $ sudo /media/cdrom/VBoxLinuxAdditions.run
    

Tested on Ubuntu Server 12.04 precisely.

Article "Installing VirtualBox Guest Additions on Ubuntu Server" was published on April 11, 2012 and tagged under notes. You can it if you like or leave a comment below.

Next article: Sentry on DotCloud

Previous article: jQuery ExpandMe plugin