Thursday, March 10, 2011

VirtualBox from the command line

VBoxManage createvm --name "oralinux" --ostype Oracle_64 --register

VBoxManage modifyvm "oralinux" --memory 1505 --floppy disabled --audio none --nic1 nat --vram 12 --accelerate3d off --boot1 disk --acpi on --cableconnected1 on --usb off --vrde on --vrdeport 3390

VBoxManage createhd --filename $VMS_STOR/oralinux.vdi --size 20000

VBoxManage createhd --filename $VMS_STOR/oralinux_db.vdi --size 10000

VBoxManage storagectl "oralinux" --name "IDE_Controller" --add ide

VBoxManage storageattach "oralinux" --storagectl "IDE_Controller" --port 0 --device 0 --type dvddrive --medium $_DISTRS/Enterprise-R5-U6-Server-x86_64-dvd.iso

VBoxManage storagectl "oralinux" --name "SATA_Controller" --add sata

VBoxManage storageattach "oralinux" --storagectl "SATA_Controller" --port 0 --device 0 --type hdd --medium $VMS_STOR/oralinux.vdi

VBoxManage storageattach "oralinux" --storagectl "SATA_Controller" --port 1 --device 0 --type hdd --medium $VMS_STOR/oralinux_db.vdi

VBoxManage modifyvm "oralinux" --boot1 dvd

VBoxManage modifyvm "oralinux" --natpf1 "guestssh,tcp,,2222,,22"
VBoxManage modifyvm "oralinux" --natpf1 "guestora,tcp,,1521,,1521"

VBoxManage startvm "oralinux" --type headless

Now you may install OS etc. And then export your appliance.

VBoxManage export "oralinux" -o $VMS_STOR/oralinux01.ova