Skip Navigation

Alpine Linux

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.19/main
https://dl-cdn.alpinelinux.org/alpine/v3.19/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.).

Bootloaders

Listing Installed Packages

To list every package that you have installed on Alpine Linux, run:

apk info

To check to see if a specific package is installed, pipe the output of the above command to the grep command, and use grep to look for the package. For example, to see if the “linux-lts” package is installed, you would run:

apk info | grep linux-lts

If a package matching the specified name is installed, then it will be displayed as the output of the grep command. If no matching package is installed, then no output is displayed.

Be careful to check that the displayed output exactly matches the package name you’re seeking. For example, if you run:

apk info | grep linux

then all packages that have “linux” in their names will be displayed. You will need to look at the output to determine if the specific package you need is installed.

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