🧰 Requirements
A Linux host with:
- qemu (or qemu-system-x86_64) installed
- sudo privileges
- The ISO file of the OS you want to install (e.g. ubuntu.iso)
- A USB drive (we’ll call it /dev/sdX — replace X with your actual device letter)
⚠️ Be careful — this process will overwrite all data on the USB drive.
You can identify the USB drive with:
|
|
Then note your target (e.g. /dev/sdb).
🧩 Step-by-step using QEMU
1. Unmount the USB drive (important!)
|
|
2. Run QEMU, booting from the ISO, using the USB drive as the VM’s hard disk
|
|
Explanation:
- -enable-kvm → hardware acceleration
- -m 4096 → 4 GB of RAM
- -boot d → boot from CD-ROM first
- -cdrom → ISO installer
- -drive file=/dev/sdX,format=raw → use the physical USB as a raw disk
- -vga virtio → decent graphics for most installers
3. Install normally
Inside the VM, choose the target disk corresponding to the USB drive (usually shows as /dev/vda in the VM).
Perform the OS installation as you would on a normal hard drive.
4. Shut down the VM
Once the installation finishes, power off the VM.
You can then safely remove the USB and boot it on real hardware.