EDIT: fixed the port/device numbers for the dvd drive
Virtual box on the CLI
Here's my take on it. Most of it is self-explanatory. As with everything else Linux, names are case-sensitive.
VBoxManage createvm --name debi_dd --ostype Debian_64 --basefolder /home/me/tmp/virtual
Virtual machine 'debi_dd' is created.
UUID: 3cab43c4-d071-4d71-9e01-22a6f4e80645
Register the vm:
VBoxManage registervm `pwd`/debi_dd.vbox
or you will get
VBoxManage registervm `pwd`/debi_dd.vbox
or you will get
VBoxManage: error: Could not find a registered machine named 'debi_dd'
Create a harddrive:
VBoxManage createhd --filename debi_hd --size 5000 --format VDI --variant Standard
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%The size is given in mb, VDI is the standard virtualbox format, but you can use VMDK or VHD too. There are several variants -- Fixed, Standard, Split2G, Stream and ESX. Fixed is fixed size, standard expands as data is added, Split2G splits the HDD into 2GB chunks for filesystems which can't handle large files, Stream is 'optimized for streaming downloads and can be compressed' and I suspect that ESX is referring to VMWare's hypervisor product.
Disk image created. UUID: b11e6465-3ac6-441d-9e14-6417135b7cd1
Create a SATA controller (for a win xp guest , use IDE instead)
VBoxManage storagectl debi_dd --name "ATA controller" --add sata --controller IntelAhci
Attach your harddrive
VBoxManage storageattach debi_dd --storagectl "ATA controller" --port 0 --device 0 --type hdd --medium debi_hd.vdi
and a DVD player and point it towards your debian iso
VBoxManage storageattach debi_dd --storagectl "ATA controller" --port 1 --device 0 --type dvddrive --medium ~/jigdo/debian-testing-amd64-CD-1.iso
Configure your VM hardware
VBoxManage modifyvm debi_dd --memory 256 --acpi on --boot1 dvd --clipboard bidirectional --nic1 nat --cableconnected1 on --bridgeadapter1 eth0 --usb on --usbehci on
You will need to have an X server running, either on the computer hosting the virtualbox, or you need to ssh in using ssh -X -C user@server. But it works. Once you have a working linux installation you can run headless.
You can also use remmina to connect via rdp at localhost:3389.
VBoxManage startvm debi_dd
Waiting for VM "debi_dd" to power on...You'll now be doing the usual graphical installation...
VM "debi_dd" has been successfully started.
Make sure to install ssh server so you can easily connect to your running VM.
So you're done installing...
Eject the DVD
VBoxManage storageattach debi_dd --storagectl "ATA controller" --port 1 --device 0 --type dvddrive --medium emptydrive
Associate e.g. localhost:2222 with virtualbox:22
VBoxManage modifyvm "debi_dd" --natpf1 "guestssh,tcp,,2222,,22"
Time to go headless:
VBoxHeadless -s debi_dd
Oracle VM VirtualBox Headless Interface 4.1.8
(C) 2008-2011 Oracle Corporation
All rights reserved.
VRDE server is listening on port 3389.
and
ssh verahill@localhost -p 2222
to log in
Use
VBoxManage controlvm debi_dd poweroff
to power off
There's a bit of housekeeping to do with any freshly installed linux machine:
sudo apt-get install bzip2 vim
sudo updatedb
and edit /etc/apt/sources.list to remove the cd.
You may want to edit /etc/default/grub too and set
GRUB_TIMEOUT=1
GRUB_CMDLINE_LINUX_DEFAULT="text"
Don't forget to sudo update-grub
If you don't want headless mode, just
VBoxManage startvm debi_dd
Removal
VBoxManage storageattach debi_dd --storagectl "ATA controller" --port 1 --device 0 --type dvddrive --medium none
VBoxManage storageattach debi_dd --storagectl "ATA controller" --port 0 --device 0 --type dvddrive --medium none
VBoxManage unregistervm debi_dd --delete
VBoxManage closemedium disk debi_hd.vdi --delete
rm debi_dd/ -rf