| | #!/bin/bash |
| |
|
| | |
| | VM_NAME="UbuntuVM" |
| | UBUNTU_VERSION="20.04.3" |
| | ISO_FILENAME="ubuntu-$UBUNTU_VERSION-server-amd64.iso" |
| | ISO_URL="http://cdimage.ubuntu.com/releases/$UBUNTU_VERSION/release/$ISO_FILENAME" |
| | VM_DIR="$HOME/VirtualBox VMs/$VM_NAME" |
| | HDD_PATH="$VM_DIR/$VM_NAME.vdi" |
| | RAM_SIZE="2048" |
| | VRAM_SIZE="1028" |
| | HDD_SIZE="20000" |
| |
|
| | |
| | echo "Downloading Ubuntu $UBUNTU_VERSION Server ISO..." |
| | curl -o "$ISO_FILENAME" "$ISO_URL" |
| |
|
| | |
| | VBoxManage createvm --name "$VM_NAME" --ostype "Ubuntu_64" --register |
| |
|
| | |
| | VBoxManage modifyvm "$VM_NAME" --ioapic on |
| | VBoxManage modifyvm "$VM_NAME" --memory "$RAM_SIZE" --vram "$VRAM_SIZE" |
| | VBoxManage modifyvm "$VM_NAME" --nic1 nat |
| | VBoxManage modifyvm "$VM_NAME" --boot1 dvd --boot2 disk --boot3 none --boot4 none |
| | VBoxManage modifyvm "$VM_NAME" --graphicscontroller vboxvga |
| | VBoxManage modifyvm "$VM_NAME" --audio none |
| |
|
| | |
| | VBoxManage createmedium disk --filename "$HDD_PATH" --size "$HDD_SIZE" --format VDI |
| |
|
| | |
| | VBoxManage storagectl "$VM_NAME" --name "SATA Controller" --add sata --controller IntelAhci |
| | VBoxManage storageattach "$VM_NAME" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "$HDD_PATH" |
| |
|
| | |
| | VBoxManage storagectl "$VM_NAME" --name "IDE Controller" --add ide |
| | VBoxManage storageattach "$VM_NAME" --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium "$ISO_FILENAME" |
| |
|
| | |
| | |
| | VBoxManage startvm "$VM_NAME" --type headless |
| |
|
| | echo "VM $VM_NAME created and started. You can SSH into it using port 2222." |
| |
|