centos

CentOS下VirtualBox如何使用命令行管理虚拟机

小樊
54
2025-08-12 12:30:58
栏目: 云计算

在CentOS下使用VirtualBox命令行管理虚拟机,主要使用VBoxManage命令,以下是一些常见操作:

  1. 创建虚拟机VBoxManage createvm --name "虚拟机名称" --ostype RedHat_64 --register
  2. 删除虚拟机VBoxManage unregistervm "虚拟机名称" --delete
  3. 启动虚拟机VBoxManage startvm "虚拟机名称" --type headlessheadless表示后台运行)。
  4. 关闭虚拟机VBoxManage controlvm "虚拟机名称" poweroff(强制关闭);VBoxManage controlvm "虚拟机名称" acpipowerbutton(发送ACPI关机信号,正常关机)。
  5. 查看虚拟机信息VBoxManage showvminfo "虚拟机名称"
  6. 配置虚拟机内存和CPUVBoxManage modifyvm "虚拟机名称" --memory 内存大小(MB) --cpus CPU数量
  7. 添加虚拟硬盘:先创建硬盘VBoxManage createhd --filename "硬盘路径/硬盘名.vdi" --size 硬盘大小(MB),再挂载到虚拟机VBoxManage storageattach "虚拟机名称" --storagectl "控制器名称" --port 端口号 --device 设备号 --type hdd --medium "硬盘路径/硬盘名.vdi"

0
看了该问题的人还看了