找回密码
 立即注册
CeraNetworksBGVM服务器主机交流会员请立即修改密码Sharktech防护
查看: 146|回复: 1

Centos 配置 VirtualBox

[复制链接]

12

主题

61

回帖

176

积分

注册会员

积分
176
发表于 2009-7-3 22:47:13 | 显示全部楼层 |阅读模式
VirtualBox概况 对于 VMWare、Virtual PC 这些虚拟机软件,可能大家都比较熟悉。VirtualBox也是一款虚拟机软件。VirtualBox 是一款功能强大的 x86 虚拟机软件,它不仅具有丰富的特色,而且性能也很优异。更可喜的是,VirtualBox 于数日前走向开源,成为了一个发布在 GPL 许可之下的自由软件。VirtualBox 可以在 Linux 和 Windows 主机中运行,并支持在其中安装 Windows (NT 4.0、2000、XP、Server 2003、Vista)、DOS/Windows 3.x、Linux (2.4 和 2.6)、OpenBSD 等系列的客户操作系统。
官方地址:
http://www.virtualbox.org/

安装VitualBox 下载相应的rpm包,官方有提供地址:
http://www.virtualbox.org/wiki/Downloads
Centos请访问
http://www.virtualbox.org/wiki/Linux_Downloads
此地址提供各linux版本的二进制安装包,下载centos5对应的rpm安装包
[root@xingke disk1]# wget http://download.virtualbox.org/v ... 88_rhel5-1.i386.rpm
查看kernel-devel包是否安装,安装VirtualBox需要此包编译模块

[root@xingke disk1]# rpm -q kernel-develkernel-devel-2.6.18-92.el5

如未安装,请使用如下命令先安装

[root@xingke disk1]# yum -y install kernel-develkernel-devel-2.6.18-92.el5

安装VirtualBox

[root@xingke disk1]# rpm -Uvh VirtualBox-2.0.2_36488_rhel5-1.i386.rpm
Preparing...                ########################################### [100%]
   1:VirtualBox             ########################################### [100%]
chcon: can't apply partial context to unlabeled file /usr/lib/virtualbox/VirtualBox
chcon: can't apply partial context to unlabeled file /usr/lib/virtualbox/VBoxSDL
chcon: can't apply partial context to unlabeled file /usr/lib/virtualbox/VBoxHeadless
chcon: can't apply partial context to unlabeled file /usr/lib/virtualbox/vboxwebsrv

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Success!

把打算使用的用户添加安装vboxusers用户组里

[root@xingke disk1]#sudo usermod -a -G vboxusers username

经过上述几个步骤,VirtualBox在centos5上以成功安装

添加网卡桥接功能 先安装桥接使用工具
[root@xingke ~]# yum -y install bridge-utils
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: 192.168.3.13
* updates: 192.168.3.13
* addons: 192.168.3.13
* extras: 192.168.3.13
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package bridge-utils.i386 0:1.1-2 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
bridge-utils            i386       1.1-2            base               27 k

Transaction Summary
=============================================================================
Install      1 Package(s)         
Update       0 Package(s)         
Remove       0 Package(s)         

Total download size: 27 k
Downloading Packages:
(1/1): bridge-utils-1.1-2 100% |=========================|  27 kB    00:00     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: bridge-utils                 ######################### [1/1]

Installed: bridge-utils.i386 0:1.1-2
Complete!
[root@xingke ~]#

新建一个br0桥接网卡

vi /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes

在原来的eth0网卡配置文件/etc/sysconfig/network-scripts/ifcfg-eth0末尾添加BRIDGE=br0

vi /etc/sysconfig/network-scripts/ifcfg-eth0
.
//此处省略
.
BRIDGE=br0

然后重启网络

sudo /sbin/service network restart

增加桥接的主机网卡

[root@xingke ~]# VBoxAddIF vbox0 root br0  <--此处的root是网卡用户帐号,谁可以使用此网卡,这里我用了root
VirtualBox host networking interface creation utility, version 2.0.2
(C) 2005-2007 Sun Microsystems, Inc.
All rights reserved.

Creating the permanent host networking interface "vbox0" for user root.

Failed to add the interface "vbox0" to the bridge "br0".
Make sure that the bridge exists and that you currently have sufficient
permissions to do this.
[root@xingke ~]#

添加虚拟客户机
运行VirtualBox
[root@xingke ~]#VirtualBox




其他的按一般的虚拟主机设置,特别的地方是网卡,附上一截图




Attached to选择host interface
interface name填写上面新建的vbox0
才可以使用到桥接功能
安装鼠标增强组件 安装后需要安装格外的一个增强组件,可以在主机和客户机鼠标方便移动
lihaixin@lihaixin-desktop:~$ sudo /media/cdrom/VBoxLinuxAdditions-x86.run
[sudo] password for lihaixin:
Verifying archive integrity... All good.
Uncompressing VirtualBox 2.0.2 Guest Additions for Linux installation.........................................................................................................................................................................................
VirtualBox 2.0.2 Guest Additions installation
Building the VirtualBox Guest Additions kernel module...
Building the shared folder support kernel module...
Installing the VirtualBox Guest Additions...

Successfully installed the VirtualBox Guest Additions.
You must restart your guest system in order to complete the installation.
lihaixin@lihaixin-desktop:~$
回复

使用道具 举报

966

主题

5383

回帖

2万

积分

论坛元老

积分
21401
发表于 2009-7-4 00:28:53 | 显示全部楼层
SUN开发的软件把,听说很不错。谢谢分享,我把图片本地化下,以防失效。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|HS2V主机综合交流论坛

GMT+8, 2024-11-19 13:26 , Processed in 0.051342 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表