ºìÁªLinuxÃÅ»§
Linux°ïÖú
µ±Ç°Î»ÖÃ: ºìÁªLinuxÃÅ»§ > Ubuntu

Ubuntu 7.04 ÏÂvirtualbox°²×°¼°ÇŽÓÍøÂçÅäÖÃ

·¢²¼Ê±¼ä:2007-10-04 00:11:40À´Ô´:ºìÁª×÷Õß:yfengsde
Ò»¡¢°²×°
1. ÏÂÔØ°²×°°ü¡£½¨ÒéÏÂÔØ Deb °ü¡£

2. ×¼±¸ÒÀÀµ¡£VirtualBox µÄÕý³£Ê¹ÓÃÐèÒª libxalan110 ºÍ libxerces27 ÕâÁ½¸ö°ü¡£ËùÒÔ£¬ÄãÒªÏÈÐа²×°ËüÃÇ£¬¿ÉÒÔʹÓÃÏÂÃæµÄÖ¸Á
sudo apt-get install libxalan110 libxerces27

3. °²×°±àÒ빤¾ß¼°Ïà¹Ø°ü¡£ÔÚ°²×°¹ý³ÌÖУ¬Òª±àÒë VirtualBox ËùÓõÄÄÚºËÄ£¿é¡£Îª´Ë£¬ÄãÐèҪ׼±¸»ù±¾µÄ±àÒ빤¾ß¼°°ü£¬Äã¿ÉÒÔʹÓÃÏÂÁÐÖ¸ÁîÀ´°²×°ËüÃÇ£º
sudo apt-get install build-essential linux-headers-`uname -r`

4. ÏÖÔÚ£¬×ªµ½Ëù±£´æ VirtualBox °²×°°üµÄĿ¼£¬Í¨¹ýÏÂÃæµÄÖ¸ÁîÀ´°²×°Ëü£º
sudo dpkg -i VirtualBox_1.x.x_Ubuntu_feisty_i386.deb
ÔÚ°²×°µÄ¹ý³ÌÖУ¬VirtualBox »áÒªÇóÄã½ÓÊÜÐí¿ÉЭÒé¡£ÁíÍ⣬°²×°³ÌÐòÒ²»á´´½¨ vboxusers Óû§×飬²¢±àÒëËùÐèµÄÄÚºËÄ£¿é¡£
5. ÏÖÔÚ£¬Ä㻹²»ÄÜÆô¶¯ VirtualBox£¬ÒòΪÄãµÄµ±Ç°Óû§»¹²»ÊôÓÚ vboxusers Óû§×é¡£Äã¿ÉÒÔʹÓÃÏÂÃæµÄÖ¸ÁîÀ´½«µ±Ç°µÄÓû§£¨ÇëʹÓÃÄãµÄÓû§Ãû´úÌæÖ¸ÁîÖеġ°youruser¡±£©Ìí¼Óµ½ vboxusers Óû§×éÖУº
sudo adduser youruser vboxusers

virtualbox ÆÁÄ»ÏÂÒÆÎÊÌ⣺
Èç¹ûÐéÄâ»úµÄ·Ö±æÂʽӽüxµÄ·Ö±æÂʶøµ¼Ö²¿·Ö½çÃæÔÚx±ßÑØʱ,È«ÆÁºóÔ­À´´°¿Ú¹ÜÀíÆ÷ title µÄµØ·½±äΪºÚÉ«Ìõ×´ÇøÓò£¬ÆÁÄ»ÏÂÒÆ£¬windowsµÄ¿ªÊ¼²Ëµ¥ÏÔʾÔÚÏÂÒ»¸ö×ÀÃæ¡£
½â¾ö·½·¨£ºÈ«ÆÁÇ°°Ñ·Ö±æÂʵ÷С£¬È«ÆÁºóÓÒ¼ü°ÑÏÔʾÆ÷·Ö±æÂʵ÷µ½Í¬xÒ»Ö£¬ÕâÑù¾Í²»»áÓÐÆÁĻƫÒÆ¡£

¶þ¡¢ÇŽÓÍøÂçÅäÖÃ

Ò»°ã¶øÑÔ£¬°²×°ÍêVirtualBoxÉ趨Íø·ʱѡÔñĬÈϵÄNATģʽ£¬Guest¾Í¿É˳ÀûÁªÍøÁË£¬µ«ÊÇÕâÖÖ·½Ê½±È½ÏËÀ°å£¬Òª×÷¸üÓе¯ÐԵı仯£¬Ó¦ ¸Ã²ÉÓÃÇŽÓģʽ(Bridged)£¬ÕâÀïµÄÇŽÓģʽ¾ÍÈçͬVMwareÖеÄBridgedģʽ£¬HostÓëGuestÔÚ¾ÖÓòÍø(LAN)ÖеĵØλÊÇÏàµÈ µÄ¡£

²Î¿¼ virtualbox °²×°ºó·ÅÔÚ VirtualBox Ŀ¼ÖеÄÓû§ÊÖ²áÎļþ UserManual.pdf ÅäÖÃÈçÏ£º

1. ÔÚ»ùÓÚ Debian ºÍ Ubuntu µÄϵͳÉÏ£¬Ê×ÏÈÒª°²×°º¬Óн¨Á¢ÐéÄâÍøÂçÉ豸 ( TAP interfaces ) µÄ¹¤¾ß uml-utilities ºÍÇŽӹ¤¾ß bridge-utils£º
sudo apt-get install uml-utilities
sudo apt-get install bridge-utils
ΪÁËʹÄãµÄÐéÄâ»úÄܹ»·ÃÎÊÍøÂç½Ó¿Ú£¬Äã±ØÐ뽫ÔËÐÐÐéÄâÖ÷»úµÄÓû§µÄÓû§Ãû£¨Í¨³£ÊÇÄãµÄubuntuµÇ¼Óû§Ãû£©Ìí¼Óµ½uml-netÓû§×飨ÇëÓÃÄãµÄÓû§ÃûÌæ»»ÆäÖеġ°vboxuser¡±£©£º
sudo gpasswd -a vboxuser uml-net
×¢Ò⣺ΪÁËʹ¸Ä¶¯ÉúЧ£¬ÇëÖØÐÂÆô¶¯ÄãµÄµçÄÔ¡£

2. ÏòÄãµÄ Debian »òÕß ubuntu ²Ù×÷ϵͳÃèÊöÄãÒªÌí¼ÓµÄÐéÄâÍøÂçÉ豸£¬±à¼­ /etc/network/interfaces£º
sudo vim /etc/network/interfaces
ÔÚ´ò¿ªµÄÎļþºóÃæÌí¼ÓÏÂÃæµÄÄÚÈÝ£¬½«ÐéÄâÍøÂç½Ó¿ÚÃüÃûΪ "tap0"£¬Ö¸¶¨¸Ã½Ó¿ÚIPÅäÖ÷½·¨ÎªÊÖ¶¯£¬²¢Ö¸¶¨Ê¹ÓøýӿڵÄÓû§£¨ÇëÓÃÄãµÄÓû§ÃûÌæ»»ÆäÖÐµÄ "vboxuser"£©£º
auto tap0
iface tap0 inet manual
up ifconfig $IFACE 0.0.0.0 up
down ifconfig $IFACE down
tunctl_user vboxuser

3. Ê×´ÎʹÓÃÐèÒª¼¤»î¸Õ²Å½¨Á¢µÄÐéÄâÍøÂç½Ó¿ÚºÍÍøÂçÇÅ£º
sudo /sbin/ifup tap0
sudo /sbin/ifup br0
Õâ¸ö²½ÖèÖ»ÐèÒª×öÒ»´Î£¬Ï´ÎÖ÷»úÖØÐÂÆô¶¯Ê±£¬Õâ¸ö½Ó¿ÚºÍÇŽ«×Ô¶¯¼¤»î¡£

4. ÁíÍ⻹ÐèÒªÔÚ /etc/network/interfaces ÖмÓÈëÈçÏÂÄÚÈÝ£¬½¨Á¢Ò»¸öÃû½Ð "br0" µÄÇÅ£¬¸ÃÇŵÄIPÅäÖ÷½·¨ÎªÍ¨¹ýDHCPÅäÖã¬Ö÷»úÖеÄËùÓÐÍøÂç½Ó¿Ú£¬Ò²°üÀ¨tap0Õâ¸öÐéÄâÍøÂç½Ó¿Ú£¬¶¼½«½¨Á¢ÔÚÕâ¸öÇÅÖ®ÉÏ£º
auto br0
iface br0 inet dhcp
bridge_ports all tap0
ÔÚÕâÀïÄã¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄÍøÂç×´¿ö×öÏàÓ¦µÄ¸ü¸Ä£¬Äã¿ÉÒÔʹÍøÂçÇÅʹÓþ²Ì¬ IP£º
iface br0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

5. Èà virtualbox ʹÓÃÕâ¸öÐéÄâÍøÂç½Ó¿Ú£¬Æô¶¯ virtualbox£¬ÔÚÖ÷½çÃæÉÏÑ¡ÖÐҪʹÓøղŽ¨Á¢µÄÐéÄâÍøÂç½Ó¿Útap0µÄÐéÄâ»ú£¬µã¡°ÉèÖá±£¬ÔÚµ¯³öµÄ´°¿ÚÖÐÑ¡¡°ÍøÂ硱£¬Ñ¡ÖÐÆäÖÐÒ»¿éÍø¿¨£¨Í¨³£Îª ¡°ÍøÂçÊÊÅäÆ÷ 0¡±£©£¬Ñ¡ÖС°ÆôÓÃÍøÂçÊÊÅäÆ÷¡±£¬¡°Á¬½Óµ½¡±ºóÃæÑ¡ "Host Interface"£¬Ñ¡ÖС°½ÓÈëÍøÏß¡±£¬È»ºóÔÚ¡°Ö÷»úÍøÂç½çÃæÃû³Æ¡±ÖÐÌîÈë¸Õ²Å½¨Á¢µÄÐéÄâÍøÂç½Ó¿ÚµÄÃû×Ö "tap0"£¬È·¶¨¡£Í¬ÑùµÄÄãÒ²¿ÉÒÔʹÓà VBoxManage µÄÃüÁîÐй¤¾ß£¨½« "My VM" »»³ÉÄãµÄÐéÄâ»úÃû×Ö £©£º
VBoxManage modifyvm "My VM" -hostifdev1 tap0\

×îºó£¬ÅäÖÃÖ÷»úºÍÐéÄâ»úµÄÍøÂ磬ʹÖ÷»úºÍÐéÄâ»úÔÚͬһ¸öÍø¶Î£¬ÕâÑùÖ÷»úºÍÐéÄâ»ú¾Í³ÉÁ˾ÖÓòÍøÖеØλÏàͬµÄÁ½Ì¨»úÆ÷ÁË£¬¿ÉÒÔ»¥Ïà·ÃÎÊÁË¡£

Èý¡¢³·ÏúÍøÂçÇÅ
1. ½ûÓÃÍøÇźÍÐéÄâÍø¿¨£º
sudo /sbin/ifdown br0
sudo /sbin/ifdown tap0
2. ½«Ç°ÃæÐÞ¸ÄµÄ /etc/network/interfaces Îļþ»¹Ô­¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ