VirtualBox

Aus SchnallIchNet
(Weitergeleitet von Virtualbox)
Wechseln zu: Navigation, Suche

install virtualbox

download @http://www.virtualbox.org/wiki/Downloads


CLI based

How to control headless (non X) VirtualBox installation


Image info

vboxmanage showvdiinfo /path/to/image.vdi

produces an output of detailed information of the e.g. harddisk-image


List Virtual Machines

VBoxManage list vms

This should deliver an empty response on a clean installation,
or something like this if there is allready any configured guest:

"debian01" {c843817b-f008-4857-bb3e-0f08c6dc472d}

which is the VmName (debian01) and the UUID of the virtual machine.

a long listing (-l|--long) of the vms will show hardware-configuration.


Create Virtual Machine

VBoxManage createvm --name VmName --register


Configure Virtual Machine

configuration of the guest system


Minimum config

VBoxManage modifyvm debian01 --ostype Debian \
                             --clipboard bidirectional \
                             --memory 512 \
                             --nic1 bridged \
                             --bridgeadapter1 eth0 \
                             --macaddress1 "005056beef01"

set the guests minimum config:

Option effect legal values
--ostype Debian OS-Type is Debian Linux VBoxManage list ostypes
--memory 512 RAM should be 512 MB
--nic1 bridged set 1st NIC to be bridged null|nat|bridged|intnet|hostonly|vde
--bridgeadapter1 /dev/eth0 tell VBox which host interface to use
--macaddress "005056beef01" set unique MAC-address for the interface

do NOT use ':' (colons) to seperate MAC-address!!!


add an IDE-controler to the VM

1st add an ide-controler:

VBoxManage storagectl debian01 --name ide0 --add ide

or add a SATA controler

VBoxManage storagectl debian01 --name ide0 --add sata 


create a harddisk

VBoxManage createhd --filename /path/to/debian01.vdi --size 10240 --format VDI --variant Standard --register

--size in MB
--register --> registering the image at once for usage with virtualbox

or more details:

vboxmanage createvdi --filname /path/to/debian01.vdi -size 10240 --format VDI --static --type writethrough --register


add a harddisk to the IDE-controler

now attach a HDD to the ide-controler:

VBoxManage storageattach debian01 --storagectl ide0 --port 0 --device 0 --type hdd --medium /path/to/disk.vdi


remove a harddisk from IDE-controler

to remove a disk do:

vboxmanage closemedium disk /path/to/disk.vdi [--delete]

ATTN: --delete deletes the file from the hostsystems harddisk


add cd-/dvd-rom to the IDE-controler

now attach an cd-/dvd-rom to the ide-controler

VBoxManage storageattach debian01 --storagectl ide0 --port 0 --device 1 --type dvddrive --medium /path/to/iso/debian-netinst.iso


add an usbdevice to guest

the 1st thing we well have to do is to check if usb is tunes on for the guest
and start it if not:

vboxmanage modifyvm debian01 --usb on

since usb is hot-plug, this may be done while the guest is running!
get a list of usb-devices available on the host-system including the device UUID:

vboxmanage list usbhost

attach the usb-device:

vboxmanage controlvm debian01 usbattach <Device-UUID>

detach the usb-device:

vboxmanage controlvm debian01 usbdetach <Device-UUID>

install extension-pack (optional)

VBoxManage extpack install /path/to/Oracle_VM_VirtualBox_Extension_Pack-4.0.4-70112.vbox-extpack

you can download extension pack @http://www.virtualbox.org/wiki/Downloads


activate vrde (RDP-Console)

after installing the extension-pack you are able to activate VRDE.
this is a console like RDP-connection to the HOST-system, where you can view
the system booting (virtualbox-bios --> grub --> and so on...)

you can do that for 1 virtual machine until you assign some more ip-addresses to the host-system
or you will configure each VM to listen to a non standart RDP-port.

my favorite is to configure one secondary IP for each VM on the host-system.
this has the advantage that i don't have to specify a seperate port at my RDP-Client software

so i added an IP on the host-system:

ip addr add 10.255.255.1/8 dev eth0


after adding, i activated the VRDE specifying the new IP:

VBoxManage modifyvm debian01 --vrde on --vrdeaddress 10.255.255.1


start the VM

before starting the system i will get ready to fire my RDP-Client with the correct ip-address to connect to.
in my case: 10.255.255.1

VBoxHeadless --startvm debian01

Now fire the above command and directly after that the RDP-Client