Created
August 11, 2017 22:33
-
-
Save cuahutli/e33f3e838d6594e59fed1dc87f76a681 to your computer and use it in GitHub Desktop.
Script para crear una VM con VirtualBox desde consola y acceso vía RDP activado
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/sh | |
VMNAME="virtserver" | |
ISO="PATH/TO/ISO" | |
VBOX_PATH="/PATH/TO/VirtualBox VMs/" | |
DIR_VM="$VBOX_PATH""$VMNAME" | |
HDD_VM="$DIR_VM/$VMNAME-disk1.vmdk" | |
echo "Creando directorio que almacenara la VM" | |
mkdir -p "$DIR_VM" | |
VBoxManage createvm -name "$VMNAME" --register --ostype Ubuntu_64 | |
#RAM Memory | |
VBoxManage modifyvm "$VMNAME" --memory 1024 | |
#Network | |
VBoxManage modifyvm "$VMNAME" --nic1 bridged --bridgeadapter1 eth0 | |
#Storage | |
VBoxManage storagectl "$VMNAME" --name "IDE Controller" --add ide --controller PIIX4 | |
VBoxManage storagectl "$VMNAME" --name "SATA Controller" --add sata --controller IntelAhci | |
VBoxManage storagectl "$VMNAME" --name "SCSI Controller" --add scsi --controller LsiLogic | |
VBoxManage createhd --filename "$HDD_VM" --size 20000 --format VMDK #--variant Split2G | |
#VBoxManage createvdi --filename "disk2.vdi" --size 1000 | |
VBoxManage storageattach "$VMNAME" --storagectl "IDE Controller" --type dvddrive --port 0 --device 0 --medium "$ISO" | |
VBoxManage storageattach "$VMNAME" --storagectl "SATA Controller" --type hdd --port 0 --device 0 --medium "$HDD_VM" | |
#VBoxManage storageattach "$VMNAME" --storagectl "SCSI Controller" --type hdd --port 0 --device 0 --medium "disk2.vdi" | |
#Activate VRDE | |
VBoxManage modifyvm "$VMNAME" --vrde on | |
VBoxManage modifyvm "$VMNAME" --vrdeport 5050 | |
VBoxManage modifyvm "$VMNAME" --vrdemulticon on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment