On the Virtual Box download page, you can get the latest version of the software extension package you need. The version of the extension package must be consistent with that of the VirtualBox version you have installed!
You can also use the following command to obtain the VBoxManage extension.
Run the following command to confirm that the VBoxManage has been successfully installed on your machine.
Use VBoxManage on Ubuntu 16.04Next we will use VBoxManage to show you how easy it is to use the command line terminal tool to create and manage virtual machines.
Run the following command to create a virtual machine that will be used to install the Ubuntu system.
# VBoxManage createvm --name Ubuntu16.04 --register
After running this command, VBoxMnage creates a virtual machine called Ubuntu16.vbox. The virtual machine is located in the VirtualBox VMs/Ubuntu16/Ubuntu16.04.vbox in the home directory ". In the preceding command, "createvm" is used to create a VM, "-- name" defines the name of the VM, and "registervm" is used to register the VM.
Now, use the following command to create a hard disk image for the VM.
$ VBoxManage createhd --filename Ubuntu16.04 --size 5124
Here, "createhd" is used to create a hard disk image, and "-- filename" is used to specify the name of the virtual machine, that is, the name of the created hard disk image. "-- Size" indicates the space capacity of the hard disk image. The unit of space capacity is always MB. We specify 5 Gb, that is, 5124 MB.
Next we need to set the operating system type. If you want to install a Linux system, use the following command to specify the system type as Linux, Ubuntu, or Fedora.
$ VBoxManage modifyvm Ubuntu16.04 --ostype Ubuntu
Use the following command to set the memory size of the virtual system, that is, the memory allocated to the Virtual Machine System from the host.
$ VBoxManage modifyvm Ubuntu10.10 --memory 512
Use the following command to create a storage controller for the VM.
$ VBoxManage storagectl Ubuntu16.04 --name IDE --add ide --controller PIIX4 --bootable on
Here, "storagect1" creates a storage controller for the Virtual Machine. "-- name" specifies the name of the storage controller to be created, changed, or removed from the virtual machine. The "-- add" option specifies the type of the system bus that the storage controller needs to connect to. Optional options include ide, sata, scsi, and floppy. "-- Controller": select the type of the Main Board. The main board needs to be selected based on the required storage controller. Optional options include LsiLogic/LSILogicSAS/BusLogic/intelohci/PIIX3/PIIX4/ICH6/I82078. The last "-- bootable" indicates whether the controller can guide the system.
The preceding command creates a storage controller called IDE. Then the virtual media can connect to the Controller through the "storageattach" command.
Run the following command to create a storage controller named SATA, which will be connected to the subsequent hard disk image.
$ VBoxManage storagectl Ubuntu16.04 --name SATA --add sata --controller IntelAhci --bootable on
Attach the previously created hard disk image and CD/DVD drive to the IDE controller. Insert the Ubuntu installation disc to the CD/DVD drive. Then, use the "storageattach" command to connect the storage controller and virtual machine.
$ VBoxManage storageattach Ubuntu16.04 --storagectl SATA --port 0 --device 0 --type hdd --medium "your_iso_filepath"
This will connect the SATA storage controller and media (such as the virtual disk image created earlier) to the Ubuntu16.04 virtual machine.
Run the following command to add functions such as network connection and audio.
$ VBoxManage modifyvm Ubuntu10.10 --nic1 nat --nictype1 82540EM --cableconnected1 on$ VBoxManage modifyvm Ubuntu10.10 --vram 128 --accelerate3d on --audio alsa --audiocontroller ac97
Run the following command to start the Virtual Machine by specifying the name of the virtual machine you want to start.
$ VBoxManage startvm Ubuntu16.04
A new window is opened, in which the VM directs through the associated file.
You can use the following command to turn off the virtual machine.
$ VBoxManage controlvm Ubuntu16.04 poweroff
The "controlvm" command is used to control the status of the Virtual Machine. Optional options include pause/resume/reset/poweroff/savestate/acpipowerbutton/acpisleepbutton. Controlvm has many options. Use the following command to view all options it supports.
$VBoxManage controlvm
EndFrom this article, we learned about VBoxManage, a very practical tool in Oracle Virtual Box. The article includes the installation of VBoxManage and its usage on Ubuntu 16.04, this includes using commands in VBoxManage to create and manage virtual machines. I hope this article will help you, and don't forget to share your comments or suggestions.
From: https://linux.cn/article-7582-1.html
Address: http://www.linuxprobe.com/virtualbox-cmd-manage.html