Skip to content

Instantly share code, notes, and snippets.

@phaser
Last active August 12, 2022 07:44
Show Gist options
  • Select an option

  • Save phaser/5c23b0240f2262a176ed973c1763c3a9 to your computer and use it in GitHub Desktop.

Select an option

Save phaser/5c23b0240f2262a176ed973c1763c3a9 to your computer and use it in GitHub Desktop.

Install packages (Ubuntu 18.10)

  sudo apt-get install qemu-kvm qemu virt-manager virt-viewer

Create initial image

  qemu-img create -f qcow2 ubuntu-server-18.10.qcow 50G

Boot the instalation CD

  qemu-system-x86_64 -hda ubuntu-server-18.10.qcow -boot d -cdrom /home/phaser/Downloads/ubuntu-18.10-live-server-amd64.iso -m 640 --enable-kvm

Boot the VM

  qemu-system-x86_64 -hda ubuntu-server-18.10.qcow -boot c -m 1024 --enable-kvm 2>&1 | tee vm-ubuntu-server-18.10.log

Bash script

qemu-system-x86_64 -show-cursor -machine vmport=off,accel=kvm,type=q35 \
        -boot order=dc -vga cirrus \
        -netdev user,id=n1 -device virtio-net,netdev=n1 \
        -soundhw hda \
        -cpu host \
        -m 4G \
        -hda /home/phaser/virtual-machines/kali-linux.img
        #-cdrom /home/phaser/Documents/kali-linux-mate-2019-1a-amd64-iso/kali-linux-mate-2019.1a-amd64.iso \                                                                                                 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment