Home >> Virtualization >> How to create Virtual Machine in VIRTUALBOX

How to create Virtual Machine in VIRTUALBOX

virtualbox logoVM Creation and Configuration
The most difficult part of using the command line is knowing where to start. The GUI makes this easy by having a New button available for you to use. The command line is a bit more reluctant to give up its secrets. To create and setup your new VM, open a terminal window or ssh to the Linux host where you installed VirtualBox and enter the following commands.

$ /usr/bin/VBoxManage createvm –name websrv1 -register
This creates the new VM named, websrv1 and registers it with VirtualBox. The VM created is an XML file located in your home directory: ~/.VirtualBox/Machines/websrv1/websrv1.xml.

Create a virtual disk for your VM:
$ /usr/bin/VBoxManage createhd –filename websrv1.vdi –size 4000 –variant Fixed
You created a virtual disk named Debian5.vdi, 4GB (4,000MB) in size and with fixed size (non-expanding).
The virtual disk is created under ~/.VirtualBox/HardDisks/websrv1.vdi

Create a Storage Controller to which you’ll attach the virtual disk and a virtual CD/DVD drive.
$ /usr/bin/VBoxManage storagectl websrv1 –name “IDE Controller” –add ide –controller PIIX4
This command created an IDE controller named “IDE Controller” and controller type PIIX4.

Now, attach your virtual disk to your VM:
$ /usr/bin/VBoxManage storageattach websrv1 –storagectl “IDE Controller” –port 0 –device 0 –type hdd –medium websrv1.vdi

Attach an ISO image for the operating system you want to install:
$ /usr/bin/VBoxManage storageattach websrv1 –storagectl “IDE Controller” –port 0 –device 1 –type dvddrive –medium /ISO/centos.iso

Setup Networking:
$ /usr/bin/VBoxManage modifyvm websrv1 –nic1 bridged –cableconnected1 on –bridgeadapter1 eth0
This creates a bridged NIC with cable connected on startup and the Linux system sees the adapter as eth0.

Start the VM:
$ /usr/bin/VBoxManage startvm websrv1
If all goes as planned, you’ll see the following messages and then your VM window ready for installation.
Waiting for the remote session to open…

Remote session has been successfully opened.
As you can see, creating and setting up a VM at the command line frees you from your mouse click madness and opens up a whole new world of possibilities for VM automation. And, we’ve only scratched the surface here but hopefully this brief introduction will pique your curiosity and set you on a new quest to learn the command line’s awesome power.

For more Infotmation Click here World Of Information.

Leave a Reply

Your email address will not be published. Required fields are marked *