Virtual Box: VBoxManage Create & Modify VM
- Chris Speed
- Dec 13, 2022
- 1 min read
Updated: May 29
# switch into default VirtualBox directory
cd VirtualBox\ VMs/
# create new VirtualBox VM
VBoxManage createvm --name "centos_x64" --ostype RedHat_64 --register
# configure system settings of VM
VBoxManage modifyvm "centos_x64" --memory 8192 --cpus 2 --acpi on --pae on --hwvirtex on --nestedpaging on
# configure boot settings of VM
VBoxManage modifyvm "centos_x64" --boot1 dvd --boot2 disk --boot3 none --boot4 none
# configure video settings
VBoxManage modifyvm "centos_x64" --vram 128 --accelerate3d on
# configure audio settings
VBoxManage modifyvm "centos_x64" --audio coreaudio --audiocontroller hda
# configure network settings
VBoxManage modifyvm "centos_x64" --nic1 bridged
# configure network settings wireless/LAN adapter
VBoxManage modifyvm "centos_x64" --bridgeadapter1 enp60s0
VBoxManage modifyvm "centos_x64" --bridgeadapter1 wlo1
# configure usb settings
VBoxManage modifyvm "centos_x64" --usb on
# create storage medium for VM
VBoxManage createhd --filename centos_x64.vdi --size 30000
# modify a storage controller
VBoxManage storagectl "centos_x64" --name "SATA" --add sata
# attach storage medium to VM
VBoxManage storageattach "centos_x64" --storagectl "SATA" --port 0 --device 0 --type hdd --medium centos_x64.vdi
VBoxManage storageattach "CentOS VM" --storagectl "SATA" --port 0 --device 0 --type hdd --medium "centos_vm_disk.vdi"
# remove storage medium to VM
VBoxManage storageattach "centos_x64" --storagectl "SATA" --port 0 --device 0 --type hdd --medium none
# add windows iso
VBoxManage storageattach "centos_x64" --storagectl "SATA" --port 1 --device 0 --type dvddrive --medium /path/to/windows.iso
# add guest addition iso
VBoxManage storageattach "centos_x64" --storagectl "SATA" --port 2 --device 0 --type dvddrive --medium /path/to/VBoxGuestAdditions.iso
# start VM
VBoxManage startvm centos_x64 --type headless
# stop VM
VBoxManage controlvm centos_x64 acpipowerbutton
VBoxManage controlvm win2k12_server poweroff
#Unregister
VBoxManage unregistervm centos_x64 --delete
#list VM configurations
VBoxManage guestproperty enumerate "centos_x64"
VBoxManage showvminfo "centos_x64"
#list VM Ip Address
VBoxManage guestproperty get "win2k12_server" "/VirtualBox/GuestInfo/Net/0/V4/IP"
References:
Comments