Virtual Box
1. Introduction
2. Installing Virtual Box on Ubuntu
2.1 Post install configuration
2.2 Ubuntu 9.04 are earlier
2.3 Reconfigure after Kernel update
3. VirtualBox Optimisation
4. VirtualBox GUI on headless Server
5. VirtualBox Web Console
5.1 phpVirtualBox
5.2 VboxWeb
6. VirtualBox Remote Client Connection
6.1 Using rdesktop-vrdp
6.2 Using rdesktop
6.3 vrdp authentication
7. Auto Start Virtual Box Guests
7.1 Installing VBoxTool
7.2 Configuring VBoxTool
8. Migrating VMWare to Virtual Box
Introduction
I used to use VMWare at home but migrated to VirtualBox when it hit version 2.1. Like some of my other wiki pages this is not all new information, just an aggregation of information I found online plus some bits of my own.Installing Virtual Box on Ubuntu
There are two versions of Virtual Box, the Open Source Edition (OSE) and the Closed Source Edition. I am interested in the Closed Source Edition because I require most of the features it provides, not least USB 2.0 support. I'm not going to repeat the clear installation instruction that are already available on the VirtualBox website.Post install configuration
Add yourself to the vboxusers groupsudo adduser YOURUSERNAME vboxusers
Ubuntu 9.04 are earlier
This step is only required for older Ubuntu versions. Find the devgid for 'vboxusers'grep vboxusers /etc/group | cut -f3 -d':'It will return something like...
128Add this line to the bottom of '/etc/fstab', replacing the devgid number with the one from your system.
none /proc/bus/usb usbfs devgid=128,devmode=664 0 0Reboot and you should now have Virtual Box installed with USB support.
Reconfigure after Kernel update
REMEMBER Run the following to reconfigure VirtualBox kernel modules after a kernel update.sudo /etc/init.d/vboxdrv setupReferences
- VirtualBox with USB Support on Ubuntu 8.10 Intrepid Ibex
- http://davestechsupport.com/blog/2008/07/10/virtualbox-vs-vmware-server/
VirtualBox Optimisation
I currently researching how best to optimise my VirtualBox hosts and guests, more details will follow. The links below are what I've found useful thus far. References- http://ubuntuforums.org/showthread.php?t=646613
- http://home.icequake.net/~nemesis/blog/index.php/archives/321
- http://prefetch.net/blog/index.php/2009/04/23/best-io-scheduler-to-use-with-virtualized-linux-hosts/
- http://jdpfu.com:82/2010/06/22/virtualbox-performance-improved
- http://www.badkey.com/db/blogsphere.nsf/d6plinks/JWIE-7M3V6X
- http://searchnetworking.techtarget.com.au/articles/34122-Twelve-top-VMware-ESX-Server-guest-OS-performance-tips
- http://www.ctrlaltgeek.com/category/virtualbox/
VirtualBox GUI on headless Server
To enable X11 forwarding on the server you need at least the xauth program. Install 'xbase-clients' on the server so that you can connect to the server with SSH.aptitude install xbase-clientsTo run the remote VirtualBox GUI on your local Linux workstation do the following.
ssh -X user@server.example.com VirtualBoxYou should now see the VirtualBox GUI and can remotely administer your virtual machines.
VirtualBox Web Console
phpVirtualBox
Simply put phpVirtualBox is brilliant! This is what you want to use.VboxWeb
NOTE! VboxWeb is a proof of concept from the Virtualox developers and no longer maintained or developed. The VirtualBox Web Console (VBoxWeb) is an open source project implementing an AJAX version of the popular VirtualBox user interface. As a modern web interface, it allows you to access and control remote VirtualBox instances. NOTE! At the time of writing VirtualBox Console is shaping up nicely but it is not complete yet or suitable for production use. You'll require VirtualBox 3.0.6 (or better) already installed on your computer. I've tested this on Ubuntu Jaunty 9.04.sudo -s -H aptitude -y install python-simplejson mkdir -p /opt/vboxweb cd /opt/vboxweb svn checkout http://vboxweb.googlecode.com/svn/trunk/ .Create a user account for VirtualBox Console.
python VBoxWebSrv.py adduser myuser mypasswordYou can find how to use VBoxWebServ.py using the following command.
python VBoxWebSrv.py helpTry out starting up VBox Web Console the first time.
python VBoxWebSrv.pyYou should see something like this.
VirtualBox Version: 3.0.8, Platform: linux2 Using config file: /opt/vboxweb-read-only/VBoxWeb.conf Downloading Sun RDP Web Control ... Status: 0% Status: 11% Status: 22% Status: 33% Status: 45% Status: 56% Status: 67% Status: 78% Status: 90% Status: 100% Download complete. Extracting ... Extracting rdpweb_1.0.swf Extracting license.txt Cleaning up ... Installation successful. [16/Oct/2009:09:19:35] ENGINE Bus STARTING [16/Oct/2009:09:19:35] ENGINE Started monitor thread '_TimeoutMonitor'. [16/Oct/2009:09:19:35] ENGINE Started monitor thread 'Autoreloader'. [16/Oct/2009:09:19:35] ENGINE Serving on 0.0.0.0:8080 [16/Oct/2009:09:19:35] ENGINE Bus STARTED [16/Oct/2009:09:19:57] ENGINE Started monitor thread 'Monitor'.Now open your browser and type in the URL Login using the username and password you just created. If you have already configured some virtual machines you should see them in the VM list on the left side. When you've finished testing VBoxWeb console, press CTRL+C in your console window to quit the server part and close the web browser. I will create an init.d script for VBoxWeb soon. References
VirtualBox Remote Client Connection
You can remotely connect to the console of the virtual guest using the RDP protocol, also known as Terminal Services. In order to connect to a remote guest you establish a RDP connection the the Virtual Box host but use the VRDP port number assigned to the guest OS. Here are some examples of how to connect to a guest OS using 'rdesktop-vrdp' (which is bundled with Virtual Box) and vanilla 'rdesktop'. The '-k' option sets the keyboard mapping for the United Kingdom.Using rdesktop-vrdp
The advantage of the modified 'rdesktop-vrdp' is that is support USB redirection.rdesktop-vrdp -k en-gb -z -r clipboard:PRIMARYCLIPBOARD -5 virtualboxhost.example.org:3389
Using rdesktop
rdesktop -k en-gb -z -r clipboard:PRIMARYCLIPBOARD -5 virtualboxhost.example.org:3389
vrdp authentication
TODO! References- https://help.ubuntu.com/community/VirtualBox/RDP
- http://blog.subaquatic.net/archives/setting-up-virtualbox-external-vrdp-authentication/
- http://mreschke.com/mrcore/mrticles/Headless VirtualBox
- http://ubuntuforums.org/showthread.php?t=1438854
- http://tech.surveypoint.com/virtualbox-remote-connection.html
Auto Start Virtual Box Guests
Unlike VMWare you can't simply tick a box to get your guests booting when the host boots. However, a simple init.d script can do the job and there are even a couple of 3rd party tools to manage things for you. I suggest using VBoxTool to manage guest auto start and shutdown.Installing VBoxTool
sudo -s -H cd mkdir VboxTool cd VBoxTool wget "http://downloads.sourceforge.net/project/vboxtool/vboxtool/0.4/vboxtool-0.4.zip?use_mirror=kent" -O vboxtool-0.4.zip vboxtool-0.4.zip cp script/vboxtool /usr/local/bin chmod +x /usr/local/bin/vboxtool cp script/vboxtoolinit /etc/init.d chmod +x /etc/init.d/vboxtoolinit update-rc.d vboxtoolinit defaults 99 10 mkdir -p /etc/vboxtoolIf you ever need to remove vboxtoolinit from autostart run the following
update-rc.d -f vboxtoolinit remove
Configuring VBoxTool
Configuration from vboxtool does not taking place on running sessions, so save or stop all sessions before issuing the autostart command. Create '/etc/vboxtool/machines.conf'. The format is as follows.<session name>,<VRDP-port>For example...
WindowsXP,3389 UbuntuServer,3390 UbuntuDesktop,3391The VRDP-port enables RDP-clients like 'rdesktop' to connect. It may be left blank. Create '/etc/vboxtool/vboxtool.conf'. The format is as follows.
vbox_user='<user name>'Issue the following command:
vboxtool autostartVBoxTool will configure sessions (VRDP-port). By now, session(s) should be up and running and configured. Check if sessions or running, with the assumed vrdp-port:
vboxtool showShow only the running sessions:
vboxtool showrunCheck if sessions configured in '/etc/vboxtool/machines.conf' are be automatically started at reboot. Reboot your system, check with:
vboxtool showrunReferences
Migrating VMWare to Virtual Box
I had several Ubuntu Server 8.04 VMWare guests that were previously running on VMWare Server 1.0.6. Here is how I migrated the Ubuntu guests.- Create a hard disk directory for each virtual machine in '~/.VirtualBox/Ha/HardDisks'
- Copy '*.vmdk' for each VMWare machine to the appropriate hard disk directory we created above.
- Create a new Virtual Box machine configuration that matches as closely as possible each of the VMWare machines. Use the appropriate existing disk image that we copied earlier for each virtual machine.
- TIP! Initially set all the network interfaces up as 'Not Attached' this will prevent the virtual machine doing anything while you migrate them.
- Repeat the following for each machine.
- Boot it up.
- Remove VMWare Tools.
sudo vmware-uninstall-tools.pl
- Reboot.
- Mount the Guest Additions .ISO image and install them.
sudo aptitude install dkms build-essential linux-headers-`uname -r` sh ./VBoxLinuxAdditions-x86.run
- Shutdown.
- Setup the Network Card appropriately.
- Boot and test. If your network interface ids have increased (from eth0 to eth1 for example) then edit the file below to correct the assignments.
sudo nano /etc/udev/rules.d/70-persistent-net.rulesReferences
$Id: VirtualBox,v 1.44 2010/08/11 17:28:23 martin Exp $
Wiki Index All Recent Edit Top


