This script automates the installation of Alpine Linux with full disk encryption using LUKS2 and BTRFS filesystem with subvolumes.
Inspired by: easy-arch
- Full Disk Encryption: Uses LUKS2 for secure disk encryption
- BTRFS Filesystem: Modern filesystem with subvolumes for better organization
- UEFI Support: Creates proper EFI boot partition
- Microcode Installation: Automatically detects and installs AMD or Intel microcode
- ZRAM Configuration: Sets up compressed RAM for better performance
- Snapshot Support: Configures snapper for system snapshots (edge version only)
- Rolling Release Option: Choose between stable or edge (rolling) Alpine version
- Boot from Alpine Linux installation media
- UEFI-capable system
- Internet connection
- At least 4GB of disk space (recommended: 20GB+)
-
Initial Setup:
setup-alpine
-
Stop at Disk Installation: When you reach the step "Disk & Install", press
CTRL+Cto exit setup-alpine. -
Run the Installation Script:
chmod +x alpine-install.sh ./alpine-install.sh
-
Follow the Prompts:
- Enter a strong password for LUKS encryption (you'll need to confirm it)
- Choose between stable or edge (rolling) Alpine version
- Select the target disk for installation
- Creates GPT partition table
- 300MB EFI partition (FAT32)
- Remaining space for encrypted root partition
- Creates LUKS2 container with PBKDF2 (500,000 iterations)
The script creates the following subvolumes for better organization:
@- Root filesystem@snapshots- System snapshots@var/cache- Package cache@var/log- System logs@home- User home directories@root- Root user home@opt- Optional software
- Installs CPU-specific microcode (AMD/Intel)
- Configures ZRAM (compressed swap in RAM)
- Enables BTRFS scanning service
- Sets up snapper for snapshots (edge version only)
After rebooting into your new Alpine Linux system:
Install the APK snapshot tool:
apk add apk-snapYou'll be prompted to enter your LUKS password during boot to unlock the encrypted disk.
- SSH Installation: For easier installation, you can enable SSH during
setup-alpineand run the script remotely - Password Security: Choose a strong password for LUKS encryption - this protects all your data
- Backup: Consider backing up your LUKS header after installation:
cryptsetup luksHeaderBackup /dev/sdX2 --header-backup-file luks-header-backup
Warning: This script will completely wipe the selected disk. Ensure you have backups of any important data before proceeding.
This project is licensed under the Apache License v2.0 - see the LICENSE file for details.