Bootstrapping Alpine Linux

From Alpine Linux
Revision as of 09:30, 13 January 2024 by Zcrayfish (talk | contribs) (→‎References: Remove red wikilink, remove wikilink to an article that is currently obsolete (but it could be updated and readded here....))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


This section is to provide a means to bootstrap Alpine Linux on any VPS.



  1. Download apk-tools-static for your architecture.
  2. wget
  3. Unpack .apk
  4. tar zxf apk-tools-static-*.apk


Assuming your alpine rootfs is mounted in /tmp/target

sudo ./sbin/apk.static --arch $(arch) -X -U --allow-untrusted --root /tmp/target --initdb add alpine-base

  • edit /tmp/target/etc/fstab
  • edit /tmp/target/etc/inittab
  • edit /tmp/target/etc/resolv.conf
  • mount proc/sys/dev
for a in proc sys dev; do mount -o bind /$a /tmp/target/$a; done
  • chroot into your new installation
chroot /tmp/target /bin/sh
  • setup hostname
  • setup network
  • setup repos
setup-apkrepos -f
  • add a few base packages
apk update
apk add linux-lts linux-firmware-none acpi mkinitfs
  • add services to boot
rc-update add acpid default
rc-update add bootmisc boot
rc-update add crond default
rc-update add devfs sysinit
rc-update add dmesg sysinit
rc-update add hostname boot
rc-update add hwclock boot
rc-update add hwdrivers sysinit
rc-update add killprocs shutdown
rc-update add mdev sysinit
rc-update add modules boot
rc-update add mount-ro shutdown
rc-update add networking boot
rc-update add savecache shutdown
rc-update add seedrng boot
rc-update add swap boot



If you have bootstrapped Alpine Linux from an existing system in a different partition and intend to boot into it, you should always include the root filesystem type (rootfstype) in the kernel parameter (bootloader option), since by default kernel does not automatically load any filesystem modules for root partition, unless specified. That way mount will not complain about being unable to mount root partition on /sysroot.

Example bootloader option: