VirtualBox/Install

From Segfault
Jump to: navigation, search

Installing from packages

sudo apt-get install virtualbox-ose virtualbox-ose-source
tar -xjf virtualbox-ose.tar.bz2
cd modules/virtualbox-ose
make
sudo mkdir /lib/modules/`uname -r`/misc
sudo cp vboxdrv.ko /lib/modules/`uname -r`/misc && depmod -a
sudo modrobe vboxdrv

$ ls -lgo /dev/vboxdrv 
crw-rw---- 1   10, 62 2007-11-25 04:05 /dev/vboxdrv

However, due to changes in the latest kernel (2.6.24-rc in 10/2007), compiling will fail. Luckily Frans Pop came up with a solution:

cd /usr/src/modules/virtualbox-ose
patch -p0 < ~/dev/virtualbox___uintptr_t.patch
find . -type f -regex '.*\.[ch]' -exec sed -i.orig "s/\([^_]\)BIT(/\1VB_BIT(/g" '{}' +
for i in `find . -type f -regex '.*\.[ch]'`; do
   diff -q "$i" "$i".orig
done

Files ./r0drv/alloc-r0drv.h and ./r0drv/alloc-r0drv.h.orig differ

After doing that, run make again and install the module as shown above.

Installing from source

NOTE: I was not able to use the (userspace-)VirtualBox application with vboxdrv.ko from the SVN repository. So we really have to build the whole shebang, not just the kernel module.

 TODO!

Set up Networking

VirtualBox sets up NAT for the guest systems, which means the guest has access to the outer world (and the internet, using the host system as our default gateway. But since NAT is setup within the VirtualBox process (you don't see a thing on the host system, no netfilter rules or the like) and NAT sucks anyway, we'll try to set up a slightly more sophisticated network:

Linux guest

Note: Make sure that the guest has CONFIG_BRIDGE set!

Since we're dealing with layer-2 here, we have use TAP, not TUN:

tunctl -t tap1 -u <user>
ip link set up dev tap1

Create the bridge:

brctl addbr br0
brctl addif br0 tap1
 

Set the IP address and routing

ip link set up dev br0
ip addr  add 10.1.1.1/24 dev br0
ip route add 10.1.1.0/24 dev br0

Links