Skip to content

Instantly share code, notes, and snippets.

@svenvarkel
Created October 18, 2013 06:48
Show Gist options
  • Save svenvarkel/7037433 to your computer and use it in GitHub Desktop.
Save svenvarkel/7037433 to your computer and use it in GitHub Desktop.
Create and start Debian 7 server headless in VirtualBox
#!/bin/bash
if test $# != 1; then
echo "Usage: $0 vm_name"
exit 0
fi
VMNAME=$1
vboxmanage createvm --name $VMNAME --ostype Debian_64 --register
vboxmanage modifyvm $VMNAME --memory 512 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0 --nictype1 virtio --cpus 2 --cpuhotplug on
vboxmanage createhd --filename ~/VirtualBox\ VMs/testvm/$VMNAME-disk01.vdi --size 4096 --variant Standard
vboxmanage storagectl $VMNAME --name SATA controller --add sata
vboxmanage storagectl $VMNAME --name IDE controller --add ide
vboxmanage storageattach $VMNAME --storagectl "SATA controller" --port 0 --device 0 --type hdd --medium ~/VirtualBox\ VMs/$VMNAME/$VMNAME-disk01.vdi
vboxmanage storageattach $VMNAME --storagectl "IDE controller" --port 1 --device 0 --type dvddrive --medium /mnt/raid/soft/debian-7.2.0-amd64-netinst.iso
vboxheadless -s $VMNAME &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment