Create an Alpine 1.9 vserver template

From Alpine Linux
Jump to: navigation, search

How to create an Alpine 1.9 vserver template

A vserver template is a simple tar archive of a base install.

Install base packages into a temporary root

sudo apk add --initdb --root /tmp/template --repositories-file /etc/apk/repositories --keys-dir /etc/apk/keys -U alpine-base

Vserver needs at least one process running when it boots up so we manually enable the syslog service in our template.

sudo chroot /tmp/template /sbin/rc-update add syslog boot

Create the archive as /tmp/template.tar.gz

cd /tmp/template && sudo tar -czf /tmp/template.tar.gz *

Finally remove the temp dir.

sudo rm -r /tmp/template