Advertisement
metalx1000

QEMU basic setup

Nov 12th, 2023 (edited)
1,278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.33 KB | None | 0 0
  1. #based on tutorial at https://christitus.com/vm-setup-in-linux/
  2. #Check Virtualization Extension
  3. #should return greater than 0
  4. egrep -c '(vmx|svm)' /proc/cpuinfo
  5.  
  6. sudo apt install qemu-kvm qemu-system qemu-utils python3 python3-pip libvirt-clients libvirt-daemon-system bridge-utils virtinst libvirt-daemon virt-manager -y
  7. sudo systemctl status libvirtd.service
  8.  
  9. #Start Default Network for Networking
  10. sudo virsh net-start default
  11. sudo virsh net-autostart default
  12.  
  13. #Check status with
  14. sudo virsh net-list --all
  15.  
  16. #Add User to libvirt to Allow Access to VMs
  17. sudo usermod -aG libvirt $USER
  18. sudo usermod -aG libvirt-qemu $USER
  19. sudo usermod -aG kvm $USER
  20. sudo usermod -aG input $USER
  21. sudo usermod -aG disk $USER
  22.  
  23. #reboot for permissions to take effect
  24.  
  25. #Get ISO
  26. wget -c "http://mirror.slitaz.org/iso/rolling/slitaz-rolling.iso"
  27. qemu-system-i386 -enable-kvm -m 2G -smp 2 -boot d -cdrom slitaz-rolling.iso
  28.  
  29. -enable-kvm → KVM to boost performance
  30. -m 4G → 4GB RAM
  31. -smp 2 → 2CPUs
  32. -hda myVirtualDisk.qcow2 → our 20GB variable-size disk
  33. -boot d → boots the first virtual CD drive
  34. -cdrom linuxmint-21.1-cinnamon-64bit.iso → Linux Mint ISO
  35. -netdev user,id=net0,net=192.168.0.0/24,dhcpstart=192.168.0.9 → NAT with DHCP
  36. -device virtio-net-pci,netdev=net0 → network card
  37. -vga qxl → powerful graphics card
  38. -device AC97 → sound card
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement