AllGoodBits.org

Getting Started with VirtualBox from the CLI

There's plenty of good basic tutorial information available to get started with VirtualBox using its fine graphical interface, but there are circumstances when such interfaces are not useful such as when the host machine is headless. Indeed, my world is usually remote and command line driven, so I'm going to document creating a new virtual machine only using the CLI.

Installing VirtualBox was a snap, follow their documentation. Be sure that the Personal and Evaluation Licence is sufficient for your purposes or use the Open Source Edition. The differences are clearly spelled out on the download page. Almost all of the configuration work uses the various subcommands of VBoxManage.

Make sure you leave enough memory for your host OS otherwise you'll end in a disaster of thrashing swap.

Decide which type of vm you want:

VBoxManage list ostypes

Make sure you pick a 64bit type if your VM should be 64bit, because VirtualBox will set some configuration items based upon this.

You might need to change "e1000" depending on which type of network adapter your VM is using, perhaps "pcnet". You might need to restart VirtualBox (or perhaps just the host's networking?) to get this to stick.

Then if a webserver in the VM is listening on the normal port 80, then, on the host, you can:

links http://localhost:3080

and you will be offered the webserver's index page.

FreeBSD guests

Network Adapter:
PCNet-PCI II

Storage:

Under Settings -> Storage, select the box for 'Enable Additional Controller' and choose 'SATA(AHCI)'. Then, in the 'Attachments' pane, choose 'SATA port 0' for the slot column. Otherwise, you end up with intermittent kernel panics with 'unrecoverable I/O error'.