Installing VirtualBox On Ubuntu

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Tue, 2007-04-10 16:55. :: Ubuntu | VirtualBox | Desktop | Virtualization

Installing VirtualBox On Ubuntu

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 04/02/2007

This tutorial shows how you can install InnoTek's VirtualBox on a Ubuntu desktop. With VirtualBox you can create and run guest operating systems ("virtual machines") such as Linux and Windows under a host operating system. There are two ways of installing VirtualBox: from precompiled binaries that are available for some distributions and come under the PUEL license, and from the sources that are released under the GPL. This article will show both ways.

Currently VirtualBox supports only 32bit host and guest operating systems.

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Installing VirtualBox From Precompiled Binaries

The VirtualBox binaries can be downloaded from here: http://www.virtualbox.org/wiki/Downloads. If the PUEL license is ok for you and there's a package for your distribution, you can install that package. For example, there is a VirtualBox .deb package for Ubuntu 6.10 (Edgy Eft), so if you use Ubuntu 6.10, you can use that package. I've also tested this package successfully on Ubuntu 7.04 (Feisty Fawn), so it seems you can use that package there, too.

To install the VirtualBox .deb package, please open a terminal window (Applications > Accessories > Terminal) and become root:

sudo su

Then install some prerequisites for VirtualBox:

apt-get install bcc iasl xsltproc xalan libxalan110-dev uuid-dev zlib1g-dev libidl-dev libsdl1.2-dev libxcursor-dev libqt3-headers libqt3-mt-dev libasound2-dev libstdc++5 linux-headers-`uname -r` build-essential

Then go to the VirtualBox download page and pick the right .deb package for your Ubuntu version and download it to your system:

cd /tmp
wget http://www.virtualbox.org/download/1.3.8/VirtualBox_1.3.8_Ubuntu_edgy_i386.deb

After the download has finished, you can install VirtualBox like this:

dpkg -i VirtualBox_1.3.8_Ubuntu_edgy_i386.deb

You might get asked the following questions:

Do you agree with the PUEL license terms? <-- Yes
Should the vboxdrv kernel module be compiled now? <-- Yes

That's it already. You can now find VirtualBox under Applications > System Tools:

 

2 Installing VirtualBox From The Sources

If InnoTek's PUEL license doesn't work for you and you prefer the GPL and/or there's no .deb package for your Ubuntu version, you can compile VirtualBox from the sources. The sources are released under the GPL.

To install VirtualBox from the sources, please open a terminal window (Applications > Accessories > Terminal) and become root:

sudo su

Then install some prerequisites for VirtualBox:

apt-get install bcc iasl xsltproc xalan libxalan110-dev uuid-dev zlib1g-dev libidl-dev libsdl1.2-dev libxcursor-dev libqt3-headers libqt3-mt-dev libasound2-dev libstdc++5 linux-headers-`uname -r` build-essential

We can download the latest VirtualBox sources from InnoTek's SVN repository; to do so, we must install subversion first:

apt-get install subversion

Next we download the VirtualBox sources to the /usr/src/virtualbox directory:

mkdir /usr/src/virtualbox
cd /usr/src/virtualbox
svn co http://virtualbox.org/svn/vbox/trunk vbox

Then we compile VirtualBox as follows:

cd vbox
./configure
source ./env.sh
kmk all
cd out/linux.x86/release/bin/src
make
make install

Afterwards we load the vboxdrv kernel module and copy the VirtualBox files to appropriate locations on the disk:

cd ../
modprobe vboxdrv
echo vboxdrv >> /etc/modules

cp -prf *.so /usr/lib/
mkdir /usr/local/virtualbox
cp -prf * /usr/local/virtualbox/
ln -s /usr/local/virtualbox/VirtualBox /usr/local/bin/VirtualBox
ln -s /usr/local/virtualbox/VBoxSVC /usr/local/bin/VBoxSVC

Next we create the group vboxusers and add our desktop user (e.g. falko) to it:

groupadd vboxusers
usermod -G vboxusers -a falko

Now we must change the permissions of /dev/vboxdrv so that it can be accessed by the vboxusers group:

chmod 660 /dev/vboxdrv
chgrp vboxusers /dev/vboxdrv

In order to prevent that the permissions of /dev/vboxdrv are reset at boot time, we edit /etc/udev/rules.d/40-permissions.rules and add the following line at the end of that file:

gedit /etc/udev/rules.d/40-permissions.rules

[...]
KERNEL=="vboxdrv",                        GROUP="vboxusers", MODE="0660"

That's it. Now all that is left to do is create a menu entry for VirtualBox. Right-click on Applications and select Edit Menus:

In the window that opens please select System Tools and then click on New Item:

In the Create Launcher window, please fill in the following details:

  • Type: Application
  • Name: VirtualBox
  • Command: VirtualBox (please take care about upper/lower case - this is a command, if you don't write it right, the application won't start)
  • Comment: You can fill in anything you like or leave it blank.

If you like, you can also select an icon for the new application, but this is no must.

VirtualBox should now be shown in the list of items for the System Tools menu. Click on Close to leave the window:

Afterwards, you can find VirtualBox under Applications > System Tools:

This is what it looks like when VirtualBox is started:

 

3 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Sun, 2013-08-25 19:06.
hi guys please on the last tip of changing permission I don't find the file 40-permissions.rules instead I find on that directory the following files 70-persistent-cd.rules  70-persistent-net.rules  
Submitted by Anonymous (not registered) on Mon, 2011-09-19 10:28.
it says permission unavailaible when i try to change or add somethin :/
Submitted by Maya (not registered) on Sat, 2010-07-03 10:39.
I got an error Failed to open a session for the virtual machine Windows XP.

Virtual machine 'Windows XP' has terminated unexpectedly during startup. when trying to start the virtual machine.

 Also,

 Kernel driver not installed (rc=-1908)


Please install the virtualbox-ose-dkms package and execute 'modprobe vboxdrv' as root.

 

 PLease help.

Submitted by Anonymous (not registered) on Sat, 2009-09-12 10:29.
It work for me. I just changed the virtualbox version for the latest. Thanks
Submitted by Anonymous (not registered) on Thu, 2009-07-09 03:25.

I was trying to install the open source version and the http link does not work. Any suggestions??   

svn co http://virtualbox.org/svn/vbox/trunk vbox

Submitted by Anonymous (not registered) on Fri, 2009-07-24 19:17.
Submitted by lanort (registered user) on Mon, 2007-05-14 09:11.

Thanks for this nice tutorial!

One thing you forgot is to add the user to the vbox-group.

For me the tutorial did not work exactly. I was able to start vbox but I could not start a virtual machine. [I always got VBox status code: -1909 (VERR_VM_DRIVER_NOT_ACCESSIBLE)]

Reinstalling with dpkg -i /tmp/VirtualBox_1.3.8_Ubuntu_feisty_i386.deb solved this. 

Submitted by Anonymous (not registered) on Thu, 2009-03-19 12:46.

To fix your issue, simply 

modprobe vboxnetflt
echo vboxnetflt >> /etc/modules