-
-
Save HectorIFC/f29f647e552251659a0c01d428084da1 to your computer and use it in GitHub Desktop.
Shell script to create a VirtualBox Virtual machine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# createvm.sh | |
# | |
# ver 1.0 | |
# | |
# Jose Gomez Castaño [email protected] | |
# | |
# Create a Virtual Box Machine in the createPath directory with the name given in name variable. | |
# Operating Sistem has to be specified in os variable and ISO has to be accesible in isoPath | |
# When created, the name virtual machine can be accesible via RDP at localIP:3389 | |
# The UUID and Setting file is returned | |
# | |
# Usage: $./createvm.sh | |
# | |
name='XP_pepe' | |
os='WindowsXP' | |
sizeDisk=10000 | |
isoPath='/home/pepe/virtualbox/wxp_sp2.ISO' | |
createPath='/home/pepe/virtualbox/' | |
VBoxManage createhd --filename $createPath$name'/'$name.vdi --size $sizeDisk | |
VBoxManage createvm --basefolder $createPath --name $name --ostype $os --register | |
VBoxManage storagectl $name --name "IDE Controller" --add ide | |
VBoxManage storageattach $name --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium $isoPath | |
VBoxManage storagectl $name --name "SATA Controller" --add sata --controller IntelAHCI | |
VBoxManage storageattach $name --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium $createPath$name'/'$name.vdi | |
VBoxManage modifyvm $name --boot1 dvd --boot2 disk --boot3 none --boot4 none | |
VBoxManage modifyvm $name --memory 1024 --vram 128 | |
VBoxManage modifyvm $name --nic1 bridged --bridgeadapter1 eth0 | |
VBoxHeadless -s $name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment