Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old November 5th, 2007   #1
P4man
Linux noob forever
 
P4man's Avatar
 
Join Date: Oct 2007
My beans are hidden!
Howto: Install VirtualBox and integrate it with Compiz

Purpose of this how-to:

Install and configure VirtualBox, set up a (virtual) windows environment, and integrate it seamlessly with your Ubuntu desktop using Compiz.




Requirements

Prerequisites:
- working Ubuntu installation
- Windows installation disks (not recovery disks!)
- optional: working composite video for the Compiz part

Tested with:
- Ubuntu 7.10,
- VirtualBox 1.5.2 (both binary and OSE),
- Windows XP.


Step 1 download and install VirtualBox



Downloading

There are two versions of VirtualBox, the OSE (opensource edition) and the closed source, binary one. The OSE edition is the one you will find in "add/remove programs", but it lacks some features of the binary one, most notably, USB support. For this reason, I would advice using the binary. The binary version can be found in the repositories or downloaded it here (for gutsy)::
http://www.virtualbox.org/download/1...gutsy_i386.deb

Installation

After installing, you will get a warning that you need to add users to the vboxusers group. Let's do so now:

System menu > administration > users and groups > manage groups

Select the “vboxusers” group > properties > check any users you want to be able to use VB.

Now log out, and log in again for these changes to become effective.

Configure VirtualBox


Run VirtualBox from Applications > System Tools

Fill out the registration form, and create a new VM, give it a name, select the appropriate OS Type for what you intend to install (XP in my case):

Select the amount of RAM you want to give to your VM. For XP you will need at least 256 Mb RAM, depending how much RAM you have and on what windows applications you intend to run 500Mb or more is probably better:

Create a new virtual hard disk


Select Dynamically expanding. Give it a name and size.
Important! you will not be able to increase the size after creating it (although you can add other virtual drives). Since unused space on your virtual drive will take no room on your real hard disk, make this disk large enough! Click finish.

Prepare booting your VM

Click on “Settings” to modify some properties of your VM. If you use Gutsy, you may now get this error: "Could not load the Host USB Proxy Service (VERR_FILE_NOT_FOUND)":

To fix it, we need to enable usbfs. Open a terminal and type:

Code:
sudo gedit /etc/init.d/mountdevsubfs.sh
Find this part:

Code:
    # Magic to make /proc/bus/usb work
    #
    #mkdir -p /dev/bus/usb/.usbfs
    #domount usbfs "" /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
    #ln -s .usbfs/devices /dev/bus/usb/devices
    #mount --rbind /dev/bus/usb /proc/bus/usb

remove the # sign in front of the last 4 lines so it looks like this:

Code:
    # Magic to make /proc/bus/usb work
    #
    mkdir -p /dev/bus/usb/.usbfs
    domount usbfs "" /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
    ln -s .usbfs/devices /dev/bus/usb/devices
    mount --rbind /dev/bus/usb /proc/bus/usb
Reboot Ubuntu.

Restart virtualbox, select your VM, then click settings. You should have no error messages now.

Go to CD-DVD-ROM, and select the “mount CD/DVD drive” checkbox. Verify that the device is correct((/dev/cdrom in my case).

You probably also want to enable sound in audio /enable audio. ALSA is the most likely choice. If you want any USB devices to be available to windows, go to USB, enable it and click the tiny “add from..” button, select the device(s) you need.

Setting up some shared folders is a good idea too, these will be network drives available in your VM.

Now insert your windows installation disk (not a recovery disk!) in the cd drive, and start your virtual machine. Windows setup should boot from the CD.

Install windows as you would normally.

If the VM "steals" your mouse and keyboard, the default key to release them is the right control key on your keyboard. You can change that, but we will change this behaviour later anyway.

Step 2 configure your virtual machine

At this point, you should have a working virtual windows in a window. You may have to do some "windows stuff" like activating (/"patching") windows. Your sound should work, as well as your network.

If you installed Vista rather than XP, please refer to the virtualbox manual how to enable your network. The manual can be found here:
http://www.virtualbox.org/download/UserManual.pdf

Guest additions


Now lets install the VirtualBox Guest additions by selecting it from the "Devices" menu in your VirtualBox VM window/

If nothing happens automatically, then in the VM, go to "my computer" and doubleclick on the CD icon. This should launch the wizard to install some drivers that make integration with the host OS much better. Follow the wizard, accept the license, ignore the unsigned driver warnings, etc. At the end, reboot the virtual machine.

Now you can go in and out of the VM with your mouse without it being trapped inside the VM. You can also resize the window, and the VM will automatically adjust the resolution.

Network drives

You can also map the network drives now, so your VM has access to your real disks. They are available through windows networking. Just create a new network location through the windows wizard and browse to the VirtualBox shared folders (assuming you set them up earlier):

You can also open a command prompt (yes windows has them too! and type:

Code:
net use x: \\vboxsvr\sharename
where x: is the drive letter you want to assign, and sharename is the name you gave to the location in VirtualBox configuration earlier.

Time for some magic

In the VM, open a window, like IE, or any app, it doesnt matter. Make sure it is neither minimized,nor maximized, then press right-control + L. This activates "seamless mode", which basically means putting the VM in fullscreen and no longer drawing the windows desktop, instead you get to see your Ubuntu desktop. If your windows taskbar gets hidden behind the Gnome panels, try pressing rctrl+L again twice.

There is at least one problem with this seamless mode: it doesn't work with all windows minimized (or no open windows at all). You have to keep at least one windows app open and visible or the screen will go black or corrupt. If this happens, rctrl+L is still your friend. Untill this problem is solved, you can work around it by installing a desklet style app that always shows a clock or something. I run calculator on startup and hide it behind it the taskbar

Finishing Touches

I am going to assume you have accelerated videodrivers working with compositing enabled. There are hundreds of how-to's to achieve that, and in most cases its almost automatic.

Then configuring Compiz is something I'm not going to explain in detail either. The short version is:

Code:
sudo apt-get install compiz-config-settings-manager
Then go to system > preferences > appearance > visual effects > custom

In the preferences enable the 3D cube and cube rotation plugins, configure them as you see fit.

Wallpaper

If you've seen my video, you may have noticed I have different wallpapers on different sides of the cube. This is something normally not supported, but there are ways to achieve it.

First, let me say I just bumped into this tutorial:
http://ubuntuforums.org/showthread.php?t=600909

I have not tried this yet, and it does look tricky and intimidating, but feel free to give it a try and let me know if it worked.

The method I used is far simpeler, but does have a drawback: you loose your desktop icons. If you don't mind that, then all you have to do is first disable nautilus painting the desktop. In a terminal type:

Code:
gconf-editor
Browse to apps > nautilus > preferences > show_desktop and unselect it.

Next, we define the wallpapers in Compiz setting manager.
Go to Desktop Cube > Appearance
And in background images add the ones you want:

If you liked the one's I used, you can download them from here:
http://www.gnome-look.org/content/sh...?content=69464

Launching of VirtualBox

An easy way to launch VirtualBox is creating a starter on your panel (right click on it > add to panel > custom launcher) , or even adding it in your session list if you want to start it automatically each session. The command to use is simply:

Code:
VBoxManage startvm name_of_your_virtual_machine
(please note the uppercase letters)

That's all follks!

Last edited by P4man; November 14th, 2007 at 05:27 AM..
P4man is offline   Reply With Quote
Old November 30th, 2007   #2
SonnySee
First Cup of Ubuntu
 
Join Date: Nov 2007
Beans: 4
Re: Howto: Install VirtualBox and integrate it with Compiz

This is exactly what I was looking for.
You made it crazy easy for me to do it.
Now, to try using multiple backgrounds.
Thanks again.
SonnySee is offline   Reply With Quote
Old December 1st, 2007   #3
maka
A Carafe of Ubuntu
 
Join Date: Feb 2006
Beans: 100
Re: Howto: Install VirtualBox and integrate it with Compiz

great howto! thanks much. fixed all the problems i had.
maka is offline   Reply With Quote
Old December 3rd, 2007   #4
de_valentin
A Carafe of Ubuntu
 
de_valentin's Avatar
 
Join Date: Apr 2007
Location: Netherlands
Beans: 106
Ubuntu 9.10 Karmic Koala
Send a message via MSN to de_valentin
Re: Howto: Install VirtualBox and integrate it with Compiz

Thanks for the Howto, everything worked out great except for the last line of code .

I get this error when I click the button in the panel

Quote:
Could not launch application
Failed to execute child process "VBoxManage" (No such file or directory)
__________________
-- Really it's not a big deal,...some of my best friends are microsoft certified engineers. --
de_valentin is offline   Reply With Quote
Old December 3rd, 2007   #5
de_valentin
A Carafe of Ubuntu
 
de_valentin's Avatar
 
Join Date: Apr 2007
Location: Netherlands
Beans: 106
Ubuntu 9.10 Karmic Koala
Send a message via MSN to de_valentin
Re: Howto: Install VirtualBox and integrate it with Compiz

Just figured it out, indeed note the uppercases.
In /usr/bin there was only a vboxmanage and not a VBoxManage so fixed that now I have the quickest loading XP I ever had
__________________
-- Really it's not a big deal,...some of my best friends are microsoft certified engineers. --
de_valentin is offline   Reply With Quote
Old December 5th, 2007   #6
sowelie
Way Too Much Ubuntu
 
sowelie's Avatar
 
Join Date: Jan 2007
Location: NH, USA
Beans: 234
Ubuntu Jaunty Jackalope (testing)
Re: Howto: Install VirtualBox and integrate it with Compiz

I have virtualbox all working with an install of server 2003, but seamless mode doesn't work, it basically just goes into full screen mode...any suggestions? Alternatively, i could just use it in full screen mode, but I can't get my native resolution to work in the guest. Any help is much appreciated.
sowelie is offline   Reply With Quote
Old December 9th, 2007   #7
sowelie
Way Too Much Ubuntu
 
sowelie's Avatar
 
Join Date: Jan 2007
Location: NH, USA
Beans: 234
Ubuntu Jaunty Jackalope (testing)
Re: Howto: Install VirtualBox and integrate it with Compiz

For anyone reading this thread, I figured the issue out. I had installed Virtualbox Guest Additions off of their website, rather than through virtualbox itself (because it did not work the first time). Once I installed the guest additions through virtualbox everything worked perfectly.
sowelie is offline   Reply With Quote
Old December 10th, 2007   #8
Vinno
Just Give Me the Beans!
 
Vinno's Avatar
 
Join Date: Dec 2007
Beans: 79
Re: Howto: Install VirtualBox and integrate it with Compiz

Your guide seems to be easy enough,

My main reasons would be to use webcam on msn and use adobe photoshop.

My question would be:

**Does virtual box emulate hardware like webcam and etc like a normal windows install?

**The ram setting installation, if i set say 500 aside for xp, does linux seperate that from ubuntu ram allocation or do they just share my total ram and window can only have so much as i set when needed?
Vinno is offline   Reply With Quote
Old December 10th, 2007   #9
P4man
Linux noob forever
 
P4man's Avatar
 
Join Date: Oct 2007
My beans are hidden!
Re: Howto: Install VirtualBox and integrate it with Compiz

Quote:
Originally Posted by Vinno View Post
Y
**Does virtual box emulate hardware like webcam and etc like a normal windows install?
Well, yes. You can "pass through" USB devices. That doesn't always work with every device but there is a good chance your webcam will work. You have to select the USB devices you want windows to see in the virtualbox config. Beware though, this option is ONLY available on the binary version, not on the OSE version.

Quote:
**The ram setting installation, if i set say 500 aside for xp, does linux seperate that from ubuntu ram allocation or do they just share my total ram and window can only have so much as i set when needed?
AFAK the first. It doesn't support dynamically expanding RAM the way it does for harddisk space. I think it would be extremely hard to make that work
P4man is offline   Reply With Quote
Old December 13th, 2007   #10
johnnybirdman
A Carafe of Ubuntu
 
johnnybirdman's Avatar
 
Join Date: Oct 2007
Beans: 112
Ubuntu 9.10 Karmic Koala
Re: Howto: Install VirtualBox and integrate it with Compiz

Quote:
Originally Posted by P4man View Post


Launching of VirtualBox

An easy way to launch VirtualBox is creating a starter on your panel (right click on it > add to panel > custom launcher) , or even adding it in your session list if you want to start it automatically each session. The command to use is simply:

Code:
VBoxManage startvm name_of_your_virtual_machine
(please note the uppercase letters)

That's all follks!
Is there a way to make it launch to a specific workspace on the cube/wall?

PS: brilliant work, got win2000 up and running with your how to in now time. xp is next.
johnnybirdman is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:36 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry