Utility scripts and instructions for running alpine with qemu
e30d658b — Harley Swick 3 years ago
Enable kvm + docs
a43b002b — Harley Swick 3 years ago
Run qxl that is working
3c4e23e1 — Harley Swick 3 years ago
Update README with video drivers for QEMU


browse  log 



You can also use your local clone with git send-email.


This repository contains scripts and instructions for running Alpine Linux with QEMU.


Download the latest release from here:

curl -O http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/alpine-standard-3.12.0-x86_64.iso

Create a virtual hard disk in qcow2 format (will be named alpine.qcow2):


Then install alpine linux with this script pass in the path to the iso file:

./install.sh alpine-standard-3.12.0-x86_64.iso

The login is root and run setup-alpine. You should mostly choose defaults. Once the installation is complete you should reboot.

When choosing disk make sure to choose vda and set the type as sys.

Now that the installation is complete one can run the VM with:



Start qemu with ssh port forwarding:

qemu-system-x86_64 alpine.qcow2 -nic user,hostfwd=tcp::10022-:22

Or simply run which includes some other options like kvm:


Before you can ssh into the VM you have to add a guest user or enable root login.

Once the VM is running one can ssh into it:

ssh *user*@*hostname* -p 10022

#Add User

adduser *newuser*

You will eventually need to setup this user with root permissions. Interestingly, Alpine does not come with sudo or usermod. An alternative is doas.

As root install doas:

apk add doas

Now you have to configure it to give newuser permissions. However, the config file is readonly by default.

The solution is to give yourself write permissions:

chmod +w /etc/doas.conf

Then open it with vi:

vi /etc/doas.conf

Add this line to the config file:

 permit nopass *newuser* as root

Now when running things like apk simply do this:

doas apk add *package*


Make a directory to use as the mountpoint:

mkdir ~/linuxizeremote

Then mount the directory from guest to host:

sshfs linuxize@ /home/linuxize/linuxizeremote

#Desktop Environments

apk add x86-video-mode-settings # Havent confirmed how necessary this is
apk add x86-video-vesa




apk add linux-virt
apk del linux-lts


Add edge community repo

apk add elogind

Add elogind to boot

rc-update add elogind boot


https://drewdevault.com/2018/09/10/Getting-started-with-qemu.html https://fadeevab.com/how-to-setup-qemu-output-to-console-and-automate-using-shell-script/ https://wiki.gentoo.org/wiki/QEMU/Options https://web.archive.org/web/20180104171638/http://nairobi-embedded.org/qemu_monitor_console.html https://www.spice-space.org/spice-user-manual.html