Skip to content

Instantly share code, notes, and snippets.

@samperay
Last active October 21, 2022 13:27
Show Gist options
  • Save samperay/776e2841fb224ce2ffbfe8acc7ef84d1 to your computer and use it in GitHub Desktop.
Save samperay/776e2841fb224ce2ffbfe8acc7ef84d1 to your computer and use it in GitHub Desktop.
Create KVM/QUMU nested virtulization
# How do you install QEMU/KVM within virtual box
sudo apt update
sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo apt install virt-manager
virsh list
qemu-img create -f qcow2 /var/lib/libvirt/images/xenial.qcow2 20G
virt-install \
--name xenial \
--ram 1024 \
--disk path=/var/lib/libvirt/images/xenial.qcow2,size=20 \
--vcpus 2 \
--os-type linux \
--os-variant ubuntu16.04 \
--network network=default\
--graphics none \
--console pty,target_type=serial \
--location ./ubuntu-16.04.6-server-amd64.iso \
--extra-args 'console=ttyS0,115200n8 serial'
I wasn't able to get the console, hence you can ssh into the guest machine once you find out the ipaddress.
virsh net-dhcp-leases default
once you find your ip address, then ssh to the guest machine and execute the following commands to have the console login.
$ sudo systemctl enable [email protected]
$ sudo systemctl start [email protected]
once ^^ above is completed, then from your host machine,
virsh list --all
virsh console <name-of-your-machine>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment