This post describes steps one can take to install or create a headless VirtualBox guest machine in Ubuntu Linux.
Headless installation is when you install and run VirtualBox on a server without a direct monitor or desktop environment via a remote terminal. The GUI-less installation of VirtualBox is typical in server environments.
This brief tutorial will show you how to install and guest operating systems on the headless installation of VirtualBox. This should be quick and easy. New students should love it.
How to install a headless VirtualBox guest machine in Ubuntu Linux
As described above, one can install a headless VirtualBox guest machine in Ubuntu Linux.
Before installing a guest OS on VirtualBox software, the host server must be installed. Click the link below to learn how to install VirtualBox on Ubuntu Linux.
How to install VirtualBox on Ubuntu Linux
Once VirtualBox is installed, you can begin installing a headless guest OS.
To create a VirtualBox guest machine called Ubuntu_2204, follow the guide below.
First, create a location to store all the guest machines and configuration files. Then, run the commands below to create a folder in the /var directory called vbox.
sudo mkdir -p /var/vbox
Then run the commands below to create your first guest machine named Ubuntu_2204 and store the configurations in /var/vbox
sudo VBoxManage createvm --name Ubuntu_2204 --ostype Ubuntu_64 --register --basefolder /var/vbox
After running the commands above, run the commands below to view information about the guest OS you just created.
sudo VBoxManage showvminfo Ubuntu_2204
You should see something like the content below:
Name: Ubuntu_2204 Groups: / Guest OS: Ubuntu (64-bit) UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3 Config file: /var/vbox/Ubuntu_2204/Ubuntu_1710.vbox Snapshot folder: /var/vbox/Ubuntu_2204/Snapshots Log folder: /var/vbox/Ubuntu_1710/Logs Hardware UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3 Memory size: 128MB Page Fusion: off VRAM size: 8MB CPU exec cap: 100% ------------- -------------
Next, modify the guest OS to increase the system memory, include a virtual DVD drive, and enable VRDP (Virtual Remote Desktop Protocol) to access the guest machine remotely by running the commands below.
sudo VBoxManage modifyvm Ubuntu_2204 --memory 1024 --boot1 dvd --vrde on --vrdeport 5001
Add a network adapter and NAT it by running the commands below. If you want it to be bridged, change NAT to bridged.
sudo VBoxManage modifyvm Ubuntu_2204 --nic1 nat
Next, create a storage SATA controller named Ubuntu_2204_SATA
sudo VBoxManage storagectl Ubuntu_1710 --name "Ubuntu_2204_SATA" --add sata
Next, create a virtual HDD with a 10GB size and format it as VDI with the standard variant.
sudo VBoxManage createhd --filename /var/box/Ubuntu_2204.vdi --size 10280 --format VDI --variant Standard
Next, attach the virtual hard disk created above to the VM.
To do that, run the commands below:
sudo VBoxManage storageattach Ubuntu_2204 –-storagectl Ubuntu_1710_SATA –-port 1 –-type hdd –-medium /var/box/Ubuntu_1710.vdi
Next, attach the download operating system ISO file to the VM by running the commands below.
sudo VBoxManage storageattach Ubuntu_2204 --storagectl Ubuntu_2204_SATA --port 0 --type dvddrive --medium /tmp/Ubuntu_2204-server-amd64.iso
When you run the showvminfo commands, you should see the new guest machine config settings.
Name: Ubuntu_2204 Groups: / Guest OS: Ubuntu (64-bit) UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3 Config file: /var/vbox/Ubuntu_2204/Ubuntu_2204.vbox Snapshot folder: /var/vbox/Ubuntu_2204/Snapshots Log folder: /var/vbox/Ubuntu_2204/Logs Hardware UUID: 7ff8048e-b6d8-49ca-b21a-ad0fc04ba6d3 Memory size: 1024MB Page Fusion: off VRAM size: 8MB CPU exec cap: 100% HPET: off Chipset: piix3 Firmware: BIOS Number of CPUs: 1 PAE: on Long Mode: on Triple Fault Reset: off
Now that everything is ready run the commands below to start the guest machine.
sudo VBoxManage startvm Ubuntu_2204 --type headless
You should see the message that the machine has started
Waiting for VM "Ubuntu_2204" to power on. VM "Ubuntu_2204" has been successfully started.
Now open Remote Desktop Connection on your Windows machine and connect to the server IP followed by port 5001
You should be able to install the guest machine remotely via RDP.
I believe you forgot to add step
sudo VBoxManage storageattach Ubuntu16 –storagectl Ubuntu16_SATA –port 2 –type hdd –medium /var/box/Ubuntu16.vdi
Thanks… post upadted