VirtualBox virtual machines using notes-installation, enhancements, networking, USB devices, shared directories

Source: Internet
Author: User
Tags uuid


VirtualBox virtual machines using notes-installation, enhancements, networking, USB devices, shared directories

Summary: VirtualBox virtual machine installation, enhancements, network, USB devices, shared directory

Main system: ubuntu8.10
Virtual System: ubuntu8.04

Preparatory work
Install the current kernel header file
sudo apt-get install linux-header-2.6.xx
Begin:

1. Add the following source:
Deb Http://download.virtualbox.org/virtualbox/debian Intrepid Non-free

2. Download the key file and import:
Wget-q http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc-o-| sudo apt-key add-
This step can also do this:
A. Download key file Http://download.virtualbox.org/virtualbox/debian/sun_vbox.asc
B. Open the software source-> authentication-> Import the key file, select the SUN_VBOX.ASC you just downloaded

3. Update source
sudo apt-get update

4. Installation
Apt-get Install virtualbox-2.2 dkms
virtualbox-2.2 is the virtual machine we want to install, dkms can ensure that after your host kernel is upgraded, the Vboxdrv, Vboxnetflt and so on that the virtual machine needs to run will be upgraded as well.
Because I originally installed VBox, in Ann's process will prompt you whether to use the original configuration, of course, use the original configuration, because my original VBox installed the system, but also to continue to use.

5. Do not rush to the Shing menu of the corresponding virtual machine startup items, because it is not yet installed, restart the host bar.

6.vbox Network Section
Open virtual machine, configure network: Bridged adapter, eth0
Start your virtual system, open the terminal, Ifconfig will find your virtual machine and host is on a network segment (my host area network is automatic DHCP), ping a try, should be OK; In addition, host, host two systems access to the extranet is no problem.

Many people will mess up the host network when they configure the virtual machine network, if this happens:
Your host Ubuntu network connection shows disconnected, and there is "no valid activation of the connection" hint, but you can actually access the Internet (more often not online), you can: Open the terminal (main Ubuntu)
sudo vi/etc/network/interfaces
In addition to the line containing lo, all other rows are deleted, saved, and exited.
Reboot the main Ubuntu.ok.

7. Install the enhanced Feature Pack
Point VBox The main menu of the device-> installation enhancements, a virtual CD will appear on the virtual machine, open the terminal, access the CD-ROM mount directory:
sudo./vboxlinuxadditions-x86.run
Install the restart virtual machine.

8. Set up VBox shared directory
You can refer to http://blog.redzone.com.cn/read.php/50.htm
Use a shared directory each time you want to mount, a convenient point of approach (is the operation on the virtual machine):
Add a line to the/etc/rc.local:
Mount-t vboxsf Software/mnt/share
This does not require manual mounting for each boot.
The relatively cumbersome point of view is based on the starting level of Ubuntu, with Update-rc.d to do, the specific way to see my order a post "vbox on Ubuntu boot auto mount shared directory》。

9. Set the VBox USB device
This part is mainly excerpted from http://forum.ubuntu.org.cn/viewtopic.php?f=65&t=164209
Just do it.

------------------------------------------*
Turn on USB device support for VirtualBox
VirtualBox The default is not to support USB devices, you need to manually modify some settings to use.

1. Modify the USB device to increase the normal user rights
1.1 Add a user group named Usbfs
Code:
xmoney@xmoney-laptop:~$ sudo groupadd usbfs
[sudo] password for Xmoney:


1.2 Increase current user to workgroup
Code:
xmoney@xmoney-laptop:~$ sudo adduser xmoney usbfs//Where Xmoney is my system's login name
[sudo] password for Xmoney:


1.3 Get the ID of the USBFS group
Execute the following command
Code:
xmoney@xmoney-laptop:~$ Cat/etc/group | grep USBFS
Usbfs:x:1002:xmoney,root

1002 of which is the ID of the USBFS group.

1.4 Modifying/etc/fstab files
Code:
xmoney@xmoney-laptop:~$ sudo gedit/etc/fstab

Add one line to the end of the file
Code:
None/proc/bus/usb Usbfs devgid=1002,devmode=664 0 0

where devgid=1002, 1002 of which is just the USBFS group ID

1.5 Additional permissions for/PROC/BUS/USB
First of all, for/PROC/BUS/USB to open all permissions, that is, everyone can access.
Code:
xmoney@xmoney-laptop:~$ sudo chmod 777/proc/bus/usb
xmoney@xmoney-laptop:~$

Then set the owner to/PROC/BUS/USB for the current user, and my current user is Xmoney.
Code:
xmoney@xmoney-laptop:~$ sudo chown xmoney/proc/bus/usb
xmoney@xmoney-laptop:~$


1.6 Reboot the computer
Code:
xmoney@xmoney-laptop:~$ sudo reboot


The modification must be restarted, otherwise it will not take effect

2. Get VendorID and ProductID for USB devices
Next you need to obtain the VendorID and ProductID of the USB device, both of which are required by the VirtualBox USB settings.
Command and feedback information as follows:

Code:
xmoney@xmoney-laptop:~$ vboxmanage List Usbhost


Code:
VirtualBox Command line Management Interface Version 1.6.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Host USB Devices:

Uuid:ca2a6d3b-66e0-4a94-9f69-dddb9a44e5e4
VENDORID:0X046D (046D)
productid:0xc016 (C016)
revision:3.64 (0364)
Manufacturer:logitech
Product:optical USB Mouse
Address:/proc/bus/usb/002/002
Current State:busy

uuid:c491f7e6-abdc-43bb-9bce-ef31bdcb3551
Vendorid:0x13fe (13FE)
PRODUCTID:0X1F00 (1F00)
revision:1.16 (0116)
Manufacturer:kingston
Product:datatraveler 2.0
Serialnumber:5b850f000e96
Address:/proc/bus/usb/001/003
Current State:busy


3. Configure VirtualBox
In the VirtualBox configuration detail/USB, open the USB controller and USB2.0 controller, and then click "Add Filter from List of devices"
The related settings are automatically added to the filter list.

------------------------------------*

Reference: Http://www.virtualbox.org/wiki/Linux_Downloads


VBox on Ubuntu boot auto Mount shared directory

Keyword:ubuntu boot autorun vbox shared directory

First create VBox on ubuntu/etc/init.d/mountsharedir.sh

vi/etc/init.d/mountsharedir.sh


1 #! /bin/sh

2 ### BEGIN INIT INFO

3 # Provides:mountsharedir

4 # Required-start:

5 # Required-stop:

6 # Should-start:

7 # Should-stop:

8 # Default-start:2 3 4 5 S

9 # default-stop:0 6

# short-description:mount VBox share dir.

# Description:

### End INIT INFO

13
Path=/sbin:/bin
15
Case "$" in
Start| "")
Mount-t vboxsf-o rw software/mnt/share >>/var/log/mountsharedirlog 2>&1
19;;
Restart|reload|force-reload)
echo "Error:argument ' not supported" >&2
3 exit
23;;
Stop)
# No-op

26;;
27 *)
echo "Usage:mountsharedir.sh [Start|stop]" >&2
Exit 3
30;;
Esac
32
33:


2. Register this startup script with the UPDATE-RC.D command
sudo update-rc.d mountsharedir.sh start 2 3 4 5 S.

Part of UPDATE-RC.D's job is to create a/etc/init.d/mountsharedir.sh soft connection to/etc/rc*.d/, but that's not the only thing it does; that is, using the UPDATE-RC.D command and manual/etc/ Rc*.d/The following create a connection, the effect is different, and manual creation often does not work.

Other than that:
A common system Administration The error is to delete the links with the thought, which this would "disable" the service, i.e.,  That this would prevent the service from being started. However, if all links have been deleted then "next time" package is upgraded, the package ' Postinst script would run  Update-rc.d again and this'll rein-stall links at their factory default locations. The correct way to disable services are to configure the service as stopped in all runlevels in which it are started by DEFA  Ult. In the system V init system This means renaming
The service ' s symbolic links from S to K.

About the use of update-rc.d, picked some of the example in man:
Examples
Insert links using the defaults:
UPDATE-RC.D Foobar Defaults

Equivalent command using explicit argument sets:
UPDATE-RC.D Foobar Start 20 2 3 4 5. Stop 20 0 1 6.

More typical command using explicit argument sets:
UPDATE-RC.D Foobar Start 30 2 3 4 5. Stop 70 0 1 6.

Insert links at default runlevels when B requires A
UPDATE-RC.D script_for_a Defaults 80 20
UPDATE-RC.D Script_for_b Defaults 90 10
Insert a link to a service that (presumably) is not is needed by any other daemon
UPDATE-RC.D Top_level_app Defaults 98 02
Insert links for a script so requires services that start/stop at sequence number 20
UPDATE-RC.D SCRIPT_DEPENDS_ON_SVC20 Defaults 21 19
Remove all links for a script (assuming Foobar has been deleted already):
Update-rc.d Foobar Remove
Example of disabling a service:
Update-rc.d-f Foobar Remove
UPDATE-RC.D Foobar Stop 20 2 3 4 5.
Example of a command for installing a system Initialization-and-shutdown script:
UPDATE-RC.D foobar start S. Stop 31 0 6.
Example of a command for disabling a system Initialization-and-shutdown script:
Update-rc.d-f Foobar Remove
UPDATE-RC.D foobar Stop S.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.