May 1

Ubuntu下VirtualBox详细安装教程 不指定

felix021 @ 2008-5-1 17:42 [IT » 操作系统] 评论(0) , 引用(0) , 阅读(5704) | Via 本站原创 | |


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. ( ewm8.png) lns6.png (


- 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


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):: x_1.5.2-25433_Ubuntu_gutsy_i386.deb


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:

sudo gedit /etc/init.d/

Find this part:

# 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:

# 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:

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:

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:

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.


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:

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:


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: s+Dragon+wallpaper?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:

VBoxManage startvm name_of_your_virtual_machine

(please note the uppercase letters)

That's all follks!


转载请注明出自 ,如是转载文则注明原出处,谢谢:)
Tags: ,
昵称   密码   *非必须
网址   电邮   [注册]