VirtualBox
Revision as of 17:43, 4 November 2018 by Baylyj (talk | contribs) (Protected "VirtualBox" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Contents
Creating a Headless VM
As taken from Create VirtualBox VM from the command line.
export VM="Ubuntu Server 18.04"
cd /vms
mkdir "${VM}"
cd "${VM}"
# Create 32GB dynamic disk
VBoxManage createhd --filename "${VM}.vdi" --size 32768
# Can get supported OS types using
VBoxManage list ostypes
VBoxManage createvm --name "${VM}" --ostype "Ubuntu_64" --register
# Create the SATA controller and attach the VDI
VBoxManage storagectl "${VM}" --name "SATA Controller" --add sata --controller IntelAHCI
VBoxManage storageattach "${VM}" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "${VM}.vdi"
# Create the IDE controller and attach an ISO as the dvd drive
VBoxManage storagectl "${VM}" --name "IDE Controller" --add ide
VBoxManage storageattach "${VM}" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium <path_to_iso>
VBoxManage modifyvm "${VM}" --ioapic on
VBoxManage modifyvm "${VM}" --boot1 dvd --boot2 disk --boot3 none --boot4 none
VBoxManage modifyvm "${VM}" --memory 1024 --vram 128
VBoxManage modifyvm "${VM}" --nic1 bridged --bridgeadapter1 <adapter_name>
# Optionally configure VRDP, and the desired port, ie 5000
VBoxManage modifyvm "${VM}" --vrde on
VBoxManage modifyvm "${VM}" --vrdeport 5000
# Run headless
VBoxHeadless -s "${VM}"