setup-alpine
When prompted to select the disk for installation, press Ctrl+C
to cancel the guided installation process.
apk add cryptsetup e2fsprogs btrfs-progs dosfstools parted mkinitfs
Create a EFI
and Luks
partition
parted /dev/sdX -a optimal
mklabel gpt
mkpart primary fat32 0% 200M
name 1 esp
set 1 esp on
mkpart primary btrfs 200M 100%
name 2 luks
cryptsetup luksFormat /dev/sdX2
cryptsetup luksOpen /dev/sdX2 luks
btrfs rescue create-control-device
mkfs.btrfs /dev/mapper/luks
mount -t btrfs /dev/mapper/luks /mnt
btrfs sub create /mnt/root
btrfs sub create /mnt/home
btrfs sub create /mnt/var
umount /mnt
mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=root /dev/mapper/luks /mnt
mkdir -p /mnt/home
mkdir -p /mnt/var
mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=home /dev/mapper/luks /mnt/home
mount -o noatime,nodiratime,compress=zstd,space_cache=v2,ssd,subvol=var /dev/mapper/luks /mnt/var
mkfs.fat -F32 /dev/sdX1
mkdir -p /mnt/boot
mount -t vfat /dev/sdX1 /mnt/boot
setup-disk -m sys /mnt/
Edit /mnt/etc/mkinitfs/mkinitfs.conf
and add cryptsetup
to the features.
Rebuild initramfs
mkinitfs -c /mnt/etc/mkinitfs/mkinitfs.conf -b /mnt $(ls /mnt/lib/modules/)
Mount necessary partitions
mount -t proc /proc /mnt/proc
mount --rbind /dev /mnt/dev
mount --make-rslave /mnt/dev
mount --rbind /sys /mnt/sys
Chroot on installation directory
chroot /mnt
source /etc/profile
export PS1="(chroot) $PS1"
Install necessary packages
apk add grub grub-efi efibootmgr
Edit /etc/default/grub
and modify GRUB_CMDLINE_LINUX_DEFAULT
GRUB_CMDLINE_LINUX_DEFAULT="... cryptroot=UUID=<UUID of /dev/sdX2> cryptdm=luks rootflags=subvol=root rootfstype=btrfs"
Install grub
grub-install --target=x86_64-efi --efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg
Hi look at my fork, i fixed typo in line 16 and added btrfs rescue create-control-device because mkfs.btrfs got error if u can add it to main gist