centos

CentOS VirtualBox虚拟机如何使用VBoxManage命令

小樊
38
2025-09-13 15:50:04
栏目: 云计算

在CentOS中使用VBoxManage命令管理VirtualBox虚拟机,首先要确保已安装VirtualBox。以下是一些常用操作:

  1. 列出虚拟机VBoxManage list vms,可查看所有已注册虚拟机的名称和UUID。
  2. 创建虚拟机VBoxManage createvm --name "虚拟机名称" --ostype "操作系统类型" --register,如VBoxManage createvm --name "CentOSVM" --ostype "CentOS_64" --register
  3. 配置虚拟机:使用VBoxManage modifyvm "虚拟机名称" --参数,例如VBoxManage modifyvm "CentOSVM" --memory 2048 --cpus 2,可设置内存为2048MB、CPU核数为2。
  4. 添加虚拟硬盘:先创建硬盘VBoxManage createhd --filename "硬盘文件路径" --size 硬盘大小,再添加到虚拟机VBoxManage storagectl "虚拟机名称" --name "控制器名称" --add sata --controller IntelAhci,然后VBoxManage storageattach "虚拟机名称" --storagectl "控制器名称" --port 0 --device 0 --type hdd --medium "硬盘文件路径"
  5. 启动虚拟机VBoxManage startvm "虚拟机名称" --type headless,以无头模式启动,也可不加--type参数以默认方式启动。
  6. 关闭虚拟机VBoxManage controlvm "虚拟机名称" poweroff,强制关闭虚拟机。

0
看了该问题的人还看了