Alpine Linux:Overview: Difference between revisions

From Alpine Linux
No edit summary
(use https)
 
(16 intermediate revisions by 9 users not shown)
Line 1: Line 1:
Alpine uses [http://musl-libc.org/ muslc] as libc, and [https://en.wikipedia.org/wiki/BusyBox BusyBox] as core utilities. These choices tend to make Alpine especially minimalist and secure.  
Alpine uses [https://musl.libc.org/ musl] as its libc, and [https://en.wikipedia.org/wiki/BusyBox BusyBox] as core utilities. These choices tend to make Alpine especially minimalist and secure.  


== Overall overview ==
== General overview ==


Alpine are one (or almost the one) with '''more faster boot time start up''' operating system.
Alpine Linux has one of the '''fastest boot times''' of any operating system.


Famous because of its small size, it's '''heavily used in containers'''.
It's famous because of its small size and it's '''heavily used in containers'''.


Also more famous due its '''widely used for embedded devices''' and as '''based work for many enterprise routers as main base system''' to develop those. The postmarketOS project which is designed to run on mobile devices is based on Alpine Linux.
It's also well known for '''wide use in embedded devices''' and as a '''base system for many enterprise routers'''.


=== So distinctive ===
The postmarketOS project, which is designed to run on mobile devices, is based on Alpine Linux.


Alpine Linux as '''the SSS distro: Simple+Small+Secure''': due usage of [http://musl-libc.org/ muslc] as the minimalist libc, BusyBox simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also) and userland binaries compiled as Position Independent Executables (PIE) with stack smashing protection.
=== Distinctive ===


=== So efficient ===
Alpine Linux follows the principles of '''the SSS distro: Simple+Small+Secure''': due to usage of [https://musl.libc.org/ muslc] as the minimalist libc, BusyBox simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also) and userland binaries compiled as Position Independent Executables (PIE) with stack smashing protection.


Some obvious reasons:
=== Efficient ===


# Usage of [http://musl-libc.org/ muslc] as the minimalist libc
Some main reasons:
# Its own package manager called {{Pkg|apk}},  
 
# the {{Pkg|openrc}} init system, script driven set-ups and that’s it!
# Usage of [https://musl.libc.org/ musl] as the minimalist libc
# {{Pkg|busybox}} simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also)
# Its own package manager called [[Alpine Package Keeper|apk]],  
# The {{Pkg|openrc}} init system, script driven set-ups and that’s it!
# {{Pkg|busybox}}: simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also)


This provides you with a simple, '''crystal-clear Linux environment without all the noise''', nothing else will get in the way.
This provides you with a simple, '''crystal-clear Linux environment without all the noise''', nothing else will get in the way.


=== So Secure ===
=== Secure ===


All userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection.
All userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection.
Line 31: Line 33:


<ol>
<ol>
</li><li>'''The design OS'''
</li><li>'''The OS design'''


<p>Alpine '''uses Linux as kernel OS''', and their focus are '''SSS distribution, Simple Small and Secure'''</p>
<p>Alpine uses '''Linux''' as [https://www.kernel.org/ OS kernel], and has a focus on '''SSS distribution, Simple Small and Secure'''</p>


<p>Due the prevously, it supports variety of architectures like:
<p>A variety of architectures are officially supports:
* '''x86_64''': The popular AMD64 compatible 64-bit x86 based machines, i386 are not recommended for newer/lasted hardware.
* '''x86_64''': The popular AMD64 compatible 64-bit x86 based machines, i386 are not recommended for newer/latest hardware.
* '''s390x''': For the Super powered IBM mainframes, especially IBM Z and IBM LinuxONE servers.
* '''ppc64le''': For the PowerPC devices with pure little-endian mode, mostly for POWER8 and POWER9
* '''x86''': (i386 pc 32bit) and x86_64 (i686 pc 64bit and amd64)
* '''x86''': (i386 pc 32bit) and x86_64 (i686 pc 64bit and amd64)
* '''armhf''': The newer ARM hard-float for newer, more powerful 32-bit devices alongside 64-bit
* '''armhf''': The newer ARM hard-float for newer, more powerful 32-bit devices alongside 64-bit
* '''armv7''': The 32-bit ARM only execution state of the ARMv7 devices machines.
* '''armv7''': The 32-bit ARM only execution state of the ARMv7 devices machines.
* '''aarch64''': The 64-bit ARM only execution state of the ARMv8 device machines.
* '''aarch64''': The 64-bit ARM only execution state of the ARMv8 device machines.
* '''ppc64le''': for 64-bit big-endian PowerPC and Power ISA processors like some MAC computers.
* '''ppc64le''': For 64-bit PowerPC devices with pure little-endian mode, mostly for POWER8 and POWER9.
* '''s390x''': for Server for IBM Z and LinuxONE mainframes.
* '''s390x''': For IBM Z mainframes, especially IBM Z and IBM LinuxONE.


<p>It [[Alpine newbie install manual|can be installed]] to a hard disk/SSD/other storage medium like any other distro; (sys mode). The storage medium in question can be any block device (USB, Flash, SDD, HDD). Always in start, the base Alpine system and all your changes will be unpacked into a memory-based filesystem. If run some install script process (data mode) will keep your setup 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.  
<p>Alpine can be installed to a hard disk/SSD/other storage medium like any other distro; (sys mode). The storage medium in question can be any block device (USB, Flash, SDD, HDD). Always in start, the base Alpine system and all your changes will be unpacked into a memory-based filesystem. If run some install script process (data mode) will keep your setup 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.  
</p>
</p>


Line 53: Line 53:
<p>In Alpine's case, '''the installer consists of the {{Path|/sbin/setup-*}} scripts''', which are also part of the {{Pkg|alpine-conf}} package.
<p>In Alpine's case, '''the installer consists of the {{Path|/sbin/setup-*}} scripts''', which are also part of the {{Pkg|alpine-conf}} package.


</p><p>'''A base Alpine install will include only needed packages''' such like {{Pkg|alpine-base}}, {{Pkg|syslinux}}, {{Pkg|linux-vanilla}} (or another kernel package), and depending of purpose some like {{Pkg|openssh}}/{{Pkg|chrony}}.
</p><p>'''A base Alpine install will include only needed packages''' such like {{Pkg|alpine-base}}, {{Pkg|syslinux}}, {{Pkg|linux-lts}} (or another kernel package), and depending of purpose some like {{Pkg|openssh}}/{{Pkg|chrony}}.


</p><p>Alpine's boot loader case this is {{Pkg|syslinux}}, or its companions <code>isolinux</code> or <code>extlinux</code>. Lasted releases has Grub and [[Alpine and UEFI|UEFI support]].</p>
</p><p>Alpine's boot loader case this is {{Pkg|syslinux}}, or its companions <code>isolinux</code> or <code>extlinux</code>. Latest releases have Grub and [[Alpine and UEFI|UEFI support]].</p>


</li><li>'''The init system'''
</li><li>'''The init system'''


<p>An "init system" includes several different components. First, there is the initramfs loaded by the bootloader. Alpine's tool for generating these is {{Path|/sbin/mkinitfs}}, part of the {{Pkg|mkinitfs}} package, which is required by Alpine's kernel packages and by its {{Pkg|syslinux}} package. This tool's settings are read from {{Path|/etc/mkinitfs/*}}, and it installs the initscript {{Path|/usr/share/mkinitfs/initramfs-init}} into the initramfs.
<p>An "init system" includes several different components. First, there is the initramfs, which is loaded by the bootloader. Alpine's tool for generating the initramfs is {{Path|/sbin/mkinitfs}}, part of the {{Pkg|mkinitfs}} package, which is required by Alpine's kernel packages and by its {{Pkg|syslinux}} package. This tool's settings are read from {{Path|/etc/mkinitfs/*}}, and it installs the initscript {{Path|/usr/share/mkinitfs/initramfs-init}} into the initramfs.


</p><p>Second, Alpine uses [[Alpine Linux Init System|OpenRC]] to handle the rest of its initscripts. The base framework of this is in the {{Pkg|openrc}} package, which is required by {{Pkg|alpine-conf}}.
</p><p>Second, Alpine uses [[Alpine Linux Init System|OpenRC]] to handle the rest of its initscripts. The base framework of this is in the {{Pkg|openrc}} package, which is required by {{Pkg|alpine-conf}}.
Line 68: Line 68:
<p>The last important distinguishing feature of a Linux distro is its packaging and development systems.
<p>The last important distinguishing feature of a Linux distro is its packaging and development systems.


</p><p>In Alpine's case, these are something a hybrid between [https://www.archlinux.org/ ArchLinux]'s, on the one hand, and [http://www.gentoo.org/ Gentoo] and [http://www.freebsd.org/ FreeBSD]'s, on the other. Our package-management and build utilities work much like Arch's:
</p><p>In Alpine's case, these are something a hybrid between [https://www.archlinux.org/ ArchLinux]'s, on the one hand, and [https://www.gentoo.org/ Gentoo] and [https://www.freebsd.org/ FreeBSD]'s, on the other. Our package-management and build utilities work much like Arch's:


* {{Pkg|mkinitfs}}, mentioned above, rebuilds Alpine's initramfs, like Arch's "mkinitcpio"
* {{Pkg|mkinitfs}}, mentioned above, rebuilds Alpine's initramfs, like Arch's "mkinitcpio"
Line 75: Line 75:
* Alpine's package-building scripts are named APKBUILD, like Arch's "PKGBUILD"
* Alpine's package-building scripts are named APKBUILD, like Arch's "PKGBUILD"


</p><p>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.)
</p><p>What Alpine borrows from Gentoo and FreeBSD is a tree of all the package-building scripts. It is called the [[Aports tree]], and is kept as a single git repository. (Compare Gentoo's "Portage" and FreeBSD's "ports". Something similar can be set up with Arch's "abs", but it's not as tightly integrated with their package manager and build utilities.)


</p><p>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 {{Pkg|mkinitfs}} and {{Pkg|apk-tools}}, both included in a base Alpine install. If you do plan to do development, install {{Pkg|alpine-sdk}}, which includes gcc, git, abuild, and the like, and see [[Developer Documentation]].
</p><p>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 {{Pkg|mkinitfs}} and {{Pkg|apk-tools}}, both included in a base Alpine install. If you do plan to do development, install {{Pkg|alpine-sdk}}, which includes gcc, git, abuild, and the like, and see [[Developer Documentation]].
Line 85: Line 85:


* [[Comparison with other distros]]
* [[Comparison with other distros]]
* [[Alpine newbie|Alpine for new users (how to start)]]
* [[Tutorials and Howtos]]
 
[[Category:Installation]]

Latest revision as of 02:36, 25 August 2023

Alpine uses musl as its libc, and BusyBox as core utilities. These choices tend to make Alpine especially minimalist and secure.

General overview

Alpine Linux has one of the fastest boot times of any operating system.

It's famous because of its small size and it's heavily used in containers.

It's also well known for wide use in embedded devices and as a base system for many enterprise routers.

The postmarketOS project, which is designed to run on mobile devices, is based on Alpine Linux.

Distinctive

Alpine Linux follows the principles of the SSS distro: Simple+Small+Secure: due to usage of muslc as the minimalist libc, BusyBox simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also) and userland binaries compiled as Position Independent Executables (PIE) with stack smashing protection.

Efficient

Some main reasons:

  1. Usage of musl as the minimalist libc
  2. Its own package manager called apk,
  3. The openrc init system, script driven set-ups and that’s it!
  4. busybox: simple coreutils (with possibilities to alternate on inflated original packages of each coreutils tools also)

This provides you with a simple, crystal-clear Linux environment without all the noise, nothing else will get in the way.

Secure

All userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection.

Technical overview

  1. The OS design

    Alpine uses Linux as OS kernel, and has a focus on SSS distribution, Simple Small and Secure

    A variety of architectures are officially supports:

    • x86_64: The popular AMD64 compatible 64-bit x86 based machines, i386 are not recommended for newer/latest hardware.
    • x86: (i386 pc 32bit) and x86_64 (i686 pc 64bit and amd64)
    • armhf: The newer ARM hard-float for newer, more powerful 32-bit devices alongside 64-bit
    • armv7: The 32-bit ARM only execution state of the ARMv7 devices machines.
    • aarch64: The 64-bit ARM only execution state of the ARMv8 device machines.
    • ppc64le: For 64-bit PowerPC devices with pure little-endian mode, mostly for POWER8 and POWER9.
    • s390x: For IBM Z mainframes, especially IBM Z and IBM LinuxONE.

    Alpine can be installed to a hard disk/SSD/other storage medium like any other distro; (sys mode). The storage medium in question can be any block device (USB, Flash, SDD, HDD). Always in start, the base Alpine system and all your changes will be unpacked into a memory-based filesystem. If run some install script process (data mode) will keep your setup 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.

  2. The installation

    In Alpine's case, the installer consists of the /sbin/setup-* scripts, which are also part of the alpine-conf package.

    A base Alpine install will include only needed packages such like alpine-base, syslinux, linux-lts (or another kernel package), and depending of purpose some like openssh/chrony.

    Alpine's boot loader case this is syslinux, or its companions isolinux or extlinux. Latest releases have Grub and UEFI support.

  3. The init system

    An "init system" includes several different components. First, there is the initramfs, which is loaded by the bootloader. Alpine's tool for generating the initramfs is /sbin/mkinitfs, part of the mkinitfs package, which is required by Alpine's kernel packages and by its syslinux 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 openrc package, which is required by alpine-conf.

  4. The packaging and development system

    The last important distinguishing feature of a Linux distro is its packaging and development systems.

    In Alpine's case, these are something a hybrid between ArchLinux's, on the one hand, and Gentoo and FreeBSD's, on the other. Our package-management and build utilities work much like Arch's:

    What Alpine borrows from Gentoo and FreeBSD is a tree of all the package-building scripts. It is called the Aports tree, and is kept as a single git repository. (Compare Gentoo's "Portage" and FreeBSD's "ports". Something similar can be set up 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 mkinitfs and apk-tools, both included in a base Alpine install. If you do plan to do development, install alpine-sdk, which includes gcc, git, abuild, and the like, and see Developer Documentation.

See Also