This will be a walk-through of installing Ubuntu 22.04 on VirtualBox using the command line.
- List Available Guest OS
- Create VM
- Inspect VM
- Add CPU RAM and Video RAM
- Configuring Virtual Network Adapter
- Create Virtual Hard Disk
- Delete Virtual Hard Disk
- Add Storage Controller
- Attach Virtual Hard Disk
- Add IDE Controller
- Attach ISO
- VirtualBox-Remote-Display-Protocol
- Start Virtual Machine in Headless Mode
- Related
- Links
List Available Guest OS’
VBoxManage list ostypes | grep -i ubuntu
- ID: Ubuntu
Description: Ubuntu (32-bit) - ID: Ubuntu_64
Description: Ubuntu (64-bit)
Create VM Skeleton and Register VM
VBoxManage createvm --name Ubuntu-22-04-test --ostype Ubuntu_64 --register
Virtual machine 'Ubuntu-22-04-test' is created and registered. UUID: 99999999-9999-9999-9999-999999999999 Settings file: '/home/user/VirtualBox VMs/Ubuntu-22-04-test/Ubuntu-22-04-test.vbox'
Inspect VM
VBoxManage showvminfo Ubuntu-22-04-test
Add CPU, RAM, and Video RAM
VBoxManage modifyvm Ubuntu-22-04-test --cpus 4 --memory 4096 --vram 12
Configuring a Virtual Network Adapter
VBoxManage modifyvm Ubuntu-22-04-test --nic1 bridged --bridgeadapter1 eth0
Create Virtual Hard Disk
VBoxManage createhd --filename /path/to/hard_drive_image/Ubuntu-22-04-test.vdi --size 5120
--variant Standard
- –size = in Mega Bytes
- –variant Standard = Dynamically Allocated / Thin Provisioned
- –variant Fixed = Thick Provisioned / Pre Allocated
Delete Virtual Hard Disk
VBoxManage closemedium disk '/path/to/hard_drive_image/Ubuntu-22-04-test.vdi' --delete
Add Storage Controller to Virtual Machine
VBoxManage storagectl Ubuntu-22-04-test --name "SATA Controller" --add sata --bootable on
Attach Virtual Hard Disk to Virtual Storage Controller
VBoxManage storageattach Ubuntu-22-04-test --storagectl "SATA Controller"
--port 0 --device 0 --type hdd
--medium /path/to/hard_drive_image/Ubuntu-22-04-test.vdi
Add IDE Controller to Virtual Machine (To Later Connect ISO/CD/DVD)
VBoxManage storagectl Ubuntu-22-04-test --name "IDE Controller" --add ide
Attach ISO
VBoxManage storageattach Ubuntu-22-04-test --storagectl "IDE Controller"
--port 0 --device 0 --type dvddrive --medium /home/user/dvd.iso
VirtualBox Remote Display Protocol (VRDP)
VBoxManage modifyvm Ubuntu-22-04-test --vrde on
To Do: Start the Virtual Machine in Headless Mode
VBoxManage startvm Ubuntu-22-04-test --type headless
Waiting for VM "Ubuntu-22-04-test" to power on… VM "Ubuntu-22-04-test" has been successfully started.
Have not managed to connect to the headless Virtual Machine using VirualBox VRDE.
Have tried running as root. Had to sudo VBoxManage registervm /path/to/vm.vbox This did not help
Delete VM
VBoxManage unregistervm --delete Ubuntu-22-04-test