~fancycade/alpine-qemu

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

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~fancycade/alpine-qemu
read/write
git@git.sr.ht:~fancycade/alpine-qemu

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

#alpine-qemu

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

#Usage

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):

./create-image.sh
	

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:

./run.sh
	

#SSH

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:

./ssh_server.sh

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*
	

#SSHFS

Make a directory to use as the mountpoint:

mkdir ~/linuxizeremote
	

Then mount the directory from guest to host:

sshfs linuxize@192.168.121.121:/home/linuxize /home/linuxize/linuxizeremote

#Desktop Environments

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

#Sway

#linux-virt

https://wiki.alpinelinux.org/wiki/Kernels

apk add linux-virt
apk del linux-lts
reboot

#elogind

Add edge community repo

apk add elogind

Add elogind to boot

rc-update add elogind boot

#References

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