How to Create a Headless VM on Ubuntu Using VirtualBox
A headless virtual machine on Ubuntu using VirtualBox runs in the background without opening a normal desktop window on your screen. This setup lets you run server software or test code without a graphical user interface taking up space on your desktop.
Oracle VM VirtualBox handles this by starting your Ubuntu 24.04 guest system directly in the background. You control the running virtual machine using a tool called VBoxManage, which runs right from your regular command prompt or terminal window.
You create a headless VM on Ubuntu using VirtualBox with the VBoxManage command-line tool. First, create the VM using `VBoxManage createvm`, then configure its properties with `VBoxManage modifyvm`, and finally create and attach storage using `VBoxManage storagectl` and `VBoxManage createhd`.
Install VirtualBox
VirtualBox installation forms the initial phase of provisioning a virtual machine. Systems lacking the application require the setup steps outlined previously.
Post-installation procedures allow immediate deployment of new virtual hardware configurations.
Create VM directory
Establishing a designated storage directory precedes provisioning any virtual hardware.
Executing the command below generates the required VirtualBox directory structure.
Laying the groundwork starts with provisioning the virtual hardware profile. A command will create a new Ubuntu 24.04 VM, giving it a name so you can configure it later.
sudo VBoxManage createvm --name Ubuntu2404 --ostype Ubuntu_64 --register --basefolder /var/vbox
Successful execution yields a confirmation message resembling the output below.
Virtual machine 'Ubuntu2404' is created and registered.
UUID: 613dde34-dfa1-4342-9a04-f54c19b44b19
Settings file: '/var/vbox/Ubuntu2404/Ubuntu2404.vbox'
Change VM properties
Hardware parameters like processor count, allocated RAM, and networking configuration undergo modification using the command displayed below.
sudo VBoxManage modifyvm Ubuntu2404 --cpus 4 --memory 8192 --nic1 nat --boot1 dvd --vrde on --vrdeport 5001
Create the VM storage
Configuring storage demands a storage controller alongside a virtual hard disk. This drive houses the operating system and user data as primary storage.
You create a virtual hard drive from the storage by running the `VBoxManage createmedium disk` command. This command takes the storage's path and the desired disk size, for example, `VBoxManage createmedium disk --format VDI "path/to/your/disk.vdi" --size 20480` to create a 20GB disk image.
sudo VBoxManage createhd --filename /var/vbox/Ubuntu2404/Ubuntu2404.vdi --size 20480 --format VDI --variant Standard
Successful completion returns terminal feedback matching the example below.
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Medium created. UUID: 703b125d-987c-41a1-a2c8-ba15baa2d7ec
Attaching the newly generated hard drive requires the subsequent instruction.
sudo VBoxManage storageattach Ubuntu2404 --storagectl Ubuntu2404_SATA --port 1 --type hdd --medium /var/vbox/Ubuntu2404/Ubuntu2404.vdi
Populated with storage controllers, the environment stands ready for an operating system. Inspection of system parameters occurs through the query below.
sudo VBoxManage showvminfo Ubuntu2404
The console prints configuration details similar to this block.
Name: Ubuntu2404
Encryption: disabled
Groups: /
Guest OS: Ubuntu (64-bit)
UUID: 613dde34-dfa1-4342-9a04-f54c19b44b19
Config file: /var/vbox/Ubuntu2404/Ubuntu2404.vbox
Snapshot folder: /var/vbox/Ubuntu2404/Snapshots
Log folder: /var/vbox/Ubuntu2404/Logs
Hardware UUID: 613dde34-dfa1-4342-9a04-f54c19b44b19
Memory size: 8192MB
Page Fusion: disabled
VRAM size: 8MB
CPU exec cap: 100%
HPET: disabled
CPUProfile: host
Chipset: piix3
Firmware: BIOS
Number of CPUs: 4
PAE: enabled
Long Mode: enabled
Triple Fault Reset: disabled
APIC: enabled
X2APIC: enabled
Hardware provisioning reaches completion.
Attach Ubuntu installation ISO
Linking the Ubuntu installation ISO (an archive containing the operating system's setup files) connects a virtual disc to the VM. This step mounts the installer image so the virtual hardware boots into the setup utility.
Acquiring the installer image precedes binding it to the hardware profile via the terminal.
sudo VBoxManage storageattach Ubuntu2404 --storagectl Ubuntu2404_SATA --port 0 --type dvddrive --medium ~/Downloads/ubuntu-24.04.2-desktop-amd64.iso
Mounted installation media allows powering on the environment using the instruction below.
sudo VBoxManage startvm Ubuntu2404 --type headless
Proper execution triggers confirmation output comparable to the text below.
Waiting for VM "Ubuntu2404" to power on...
VM "Ubuntu2404" has been successfully started.
Establishing remote desktop connectivity requires pointing an RDP client toward the host alongside [vrdeport] port 5001 [VMHostIPaddress:vrdeport] to complete the operating system installation.
192.168.48.128:5001

Conclusion:
Running a virtual machine through the command line keeps resource overhead low.
- Preparation: Ensure VirtualBox is installed and a directory for VMs is created.
- VM Creation: This creates the virtual machine with the desired parameters.
- Configuration: Modify VM properties such as CPU and memory using
VBoxManage modifyvm. - Storage Setup: Create a storage controller and hard drive for the VM.
- ISO Attachment: Download the Ubuntu installation ISO and attach it to the VM.
- Launching: Start the VM in headless mode and connect using an RDP client for installation.
Following these procedures establishes efficient command-line virtualization management.
Can I run a VM headless?
Running virtual instances without a graphical interface remains fully supported. Headless execution depends on configuring display parameters and serial interfaces to bypass desktop rendering entirely.
What is the difference between normal start and headless start in VirtualBox?
Virtualbox provides normal mode with an interactive window, headless startup running entirely in the background while displaying screenshots in the user interface, and detachable execution permitting window closure without terminating the guest environment.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!