在CentOS下使用VirtualBox命令行管理虚拟机,主要使用VBoxManage命令,以下是一些常见操作:
VBoxManage createvm --name "虚拟机名称" --ostype RedHat_64 --register。VBoxManage unregistervm "虚拟机名称" --delete。VBoxManage startvm "虚拟机名称" --type headless(headless表示后台运行)。VBoxManage controlvm "虚拟机名称" poweroff(强制关闭);VBoxManage controlvm "虚拟机名称" acpipowerbutton(发送ACPI关机信号,正常关机)。VBoxManage showvminfo "虚拟机名称"。VBoxManage modifyvm "虚拟机名称" --memory 内存大小(MB) --cpus CPU数量。VBoxManage createhd --filename "硬盘路径/硬盘名.vdi" --size 硬盘大小(MB),再挂载到虚拟机VBoxManage storageattach "虚拟机名称" --storagectl "控制器名称" --port 端口号 --device 设备号 --type hdd --medium "硬盘路径/硬盘名.vdi"。