When I discovered Alpine, I had a hard time figuring out what did what. Part of the trouble is that, as the About page says:
- In some cases, there is not a lot of documentation available, and what is available can be scattered about the wiki and/or mailing lists. We're working on it, but could use some help. Please see the Contribute page if you would like to help out.
Another part of the trouble is that up-to-date information in the wiki was mixed together with information that only concerned older versions of Alpine (and sometimes it wasn't clear when that was true). I've tried to clean up such things when I've encountered them.
A third part of the trouble is that there's too little by way of a global overview of the distro, or its development tools. This page is aimed at remedying that.
There are four areas that distinguish Linux distros from each other.
- The initial design choices
What makes Alpine distinctive is summarized on the About page. This includes applying the grsec/PaX patches to the kernel (though you can also compile and use a custom kernel, configured as you like). It also includes the choice of uClibc, and BusyBox for the core utilities. These choices tend to make Alpine especially minimalist and secure: as the About page says, it's "designed for x86 Routers, Firewalls, VPNs, VoIP and servers." (Alpine is a perfectly workable desktop system, too. The shortcomings just have to do with the small community, and that sometimes you may need to get your hands dirty modifying scripts written with more mainstream desktop distros in mind. So you probably won't want to use Alpine if you're a newcomer to Linux. If you're already comfortable with another distro, though, especially a power-user, less-hand-holding distro like ArchLinux or Gentoo, you should do fine.)
Another distinctive part of Alpine is its variety of "installation modes." It can be installed to a hard disk/SSD/other storage medium like any other distro; this is called the sys mode. The storage medium in question can be removable, if you like, so long as you can configure your machine to boot from it. However, if you're working with removable media, there are two other installation modes you might consider. In each of these modes, you will boot your machine from a static ISO image (either a CD or a USB partition configured like the CD). You will also need a writable medium to save updates to the system. In the diskless mode, this writable medium is typically a small USB key (or a second USB partition) that holds the changes you want to persist. Both the base Alpine system and all your changes will be unpacked into a memory-based filesystem. The other, data mode is for cases where you're dealing with a large amount of persisting data, that you want to keep on a hard disk/SSD/other storage medium, rather than unpacking into memory. The default setup here is to store your /var partition directly on the hard storage medium. But as in the diskless mode, your root system still comes from a static ISO image.
Key to the second and third modes is Alpine's lbu utility. This tracks which files you've modified from their static ISO version, and want the changes to persist. The lbu utility saves those changes in .apkovl "overlay" files (these are essentially tar-gzip archives, though they can also be encrypted).
You can use the lbu utility with the sys mode, too, if you like: as a form of backup, or to configure overlay files for other systems. But for a robust incremental backup system, you'll probably want a more specialized tool. (Such as rsnapshot, which is a perl wrapper around .)
The lbu utility is part of thepackage, which is required by .
Another distinctive part of a Linux distro is its default bootloader. In Alpine's case this is, or its companions
- The installer scripts
In Alpine's case, the installer consists of the /sbin/setup-* scripts, which are also part of the package.
A base Alpine install will include only these packages and their dependencies:
- or another kernel package
Depending on your installation choices, you may also have:
or other such packages. Everything else is up to you to install.
- The init system
An "init system" includes several different components. First, there is the initramfs loaded by the bootloader. Alpine's tool for generating these is /sbin/mkinitfs, part of the package, which is required by Alpine's kernel packages and by its package. This tool's settings are read from /etc/mkinitfs/*, and it installs the initscript /usr/share/mkinitfs/initramfs-init into the initramfs.
Second, Alpine uses OpenRC to handle the rest of its initscripts. The base framework of this is in the package, which is required by .
- The packaging and development systems
The last important distinguishing feature of a Linux distro is its packaging and development systems.
- , mentioned above, rebuilds Alpine's initramfs, like Arch's "mkinitcpio"
- apk from Alpine Linux package management is Alpine's package manager, like Arch's "pacman"; see
- Abuild and Helpers is Alpine's build utility, like Arch's "makepkg"; see
- Alpine's package-building scripts are named APKBUILD, like Arch's "PKGBUILD"
What Alpine borrows from Gentoo and FreeBSD is a tree of all the package-building scripts. We call this our Aports tree, and we keep it as a git repository. (Compare Gentoo's "Portage" and FreeBSD's "ports". You can setup something similar with Arch's "abs", but it's not as tightly integrated with their package manager and build utilities.)
If you're only planning to install packages on a given system, and not do any development there, then the only pieces of this you'll need are Developer Documentation.and , both included in a base Alpine install. If you do plan to do development, install , which includes gcc, git, abuild, and the like, and see