Using an answerfile with setup-alpine

From Alpine Linux
Revision as of 20:22, 28 June 2025 by Jvvv (talk | contribs)
Tip: This page is a work in progress. It is currently being actively editted. I will remove this tip before the end of day.

Using An Answerfile with setup-alpine

To get an quick start with setup-alpine answerfiles, a starter answerfile can be generated with:

setup-alpine -c PATH_TO_FILENAME

At the time of writing this, the previous command will result in output in the specified PATH_TO_FILENAME:

Contents of PATH_TO_FILENAME

# Example answer file for setup-alpine script # If you don't want to use a certain option, then comment it out # Use US layout with US variant # KEYMAPOPTS="us us" KEYMAPOPTS=none # Set hostname to 'alpine' HOSTNAMEOPTS=alpine # Set device manager to mdev DEVDOPTS=mdev # Contents of /etc/network/interfaces INTERFACESOPTS="auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp hostname alpine-test " # Search domain of example.com, Google public nameserver # DNSOPTS="-d example.com 8.8.8.8" # Set timezone to UTC #TIMEZONEOPTS="UTC" TIMEZONEOPTS=none # set http/ftp proxy #PROXYOPTS="http://webproxy:8080" PROXYOPTS=none # Add first mirror (CDN) APKREPOSOPTS="-1" # Create admin user USEROPTS="-a -u -g audio,input,video,netdev juser" #USERSSHKEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOIiHcbg/7ytfLFHUNLRgEAubFz/13SwXBOM/05GNZe4 juser@example.com" #USERSSHKEY="https://example.com/juser.keys" # Install Openssh SSHDOPTS=openssh #ROOTSSHKEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOIiHcbg/7ytfLFHUNLRgEAubFz/13SwXBOM/05GNZe4 juser@example.com" #ROOTSSHKEY="https://example.com/juser.keys" # Use openntpd # NTPOPTS="openntpd" NTPOPTS=none # Use /dev/sda as a sys disk # DISKOPTS="-m sys /dev/sda" DISKOPTS=none # Setup storage with label APKOVL for config storage #LBUOPTS="LABEL=APKOVL" LBUOPTS=none #APKCACHEOPTS="/media/LABEL=APKOVL/cache" APKCACHEOPTS=none

When using answerfile, be sure to edit the file's contents to your needs. Comment out variables you wish not to be set. Be sure that the uncommented variables have valid values set to your preference. Once you are satisfied with the answerfile contents, this how is to use it:

setup-alpine -f PATH_TO_FILENAME

Answerfile Variables

The variables in the answerfile alter the arguments passed to the setup-* scripts that are called out to from setup-alpine. These are:

KEYMAPOPTS="LAYOUT VARIANT"
HOSTNAMEOPTS="HOSTNAME"
DEVDOPTS="DEVD"
The choices are mdev (from busybox), mdevd (standalone), and udev (from eudev).
INTERFACEOPTS
DNSOPTS
TIMEZONEOPTS
PROXYOPTS
NTPOPTS
APKREPOSPTS
USEROPTS
USERSSHKEY
SSHDOPTS
ROOTSSHKEY
XENDOM0OPTS
DISKOPTS
LBUOPTS
APKCACHEOPTS