Skip Navigation

Alpine Linux Notes

This document contains a few useful notes about Alpine Linux.

Page Contents

Obtaining Alpine Linux

The edition of Alpine Linux that you need depends on your project. For the projects that are entirely in virtual machines (authentication/authorization and Web stack), you can download the “Virtual” flavor. For the desktop project, I recommend the “Extended” ISO file for x86_64. If you’re targeting a Raspberry Pi for the desktop project, use one of the Raspberry Pi releases.

Reference Material

Alpine Basics

When you boot into the Alpine Linux installation environment, you are in a basic Alpine system that runs from RAM. This system uses BusyBox with the Almquist shell (ash), which doesn’t have as many features as the default shell in many other distributions (typically the Bourne-again Shell, or bash). For the purposes of performing the installation, this difference shouldn’t matter too much. However, you will want to install bash or zsh to use as your day-to-day shell after performing the initial installation.

By default, the editor that you will need to use for adjusting configuration files is vi, which is a fairly limited version that comes with BusyBox. You might want to watch my demonstration video, A Minimal Introduction to Vi, if you aren’t already familiar with this editor.

There are several possible installation modes for Alpine Linux, including diskless, data disk, and system (sys) modes. For a desktop environment or authentication/authorization server, you’re going to want to install in system (sys) mode. A Web stack could use either sys or data disk mode.

APK Repository Notes

The setup-apkrepos command doesn’t do a great job of configuring the Alpine Linux repositories. It’s better to edit /etc/apk/repositories by hand. Set the content to:

https://dl-cdn.alpinelinux.org/alpine/v3.16/main
https://dl-cdn.alpinelinux.org/alpine/v3.16/community
@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing

The final line of that configuration permits installation of bleeding-edge testing packages by specifying the target as pkgname@testing when doing an installation. You may need some packages from testing for certain purposes (e.g. printer drivers, Tomcat server, etc.).

GRUB Installation Notes

If you are using UEFI mode, it is necessary to use the GRUB bootloader. Automatic installation of GRUB might fail in the current Alpine Linux releases. Should this occur, run the following commands in the installer environment. Do not reboot until you have a working bootloader, or you’ll just be stuck in an installation loop.

mkdir -p /mnt/dev
mkdir -p /mnt/proc
mkdir -p /mnt/sys
mount -o bind /dev /mnt/dev
mount -o bind /proc /mnt/proc
mount -o bind /sys /mnt/sys
chroot /mnt
# Do the steps from the LVM on LUKS wiki article for editing /etc/default/grub
grub-install --target=x86_64-efi --bootloader-id=grub --efi-directory=/boot/efi --removable
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -l /mnt/dev
umount -l /mnt/proc
umount -l /mnt/sys

The –removable flag makes the bootloader location more compatible with a wider variety of motherboards.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.