Today i was told to study the virtual box command line functions. I studied a little bit.
And i thought its time to try and start a VM( Virtual Machine ) through command line.
I hope you already installed Virtual box in your system.
This is just a basic setup for a os. so there is only 7 commands to start a VM.
So lets get started,.....
open terminal...
First command : To create a VM.
$VBoxManage createvm --name "slax try" --ostype Linux --register
This first command tells the virtual box to create a VM named "slax try", then ostype. slax is a linux based os so "Linux"( make sure L is caps otherwise Vbox will bang you with error). register helps to register the created VM with Vbox.
Second command : To add memory and other essential things to VM.
$VBoxManage modifyvm "slax try" --memory 512 --acpi on --nic1 nat
--audio pulse --audiocontroller ac97
This command modifies the "slax try" VM with 512 MB RAM, enabling ACPI, NAT ,pulse audio and its controller.
Third command : creating hard disk for VM.
$VBoxManage createhd --filename "slaxhd.vdi" --size 3072
The third command used to create a file which will act as a hard disk for created "slax try" VM. You have to give a name for the hard disk file with .vdi extension. then specify how much space you wanna allocate for the had disk( in MB).
Fourth command : creating storage controller.
$VBoxManage storagectl "slax try" --name "IDE Controller" --add ide
--controller PIIX4
This command helps to name the controller and add ide and its controller to VM.
Fifth command : attaching Hard Disk storage to storage controller.
$VBoxManage storageattach "slax try" --storagectl "IDE Controller"
--port 0 --device 0 --type hdd --medium "slaxhd.vdi"
This command attaches the storage controller to the VM hard disk.
Sixth command : attaching dvddrive to storage controller.
$VBoxManage storageattach "slax try" --storagectl "IDE Controller"
--port 0 --device 1 --type dvddrive --medium
/media/7AD4E860D4E8205D/zen/slax-6.1.2.iso
$VBoxManage startvm "slax try" --type gui
Have fun :)