Chinaunix首页 | 论坛 | 博客
  • 博客访问: 642767
  • 博文数量: 198
  • 博客积分: 4256
  • 博客等级: 上校
  • 技术积分: 1725
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-15 13:12
文章分类

全部博文(198)

文章存档

2012年(12)

2011年(39)

2010年(135)

2009年(12)

我的朋友

分类: LINUX

2011-07-24 19:21:38

在宿主机上面全新安装Guest系统:

1,Virtualbox 安装相对应版本的扩展包(4.1.0):
vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.0-73009.vbox-extpack

2,创建虚拟机
VBoxManage createvm --name "Ubuntu" --ostype Ubuntu --register
并生存配置文件 /home/jack/VirtualBox VMs/Ubuntu/Ubuntu.vbox  xml格式

3,设置内存大小,启动顺序,网络模式;
VBoxManage modifyvm "Ubuntu" --memory 512 --acpi on --boot1 dvd --nic1 bridged

4,创建一个磁盘镜像,指定大小(MB)
vboxmanage createhd --filename "vms/Ubuntu.vdi" --size 5000

5,创建一个IDE存储控制器
vboxmanage storagectl "Ubuntu" --name "IDE Controller" --add ide --controller PIIX4

6,将之前创建的镜像文件Ubuntu.vdi 添加到ide存储控制器中,并指定位置等。
VBoxManage storageattach "Ubuntu" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium vms/Ubuntu.vdi

7,添加光驱并添加系统盘ISO镜像文件。
vboxmanage storageattach "Ubuntu" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium ubuntu-10.04-server-i386.iso

8,启动
1,VBoxHeadless --startvm "Ubuntu"
2,VBoxManage startvm "Ubuntu"--type headless
即可启动guest系统安装,并在window机器上远程桌面(默认3389端口)可以操作系统安装;
VBoxHeadless --startvm "Ubuntu" --vrde off &
安装完成之后配置好网络安装sshd服务,既可以启动系统并停掉 vrde

9,停止系统:
VBoxManage controlvm poweroff/pause/resume/savestate

复制虚拟机:
在宿主机上安装好一个Ubuntu系统之后,可以使用这个系统复制出更多的Ubuntu系统;

方法一:vboxmanage clonevm 将现有的guest系统克隆(virutalbox4.0以上);
vboxmanage clonevm "Ubuntu" --name "TestServer" --basefolder vms/ --register
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Machine has been successfully cloned as "TestServer"
使用vboxmanage list vms查看到新的guest已经成功;
"Ubuntu" {e37d9a18-88c4-4093-9da4-3e71d1a8711c}
"TestServer" {db1607ae-a1e4-4827-af2f-00a9a3527129}
然后启动即可。

方法二:vboxmanage clonehd;
首先:
VBoxManage clonehd Ubuntu.vdi TestServer.vdi
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: 140753f4-a4dc-4852-a62c-b113b0e636fb
然后:
VBoxManage createvm --name "TestServer" --ostype Ubuntu --register
vboxmanage storagectl "TestServer" --name "IDE Controller" --add ide --controller PIIX4
vboxmanage storageattach "TestServer" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium vms/TestServer.vdi
VBoxManage modifyvm "TestServer" --memory 512 --acpi on --nic1 bridged
然后启动即可。

备注:
启动的时候报错:
Error: failed to start machine. Error message: Failed to open/create the internal network 'HostInterfaceNetworking-' (VERR_INVALID_PARAMETER).
Failed to attach the network LUN (VERR_INVALID_PARAMETER)
由于在笔记本上安装,一个网卡显示的是wlan0 ,手动修改为eht0,即可启动。。

阅读(5806) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~