Advertisement
metalx1000

Minimal Debian VM Setup

Jan 30th, 2025 (edited)
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.70 KB | None | 0 0
  1. # Minimal Debian Virtual Machine
  2.  
  3. #required host tools
  4. sudo apt install libguestfs-tools qemu-system
  5.  
  6. #get small debian image
  7. url="https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-amd64.qcow2"
  8. wget -c "$url" -O debian_small.qcow2
  9.  
  10. #create 10G image and copy/resize small image to 10g image
  11. echo "Creating a 10G img file..."
  12. sleep 1
  13. qemu-img create -f qcow2 -o preallocation=metadata debian.qcow2 10G
  14.  
  15. echo "Copying and Expanding Image"
  16. sleep 1
  17. virt-resize --expand /dev/sda1 debian_small.qcow2 debian.qcow2
  18.  
  19. #run virtual machine
  20. qemu-system-x86_64 -enable-kvm -m 4G -hda debian.qcow2
  21.  
  22. # once in VM here is a helper script
  23. https://filmsbykris.com/scripts/debian_setup.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement