• Install termux
  • Install qemu
pkg install qemu-system-x64_64 qemu-utils
  • Download alpine iso
curl https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-virt-3.18.0-x86_64.iso -o alpine.iso
  • Create an image disk(to install alpine):
qemu-img create -f qcow2 alpine.img 64g
  • Start qemu
qemu-system-x86_64 -hda alpine.img -cdrom alpine.iso -boot d -m 512 -nographic
  • edit /etc/resolv.conf to have the content nameserver 8.8.8.8
  • Make the resolv.conf file immutable using1
    • sudo chattr +i /etc/resolv.conf
    • I had issues during setup-alpine and configuring eth0 interface. The resolv.conf was overridden.
  • Do setup-alpine
    • setup everything as required
    • For the disk choose sda which is the image that we created.
  • Once the installation is done run halt. Exit from Qemu using ctrl+a x
  • Boot into the system using
qemu-system-x86_64 -hda alpine.img -boot c -m 1024 -smp 2 -nographic

Footnotes

  1. https://bbs.archlinux.org/viewtopic.php?id=181618