Skip to content

Instantly share code, notes, and snippets.

@seandenigris
Last active February 11, 2024 01:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save seandenigris/5039427 to your computer and use it in GitHub Desktop.
Save seandenigris/5039427 to your computer and use it in GitHub Desktop.
VirtualBox: Programmatically Create Debian VM
#!/bin/bash
# Reference: http://stdioe.blogspot.com/2012/01/creating-virtual-machine-with.html
VM_NAME="Debian Squeeze 2"
DEBIAN_CD_IMAGE="debian-6.0.7-amd64-netinst.iso"
# Create VM
VBoxManage createvm --name "$VM_NAME" --ostype Debian_64 --register
# VM Settings
# ioapic should be enabled for all 64-bit Oses (per manual)
# rtcuseutc - clock in UTC time (enabled by default for VB GUI)
VBoxManage modifyvm "$VM_NAME" --memory 384 --acpi on --ioapic on --rtcuseutc on --boot1 dvd --boot2 disk --boot3 floppy --mouse usbtablet --vram 12 --audio coreaudio --audiocontroller ac97
# Hard Disk
VBoxManage createhd --filename "$VM_NAME.vdi" --size 10000
VBoxManage storagectl "$VM_NAME" --name "SATA Controller" --add sata --controller IntelAhci --sataportcount 1
VBoxManage storageattach "$VM_NAME" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$VM_NAME.vdi"
VBoxManage storagectl "$VM_NAME" --name "IDE Controller" --add ide --controller PIIX4
VBoxManage storageattach "$VM_NAME" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium "$DEBIAN_CD_IMAGE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment