Advertisement
metalx1000

Minimal Debian VM Setup

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