Advertisement
efxtv

Install QEMU in Ubuntu (With Secure boot enabled)

Jan 25th, 2025 (edited)
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.45 KB | Cryptocurrency | 0 0
  1. Install QEMU in Ubuntu/Fidora/Kali Linux (With Secure boot enabled)
  2.  
  3. ##################################################################
  4. JOIN US ON TELEGRAM FOR MORE AND DETAILED CLASSES
  5. VISIT OUR TELEGRAM PROFILE: https://t.me/LinuxClassesEFXTv
  6. ##################################################################
  7.  
  8. STEP 1: Update the System
  9. sudo apt update && sudo apt upgrade -y
  10.  
  11. STEP 2: Install QEMU
  12. sudo apt install qemu-system-x86 qemu-utils libvirt-daemon libvirt-clients bridge-utils virt-manager -y
  13.  
  14. STEP 3: Verify Installation
  15. qemu-system-x86_64 --version
  16.  
  17. STEP 4: Enable and Start Services
  18. sudo systemctl enable --now libvirtd
  19. sudo systemctl start libvirtd
  20.  
  21. STEP 5: Create HDD.qcow2
  22. mkdir ~/qemu ; qemu-img create -f qcow2 ~/qemu/fedora_disk.qcow2
  23.  
  24. Step 6: Install ISO in ~/qemu/fedora_disk.qcow2 (HDD.qcow2)
  25. qemu-system-x86_64 \
  26.     -boot d \
  27.     -cdrom /home/demo/Downloads/Fedora-Xfce-Live-x86_64-41-1.4.iso \
  28.     -m 5048 \
  29.     -enable-kvm \
  30.     -drive file=~/qemu/fedora_disk.qcow2,format=qcow2
  31.  
  32. STEP 6: Start VM. Things you can modify
  33. # -m = RAM / memory
  34. # cpus = Number of cpu
  35. # snapshot = off/on (off menans on, on means off)
  36. qemu-system-x86_64 -boot c -m 4048 -enable-kvm -smp cpus=2 \
  37. -drive file=~/qemu/fedora_disk.qcow2,format=qcow2,if=virtio,snapshot=off \
  38. -device virtio-net,netdev=net0 -netdev user,id=net0 \
  39. -monitor unix:/tmp/qemu-monitor-socket,server,nowait
  40.  
  41. STEP 7: Start with Full screen
  42. # sudo dnf install virt-viewer
  43. # sudo dnf install remote-viewer
  44. # remote-viewer spice://localhost:5900
  45. # or
  46. # change the Display size in QEMU virtual MACHINE
  47. qemu-system-x86_64 -boot c -m 4048 -enable-kvm -smp cpus=2 \
  48. -drive file=~/qemu/fedora_disk.qcow2,format=qcow2,if=virtio,snapshot=off \
  49. -device virtio-net,netdev=net0 -netdev user,id=net0 \
  50. -monitor unix:/tmp/qemu-monitor-socket,server,nowait \
  51. -spice port=5900,disable-ticketing=on -device virtio-vga
  52.  
  53. STEP 8: Connect Screen with remote-viewer
  54. remote-viewer spice://localhost:5900
  55.  
  56. STEP 9: Snapshots
  57. # Start vm using (Step 6)
  58. # Ensure that snapshot=off in the commands
  59. # Open new terminal and paste command
  60. # Use the command to get in to (qemu) shell and follow step 10
  61. nc -U /tmp/qemu-monitor-socket
  62.  
  63. STEP 10: How to use Qemu Shell to save/load/delete/list snapshot?
  64. (qemu) savevm snapshot_name # Use command to save Snapshot
  65. (qemu) loadvm snapshot_name # To load Snapshot
  66. (qemu) info snapshots # To list all Snapshots
  67. (qemu) delvm snapshot_name # Delete snapshot
  68.  
  69.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement