Oracle vm
virtualbox,安装在oracle linux 6.4上,为了实现开机自动启动虚拟机,并能通过桥接模式网络访问虚拟机操作系统;
通过命令行启动VirtualBox,可以省去直接启动虚拟机显示图形界面的那部分资源。这种形式非常适用于在服务器上虚拟n台机器同时提供服务。使用Host Interface网络连接方式,可以让虚拟机的虚拟网卡获取和主机一样的网络地址等信息,从而可以直接对外提供服务。
1.查看主机上的可用虚拟机:
$VBoxManage
list vms
"Ubuntu10.10"
{36ea7e92-35ec-432e-9d91-15941cc3aae5}
"meego-tablet-ia32"
{dfef3c26-de81-4ae1-b98c-536394cbff61}
"Win2008_VS2008AndVC6"
{6f3f0f1a-dfa8-4acf-8fdb-4d236f44d4e3}
"RedHat9"
{937d825f-4a3f-46c3-a22b-9e20d15964ec}
注:VBoxManage list vms -l显示详细信息。
2.启动指定的可用虚拟机:
VBoxManage
startvm | [--type gui|sdl|headless]
2.1.打开默认窗口的虚拟机:
$VBoxManage
startvm RedHat9 --type gui
Waiting
for the VM to power on...
VM has
been successfully started.
2.2.打开简单窗口的虚拟机:
$VBoxManage
startvm RedHat9 --type sdl
Waiting
for the VM to power on...
VM has
been successfully started.
2.3.打开无窗口的虚拟机(无外设):
$VBoxManage
startvm RedHat9 --type headless
Waiting
for the VM to power on...
VM has
been successfully started.
注:这种方式打开的虚拟机可以通过,如:远程桌面或ssh来登陆操作。
3.查看已经运行的虚拟机:
$VBoxManage
list runningvms
"RedHat9"
{937d825f-4a3f-46c3-a22b-9e20d15964ec}
4.控制已经运行的虚拟机:(暂停|恢复|重启|关机|休眠)
VBoxManage
controlvm | pause|resume|reset|poweroff|savestate
注:更多参数详见VBoxManage --help输出的帮助。
5.修改虚拟机配置:(--memory取值单位MB)
$VBoxManage
modifyvm RedHat9 --memory 256 --acpi on --boot1 disk -nic1 bridged
$vboxmanage
modifyvm RedHat9--nic2 bridged --bridgeadapter2 eth3 --nictype2 82540EM
该命令为设置宿主机上网卡4为虚拟机上的网卡2,采用桥接模式,网卡类型为82540EM
6.创建一个虚拟磁盘:(--size取值单位MB --sizebyte取值单位字节)
$VBoxManage
createhd --filename RedHat9.vdi --size 30000
转载自:http://blog.sina.com.cn/s/blog_4c451e0e0100smar.html