VirtualBox

From ArchWiki
Revision as of 08:34, 23 June 2007 by Dheart (talk | contribs) (How to get VirtualBox working on arch.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

What is VirtualBox

VirtualBox is a virtual pc emulator like vmware, exept that it is free, easier to configure. Also it has all the features vmware has.

Editions

VirtualBox has two editions: VirtualBox-ose and VirtualBox (Personal Use and Evaluation License (PUEL)

VirtualBox-ose

This is the open source version of VirtualBox that can be found in the community repository. It lacks some feachures like sharing folders between the host and the guest machine and USB support.

VirtualBox (PUEL)

This is the free for personal use version of VirtualBox it can be found in AUR, or you can download it from the Download section at VirtualBox's site The extra features are:

  • Remote Display Protocol (RDP) Server

This component implements a complete RDP server on top of the virtual hardware and allows users to connect to a virtual machine remotely using any RDP compatible client.

  • USB support

VirtualBox implements a virtual USB controller and supports passing through USB 1.1 and USB 2.0 devices to virtual machines.

  • USB over RDP

This is a combination of the RDP server and USB support allowing users to make USB devices available to virtual machines running remotely.

  • Shared Folders

With the use of Shared Folders, users can share directories on their host system with guest systems.

  • iSCSI initiator

VirtualBox contains a builtin iSCSI initiator making it possible to use iSCSI targets as virtual disks without the guest requiring support for iSCSI.

Installation

Now to install VirtualBox. There are two options: Installing the OSE version or the PUEL version.

Install VirtualBox OSE

To install VirtualBox OSE, you need to have the community repository uncommented in /etc/pacman.conf

#[community]
# Add your preferred servers here, they will be used first
#Include = /etc/pacman.d/community

becomes:

[community]
# Add your preferred servers here, they will be used first
Include = /etc/pacman.d/community

Now use pacman to install VirtualBox OSE:

pacman -Sy virtualbox-ose

(NOTE: The program generates desktop entry that can be located in applications -> system tools -> VirtualBox OSE)

This will select by default virtualbox-ose and virtualbox-modules packages. Than you need to add yourself to the virtualbox group:

gpasswd -a USERNAME vboxusers

(Note: You need to logout/login in order this change to take effect)

Than add vboxdrv to the modules section in /etc/rc.conf in order to make that module load when the pc boots. If you want to manually load the module type as root:

modprobe vboxdrv

Install VirtualBox PUEL

This is done easily since we have a nice pkgbuild in AUR done by piie.

(NOTE: VirtualBox depends on QT4 so make sure you have it installed before makepkg is issued)

Download the PKGBUILD, issue makepkg and that as root:

pacman -A NAME OF THE PACKAGE.pkg.tar.gz

(NOTE: The program generates desktop entry that can be located in applications -> system tools -> Innotek VirtualBox)

After the install add yourself to the virtualbox users group:

gpasswd -a USERNAME vboxusers

(Note: You need to logout/login in order this change to take effect)

Add vboxdrv to the modules section in /etc/rc.conf

IMPORTANT:
You need to run "/sbin/vbox_build_module" after kernelupdate to generate new module for the new kernel.

Configuration

After we have installed VirtualBox on our system and added ourselves in the vboxusers group we can start configurating our system in order to make all the features of VirtualBox avaliable to us.Create a new virtual machine using the wizard provided by the GUI and than click settings in order to edit the virtual machine settings.

Getting network in the guest machine to work

First let's get network working in the guest machine. Click the network tab. The not attached option means you'll have "Network cable unpluged or similar error in the guest computer.

Using NAT network

This is the simplest way to get network. Select NAT network and it should be ready to use. The NAT IP adress on the first card is 10.0.2.0, 10.0.3.0 on the second and so on...

Using host interface networking

This way is a bit harder, but it allows you to see the VirtualMachine as a "real" computer on your local network. You need to get bridge-utils

pacman -Sy bridge-utils

1. Create a new bridge with this command:

brctl addbr br0

2. If you are not using DHCP, run ifconfig and note down the network configuration of your existing network interface (e.g. eth0), which we will need to copy to the bridge in a minute.

(NOTE: You will need this settings so make sure you don't lose them!!!!

3. Switch your physical network adapter to "promiscuous" mode so that it will accept Ethernet frames for MAC addresses other than its own (replace eth0 with your network interface):

ifconfig eth0 0.0.0.0 promisc 

(NOTE: You will lose network connectivity on eth0 at this point.)

4. Add your network adapter to the bridge:

brctl addif br0 eth0

5. Transfer the network configuration previously used with your physical ethernet adapter to the new bridge. If you are using DHCP, this should work:

dhclient br0

Otherwise, run ifconfig br0 x.x.x.x netmask x.x.x.x and use the values that you noted down previously.

6. To create a permanent host interface called vbox0 (all host interfaces created in this way must be called vbox followed by a number) and add it to the network bridge created above, use the following command:

VBoxAddIF vbox0 vboxuser br0

Replace vboxuser with the name of the user who is supposed to be able to use the new interface.

Getting USB to work in the guest machine

First in order to make usb avaliable for use to the virtual machine you must add this line to your /etc/fstab

none			/proc/bus/usb	usbfs	devgid=85,devmode=664 	0	0

If you don't mind a security hole change devmode from 664 to 666.

Than you need to reboot in order for the changes to take effect. After that click the USB tab in the settings of the virtual machine and select which devices are avaliable to your pc on boot. If you wish your virtual machine to use device that you have just plugged in (assuming the virtual machine has booted already), go to the VirtualMachine screen go to devices -> USB Devises -> and select the device you wish to plug in the virtual pc.

Sharing folders between the host and the guest

In the settings of the virtual machine go to shared folders tab and add the folders you want to share.

(NOTE: You need guest additions installed in order to use this feature. When you have booted the virtual machine go to devices tab and select "Install guest additions". This feature in only avaliable in the PUEL version)

Than to use the shared folder in the windows guest machine:

In a Windows guest, use the following command:

net use x: \\vboxsvr\sharename While vboxsvr is a fixed name, replace "x:" with the drive letter that you want to use for the share, and sharename with the share name specified with VBoxManage.

In a Linux guest, use the following command:

mount -t vboxsf [-o OPTIONS] sharename mountpoint Replace sharename with the share name specified with VBoxManage, and mountpoint with the path where you want the share to be mounted (e.g. /mnt/share). The usual mount rules apply, that is, create this directory first if it does not exist yet. Beyond the standard options supplied by the mount command, the following are available: iocharset CHARSET to set the character set used for I/O operations (utf8 by default) and convertcp CHARSET to specify the character set used for the shared folder name (utf8 by default).

Getting audio to work in the guest machne

In the machine settings go to the audio tab and select alsa driver.

Setting up the RAM and Video Memory for the virtual PC

You can change the default values by going to settigs -> general.

Setting up CDROM for the Virtual PC

You can change the default values by going to settigs -> CD/DVD-ROM.

Check mount cd/dvd drive and select one of the following options.

Have fun!

Have fun using the better virtual pc emulator :)