The commands to quickly get a alpine image going.
Originally it was just the commands, I made it more explicit on 08AUG2023.
First download the alpine iso:
wget https://dl-cdn.alpinelinux.org/alpine/v3.16/releases/x86/alpine-standard-3.16.2-x86.iso
Next create the hard drive that will contain alpine:
qemu-img create -f raw alpine.img 1G
Now we can start up qemu with the iso, the hard drive and the nographic mode set. This way qemu won't try to use gtk.
qemu-system-x86_64 -m 512 -nic user -boot d -cdrom alpine-standard-3.16.2-x86.iso -drive file=alpine.img,format=raw --nographic
This should take a hot second but once it finishes, you should be at the alpine prompt. You can login with the default user, root and it has no password.
Once logged in you can run the setup-alpine routine to set everything up.
setup-alpine
The two things to note is to make sure to pick the correct harddrive to install to and to use sys. Make sure to also say yes to erasing the disk and installing alpine.
Available disks are:
fd0 (0.0 GB )
sda (1.1 GB ATA QEMU HARDDISK )
Which disk(s) would you like to use? (or '?' for help or 'none') [none] sda
The following disk is selected:
sda (1.1 GB ATA QEMU HARDDISK )
How would you like to use it? ('sys', 'data', 'crypt', 'lvm' or '?' for help) [?] sys
WARNING: Erase the above disk(s) and continue? (y/n) [n] y
This should set everything up and have alpine ready to be used. Now you can turn it off and come back in.
poweroff
To start up alpine using the hard drive:
qemu-system-x86_64 -m 512 -nic user -hda alpine.img --nographic
This should have now put you at the login prompt!
Welcome to Alpine Linux 3.18
Kernel 6.1.43-0-lts on an x86_64 (/dev/ttyS0)
localhost login: