VirtualBox
VirtualBox 简介
原文出处:https://help.ubuntu.com/community/VirtualBox
原文作者:
授权许可:
翻译人员:
校正人员:
贡献人员:
适用版本: 文章状态:等待翻译
This document provides information on using the Virtual Box system emulator under Ubuntu.
Installation
There are two versions of VirtualBox availabe, the Open Source Edition and the free, but proprietary, Personal Use / Evaluation License version.
Open Source Edition
Currently the best way to install the GPL version of Virtual Box is to compile from scratch. The following page details how to compile Virtual Box (follow instructions for use under Debian).
After you compile and install VirtualBox, you may need to load the module before the program will run.
sudo modprobe vboxdrv
PUEL (Personal Use & Evaluation License) Version
For both Edgy and Feisty, install the edgy .deb from http://virtualbox.org/wiki/Downloads
While this is non-free and only for personal use, it adds USB support and virtual Remote Desktop support. Without this, your USB devices can't be used in the guest OS and you cannot use Windows Remote Desktop as a server in the guest OS.
Using Virtual Box
First Run
attachment:01_Screenshot-VirtualBox_OSE.png
Creating a new Virtual Machine
Click New to start the "Create New Virtual Machine" Wizard.
attachment:02_Screenshot-Create_New_Virtual_Machine.png
Specify a virtual machine name and operating system type.
attachment:03_Screenshot-Create_New_Virtual_Machine-1.png
Specify an amount of RAM to dedicate to this virtual machine when it is running.
attachment:04_Screenshot-Create_New_Virtual_Machine-2.png
Either choose an existing image, go and find one with the Existing button, or press "New" to start the "Create New Virtual Disk" Wizard.
attachment:05_Screenshot-Create_New_Virtual_Machine-3.png
Creating a new disk image
attachment:06_Screenshot-Create_New_Virtual_Disk.png attachment:07_Screenshot-Create_New_Virtual_Disk-1.png attachment:08_Screenshot-Create_New_Virtual_Disk-2.png attachment:09_Screenshot-Create_New_Virtual_Disk-3.png
Assign the image to the virtual machine
Back in the "Create New Virtual Machine" Wizard.
attachment:10_Screenshot-Create_New_Virtual_Machine-4.png
Summary page is then shown.
attachment:11_Screenshot-Create_New_Virtual_Machine-5.png
Details page shows the settings for this Virtual Machine.
attachment:12_Screenshot-VirtualBox_OSE-1.png
Attaching a CDROM image
Click on CD/DVD-ROM in the Details tab.
Tick "Mount CD/DVD Drive" and tick ISO Image file then go find it with the select button.
attachment:13_Screenshot-Ubuntu_Dapper_6.06_LTS_-_Settings.png
Virtual Disk Manager starts. Click Add.
attachment:14_Screenshot-Virtual_Disk_Manager.png
Explorer style dialog (!) appears, go find the ISO image.
attachment:15_Screenshot-Select_a_DVD-CD-ROM_disk_image_file.png
Added to the Virtual Disk Manager as a CD/DVD Image, choose it then click Select.
attachment:16_Screenshot-Virtual_Disk_Manager-1.png
Back in the CD/DVD-ROM selection dialog.
attachment:17_Screenshot-Ubuntu_Dapper_6.06_LTS_-_Settings-1.png
Starting the emulator
Boot up the VM using the "Start" button.
attachment:19_Screenshot-VirtualBox_OSE-2.png
The VM booted.
attachment:18_Screenshot-Ubuntu_Dapper_6.06_LTS_[Running]_-_VirtualBox_OSE.png
Un-Grabbing the mouse & keyboard
In the bottom right hand corner of the emulated machine window is the name of the key required to make Virtual Box un-grab the mouse and keyboard. By default this is Control_R which actually means the right hand Control key, not control and the letter R.
Networking
To start, NAT is by far the easiest way to get your guests connected to the interweb, but you may want to use the guests as servers, for this you need Host Networking. You will need to install bridge-utils and uml-utilities so that you can make a tap device and add it to a bridge.
sudo apt-get install bridge-utils uml-utilities
Now make a bridge, and put your current interface into it:
sudo tunctl -t tap1 -u fred #where fred is the user you will be running vbox as sudo chmod 666 /dev/net/tun
Make a new bridge called br0:
sudo brctl addbr br0
Put your current interface (in this case eth0) into promiscuous mode, then add it to the bridge and give the bridge a dhcp address.
sudo ifconfig eth0 0.0.0.0 promisc sudo brctl addif br0 eth0 dhclient br0
Add the new tap1 device to the bridge
sudo brctl addif br0 tap1
You should now be able to use host networking in vbox, just change "attached to" to "host interface" and add the interface name of tap1 in your networking settings. Read the manual as well, there are some other nifty ways to do this
USB
To get USB support, you need the PUEL version. Via the GUI, there is an option to enable USB.
Furthermore, your user must be able to access /proc/bus/usb/* and the best way I've found to do this is to give run chown on /proc/bus/usb.
sudo chown -R root:vboxusers /proc/bus/usb
Now just make sure your user is part of the group vboxusers, and all is well. I'm assuming this solution doesn't work when you restart your computer so we've got a fix for that as well.
sudo nano /etc/init.d/mountdevsusbfs.sh
Append ",devgid=1003", where 1003 is the number if your vboxusers group in /etc/group, to the end of the "domount usbfs ..." line, and change the devmode to 0664.
Support
For help with virtualbox beyond the scope of this documentation, see the VirtualBox Community Page or for live assistance try #vbox on irc.freenode.net in an IRC client.