Created
October 30, 2020 17:02
-
-
Save junedkhatri31/bc7cef624acf21115f4580d3f6748e41 to your computer and use it in GitHub Desktop.
Boot VM using qemu
This file contains 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
### create_storage.sh | |
#!/bin/bash | |
if [ "$#" -ne 1 ]; then | |
echo "You must enter exactly 1 command line arguments" | |
fi | |
qemu-img create -f qcow2 storages/$1.img 10G | |
### start_vm.sh | |
#!/bin/bash | |
if [ "$#" -ne 1 ]; then | |
echo "You must enter exactly 1 command line arguments" | |
fi | |
vm_name=$1 | |
qemu-system-x86_64 \ | |
-enable-kvm \ | |
-m 2048 \ | |
-smp 2 \ | |
-cpu host \ | |
-soundhw es1370 \ | |
-device virtio-mouse-pci -device virtio-keyboard-pci \ | |
-serial mon:stdio \ | |
-boot menu=on \ | |
-net nic \ | |
-net user,hostfwd=tcp::5555-:22 \ | |
-device virtio-vga,virgl=on \ | |
-display gtk,gl=on \ | |
-hda storages/$vm_name.img \ | |
-cdrom images/$vm_name.iso |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment