Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sfxworks/98a2384258f97beae2e4b0a2a3d9b81c to your computer and use it in GitHub Desktop.
Save sfxworks/98a2384258f97beae2e4b0a2a3d9b81c to your computer and use it in GitHub Desktop.
install apt-get package to qcow2 image
sudo apt-get install qemu-utils
sudo modprobe nbd
sudo qemu-nbd --connect=/dev/nbd0 /full/path/to/qcow2/image/file
sudo mkdir /mnt/debian
sudo mount /dev/nbd0p1 /mnt/debian
sudo mount -t proc proc /mnt/debian/proc/
sudo mkdir /mnt/debian/run/resolvconf
sudo cp /etc/resolv.conf //mnt/debian/run/resolvconf/
sudo chroot /mnt/debian apt-get update
sudo chroot /mnt/debian apt-get install foo -y
sudo umount /mnt/debian/proc
sync
sudo umount /mnt/debian
sudo qemu-nbd --disconnect /dev/nbd0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment