Bootstrapping Alpine Linux: Difference between revisions

From Alpine Linux
(added linux-firmware-none to not install ~1G of useless firmwares on a vm/vps)
(better formatting)
Line 30: Line 30:
<pre>chroot /tmp/target /bin/sh</pre>
<pre>chroot /tmp/target /bin/sh</pre>


* setup repos (setup-apkrepos -f)
* setup repos
* add a few base packages (apk update && apk add linux-lts linux-firmware-none acpi mkinitfs)
<pre>setup-apkrepos -f</pre>
* setup hostname (setup-hostname)
* add a few base packages
* setup network (setup-interfaces)
<pre>apk update
* add services
apk add linux-lts linux-firmware-none acpi mkinitfs</pre>
* setup hostname
<pre>setup-hostname</pre>
* setup network
<pre>setup-interfaces</pre>
* add services to boot
<pre>
<pre>
rc-update add acpid default
rc-update add acpid default

Revision as of 11:22, 8 August 2023


VPS

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

Process

Prepare

  1. Download apk-tools-static for your architecture.
  2. wget https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.0/x86_64/apk.static
  3. Unpack .apk
  4. tar zxf apk-tools-static-*.apk

Install

Assuming your alpine rootfs is mounted in /tmp/target

sudo ./sbin/apk.static --arch $(arch) -X http://dl-cdn.alpinelinux.org/alpine/latest-stable/main/ -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 repos
setup-apkrepos -f
  • add a few base packages
apk update
apk add linux-lts linux-firmware-none acpi mkinitfs
  • setup hostname
setup-hostname
  • setup network
setup-interfaces
  • 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

Bootloader

References