I am using an APU2 system for more than 5 years now and, it seems it can run vmd without problem, so, why not using it has small virtual machine host?

I need to run different kind of tools on Linux for my own projects and to make tests, voidlinux remains one of the best Linux distribution I know, but, Alpine Linux seems a good one too. I used it years ago on Docker and worked like a charm. Can I use it on OpenBSD vmm?

# Requirement

# create directory
mkdir /home/_vmd
mkdir /home/_vmd/disk
mkdir /home/_vmd/iso

# fetch iso
ftp -o /home/_vmd/iso http://dl-cdn.alpinelinux.org/alpine/v3.11/releases/x86_64/alpine-virt-3.11.2-x86_64.iso
ln -s /home/_vmd/iso/alpine-virt-3.11.2-x86_64.iso /home/_vmd/iso/alpine.iso

# create qcow2 image
vmctl create -s 10G /home/_vmd/disk/alpine.qcow2

# Network configuration

# create vether interface
echo "ifconfig vether0 create" >> /etc/rc.local
echo "alias 192.168.253.1/24" >> /etc/hostname.vether0
echo "up" >> /etc/hostname.vether0
ifconfig vether0 create up
ifconfig vether0 alias 192.168.253.1/24

# create bridge0 interface
echo "ifconfig bridge0 create" >> /etc/rc.local
echo "add vether0" >> /etc/hostname.bridge0
echo "up" >> /etc/hostname.bridge0
ifconfig bridge0 create up
ifconfig bridge0 add vether0

# configure packet filter
cat >> /etc/pf.conf << EOF
anchor vmd
EOF
pfctl -nf /etc/pf.conf && pfctl -f /etc/pf.conf

# create the anchor
echo 'pass out on (re0) from 192.168.253.0/24 to any nat-to (re0)' | pfctl -a vmd -f -

# configure dhcpd

# vmd configuration

# create vmd configuration
cat > /etc/vm.conf << EOF
vm "alpine" {
    memory 256M
    disk "/home/_vmd/disk/alpine.qcow2" format qcow2
    cdrom "/home/_vmd/iso/alpine.iso"
    interface {
        switch "uplink"
    }
    disable
}

switch "uplink" {
    interface bridge0
}
EOF

# enable and start vmd
rcctl enable vmd
rcctl start vmd

# Install Alpine Linux

By default, vmd (opens new window) will not start our alpine vm because it was explicitely disabled in /etc/vm.conf (opens new window). You need to start it manually. The command will give you access to your virtual machine directly from the console.

# start alpine linux vm
vmctl start -c alpine

You can log with root account without password and launch setup-alpine (opens new window).

setup-alpine
# ...

We need to modify the apk repositories (opens new window) file located in /etc/apk/repositories and add the community support.

sed -i -E '!v3.11/community!s!^#!!' /etc/apk/repositories

We can now update and upgrade our system.

apk update
apk upgrade

We can now install some tools needed for my tests, nginx, nodejs and npm.

apk install nginx nodejs npm

# Configure ghost

I need ghost (opens new window) to access its API and make some local test. Here the procedure to install it:

useradd -D ghost
useradd ghost ghost
su - ghost
npm install ghost-cli -g
ghost install local