Skip to content

Instantly share code, notes, and snippets.

@katabame
Created October 26, 2021 14:23
Show Gist options
  • Save katabame/57f122c443506285a19cde40a40581eb to your computer and use it in GitHub Desktop.
Save katabame/57f122c443506285a19cde40a40581eb to your computer and use it in GitHub Desktop.
pkg update && pkg install qemu-utils qemu-common qemu-system-x86_64-headless
mkdir alpine && cd $_
wget http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.3-x86_64.iso
qemu-img create -f qcow2 alpine.img 4G
qemu-system-x86_64 -machine q35 -m 2048 -smp cpus=2 -cpu qemu64 \
-drive if=pflash,format=raw,read-only=on,file=$PREFIX/share/qemu/edk2-x86_64-code.fd \
-netdev user,id=n1,hostfwd=tcp::2222-:22 -device virtio-net,netdev=n1 \
-cdrom alpine-virt-3.12.3-x86_64.iso \
-nographic alpine.img
apk update && apk add docker
service docker start
rc-update add docker
setup-interfaces
ifup eth0
wget https://gist.githubusercontent.com/oofnikj/e79aef095cd08756f7f26ed244355d62/raw/answerfile
sed -i -E 's/(local kernel_opts)=.*/\1="console=ttyS0"/' /sbin/setup-disk
setup-alpine -f answerfile
pkg update && pkg install qemu-utils qemu-common qemu-system-x86_64-headless
mkdir alpine && cd $_
wget http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-virt-3.12.3-x86_64.iso
qemu-img create -f qcow2 alpine.img 4G
qemu-system-x86_64 -machine q35 -m 2048 -smp cpus=2 -cpu qemu64 \
-drive if=pflash,format=raw,read-only=on,file=$PREFIX/share/qemu/edk2-x86_64-code.fd \
-netdev user,id=n1,hostfwd=tcp::2222-:22 -device virtio-net,netdev=n1 \
-nographic alpine.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment