✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Alpine Linux Installation

Alpine Linux Installation is a lightweight OS setup process focused on minimalism, efficiency, and security through containerization and package management.

Alpine Linux Installation refers to the process of setting up the Alpine Linux operating system on a target machine or virtual environment. This installation involves preparing the hardware or virtual resources, selecting the appropriate installation media, configuring system parameters, partitioning and formatting storage devices, installing the base system, and performing initial system setup to create a functional Alpine Linux environment. The installation is designed to be minimal, secure, and efficient, suitable for servers, containers, embedded systems, and lightweight desktop setups.


Installation Requirements

Hardware and System Requirements

Alpine Linux has modest hardware requirements, making it suitable for a wide range of machines from older hardware to modern servers. At minimum, the system requires:

  • A processor with an x86, x86_64, ARM, or other supported architecture.
  • At least 256 MB of RAM (512 MB or more recommended for smoother operation).
  • A storage device with sufficient space, typically 2 GB or more depending on installed packages and use case.

Network and Boot Requirements

  • A network connection is recommended for package retrieval and system updates.
  • The system firmware should support booting from the chosen installation media (USB, CD-ROM, PXE network boot).
  • The system may boot in BIOS (Legacy) or UEFI mode, with UEFI recommended for modern hardware.

Alpine Installation Images

Types of Installation Images

Alpine Linux provides several types of installation images tailored to different installation scenarios:

  • Standard ISO Image: A full installation ISO suitable for CD/DVD or USB boot, containing the base system and the setup scripts.
  • Extended Image: Contains additional packages and tools beyond the minimal installation.
  • Mini ISO: A minimal network bootable ISO that downloads packages during installation, reducing initial download size.
  • Virtual Machine Images: Pre-built images for virtualization platforms like VMware, VirtualBox, and cloud environments.

Selecting the Appropriate Image

The choice depends on the target environment, network availability, and installation preferences. For offline installation, the Standard or Extended ISO is preferred. For automated or network-based installation, Mini ISO or PXE boot is suitable.


Installation Media Preparation

Creating Bootable Media

To install Alpine Linux, the selected ISO image must be written to a bootable medium:

  • USB Drive: Use tools like dd on Linux/macOS or Rufus on Windows to write the ISO to a USB flash drive.
  • CD/DVD: Burn the ISO to optical media using appropriate software.
  • Network Boot: Configure PXE infrastructure to serve Alpine installation files.

Verifying Media Integrity

It is important to verify the checksum (SHA256 or MD5) of the downloaded ISO image against the official Alpine Linux signature to ensure authenticity and integrity.


Installation Environment

Booting into the Installation Environment

Upon booting from the prepared media, the Alpine Linux bootloader presents options to start the live environment or installation process. The live environment provides a minimal shell and utilities for manual or scripted installation.

Live Environment Features

  • A minimal Alpine system with BusyBox utilities.
  • Networking tools for configuring interfaces.
  • The setup-alpine script to guide the installation process.
  • Disk partitioning and formatting tools.

setup-alpine Script

Purpose and Overview

setup-alpine is an interactive script designed to automate the Alpine Linux installation and configuration. It guides the user through key steps such as keyboard layout, network setup, disk partitioning, root password setup, and package selection.

Core Steps in setup-alpine

  • Keyboard Layout Configuration: Selects the preferred keyboard mapping.
  • Network Configuration: DHCP or static IP setup.
  • Hostname and Domain: Setting the system hostname and domain name.
  • Mirror Selection: Choosing a package repository mirror for downloading packages.
  • Disk Setup: Partitioning, formatting, and mounting the target disk.
  • Root Password: Setting the root user password.
  • Package Installation: Installing the base system and optional packages.
  • Bootloader Installation: Installing and configuring GRUB or other bootloader.
  • Timezone and Clock: Selecting the system timezone and clock settings.

System Disk Installation

Partitioning and Filesystem Setup

  • The installer typically uses fdisk, cfdisk, or parted to create partitions.
  • Common partition schemes include:
    • A root partition formatted with ext4 or other supported filesystems.
    • Optionally, a separate boot partition.
    • Swap partition or swap file if desired.
  • Filesystems supported include ext4, xfs, btrfs, and others, depending on user preference.

Mounting and Installing the Base System

  • The target partitions are mounted under /mnt.
  • The setup-alpine script installs the base Alpine system into the mounted root partition.
  • Configuration files such as /etc/fstab are created or updated.

Manual Installation

When to Use Manual Installation

Manual installation is used when custom partitioning, special configurations, or automated scripts are required beyond what setup-alpine offers.

Manual Installation Steps

  • Boot into the live environment.
  • Manually partition disks using fdisk, parted, or cfdisk.
  • Format partitions with chosen filesystems.
  • Mount partitions in the desired mount points under /mnt.
  • Use apk to bootstrap the base system:
apk add --root /mnt alpine-base
  • Chroot into the installed system for configuration:
chroot /mnt /bin/sh
  • Install and configure the bootloader manually.
  • Set up network, users, and other system settings.

Boot Mode Selection

BIOS vs UEFI Boot

  • Alpine Linux supports installation in both BIOS and UEFI modes.
  • UEFI is recommended for newer hardware, providing faster boot and secure boot options.
  • The bootloader installation differs:
    • GRUB or Syslinux for BIOS.
    • GRUB with EFI support or systemd-boot for UEFI.

Configuring Bootloader

  • The installer or manual process installs the bootloader to the disk's MBR or EFI partition.
  • Configuration files are generated to enable system start-up.

Installation Verification

Post-Installation Checks

  • Reboot the system and confirm successful boot into Alpine Linux.
  • Verify network connectivity.
  • Check installed packages and system logs.
  • Validate disk partitioning and mounting:
mount | grep "^/dev"
  • Ensure the correct kernel and bootloader are in use.
  • Confirm user accounts and permissions.

The Alpine Linux Installation process is designed to be flexible and efficient, allowing users to quickly deploy a secure and lightweight Linux system customized to their needs, whether for servers, containers, or embedded environments. Its utilities and scripts streamline setup while still supporting in-depth manual configuration.

Content in this section