Preparing USB stick

Refer to USB stick setup guide

Login

Input root and hit Enter to get started:

  ...

Welcome to Alpine Linux 3.21
Kernel 6.12.13-0-lts on an x86_64 (/dev/tty1)

localhost login: root
  

Keyboard Layout

  ~ $ setup-keymap

af    al    am    ara   at    az    ba    bd    be    bg    br    brai  by    ca    ch    cm    cn    cz    de    dk    dz    ee    
epo   es    fi    fo    fr    gb    ge    gh    gr    hr    hu    id    ie    il    in    iq    ir    is    it    jp    ke    kg    
kr    kz    la    latam lk    lt    lv    ma    md    me    mk    ml    mm    mt    my    ng    nl    no    nz    ph    pk    pl    
pt    ro    rs    ru    se    si    sk    sy    th    tj    tm    tr    tw    ua    us    uz    vn    

Select keyboard layout: [none] us

us-alt-intl            us-altgr-intl          us-chr                 us-colemak             us-colemak_dh          
us-colemak_dh_iso      us-colemak_dh_ortho    us-colemak_dh_wide     us-colemak_dh_wide_iso us-dvorak-alt-intl     
us-dvorak-classic      us-dvorak-intl         us-dvorak-l            us-dvorak-mac          us-dvorak-r            
us-dvorak              us-dvp                 us-euro                us-haw                 us-hbs                 
us-intl                us-mac                 us-norman              us-olpc2               us-rus                 
us-symbolic            us-workman-intl        us-workman             us                     

Select variant (or 'abort'): us
  

Hostname

Your hostname is your computer’s unique network name. Ensure it is distinct from other devices in your local network to avoid possible issues in the future.

  ~ $ setup-hostname nihon
  

Connect network

Timezone

  ~ $ setup-timezone

Africa/            Chile/             GB-Eire            Israel             Navajo             US/
America/           Cuba               GMT                Jamaica            PRC                UTC
Antarctica/        EET                GMT+0              Japan              PST8PDT            Universal
Arctic/            EST                GMT-0              Kwajalein          Pacific/           W-SU
Asia/              EST5EDT            GMT0               Libya              Poland             WET
Atlantic/          Egypt              Greenwich          MET                Portugal           Zulu
Australia/         Eire               HST                MST                ROC                leap-seconds.list
Brazil/            Etc/               Hongkong           MST7MDT            ROK                posixrules
CET                Europe/            Iceland            Mexico/            Singapore
CST6CDT            Factory            Indian/            NZ                 Turkey
Canada/            GB                 Iran               NZ-CHAT            UCT

Which timezone are you in? (or '?' or 'none') [UTC] Asia
Aden           Barnaul        Dili           Jayapura       Kuwait         Pontianak      Srednekolymsk  Urumqi
Almaty         Beirut         Dubai          Jerusalem      Macao          Pyongyang      Taipei         Ust-Nera
Amman          Bishkek        Dushanbe       Kabul          Macau          Qatar          Tashkent       Vientiane
Anadyr         Brunei         Famagusta      Kamchatka      Magadan        Qostanay       Tbilisi        Vladivostok
Aqtau          Calcutta       Gaza           Karachi        Makassar       Qyzylorda      Tehran         Yakutsk
Aqtobe         Chita          Harbin         Kashgar        Manila         Rangoon        Tel_Aviv       Yangon
Ashgabat       Choibalsan     Hebron         Kathmandu      Muscat         Riyadh         Thimbu         Yekaterinburg
Ashkhabad      Chongqing      Ho_Chi_Minh    Katmandu       Nicosia        Saigon         Thimphu        Yerevan
Atyrau         Chungking      Hong_Kong      Khandyga       Novokuznetsk   Sakhalin       Tokyo
Baghdad        Colombo        Hovd           Kolkata        Novosibirsk    Samarkand      Tomsk
Bahrain        Dacca          Irkutsk        Krasnoyarsk    Omsk           Seoul          Ujung_Pandang
Baku           Damascus       Istanbul       Kuala_Lumpur   Oral           Shanghai       Ulaanbaatar
Bangkok        Dhaka          Jakarta        Kuching        Phnom_Penh     Singapore      Ulan_Bator

What sub-timezone of 'Asia' are you in? (or '?') Kuwait
  

Setup repositories

To find fastest mirror and enable community repo:

  ~ $ setup-apkrepos -f -c
  

If you want to edit manually, simply enter:

  ~ $ vi /etc/apk/repositories
  

For manual editing may also help Official Alpine Linux mirror list.

Root password

Follow instructions after executing:

  ~ $ passwd
  

NTP

We will use internal NTP for convenience:

  ~ $ setup-ntp busybox
  

Partitioning

We need to install necessary packages for partitioning, filesystem, bootloader and so forth:

  ~ $ apk add lsblk gptfdisk cryptsetup lvm2 efibootmgr e2fsprogs btrfs-progs grub grub-efi
  

Load new partitions to /dev

  ~ $ partprobe /dev/nvme0n1
  

Configuring LUKS2

Create new LUKS2 partition:

  ~ $ cryptsetup luksFormat -v -c aes-xts-plain64 -s 512 \
        --hash sha512 --pbkdf argon2id --iter-time 1000 \
        --use-random /dev/nvme0n1p3
  

Open it:

  ~ $ cryptsetup luksOpen /dev/nvme0n1p3 lvmcrypt
  

Physical & Logical Volumes

A common recommendation is to allocate SWAP partition space equal to your RAM size (for working hibernation), but not lower than 8GB.

For root partition it is recommended to use at least 16GB on installation with GNOME Desktop. Enter value you sure be enough and leave other space for separated /home.

  ~ $ pvcreate /dev/mapper/lvmcrypt
    Physical volume "/dev/mapper/lvmcrypt" successfully created.

~ $ vgcreate vg /dev/mapper/lvmcrypt
    Volume group "vg" successfully created

~ $ lvcreate -L 32G vg -n swap
    Logical volume "swap" created.

~ $ lvcreate -L 100G vg -n root
    Logical volume "root" created.

~ $ lvcreate -l 100%FREE vg -n home
    Logical volume "home" created.
  

Small verification if everything is OK:

  ~ $ lvscan
      ACTIVE          '/dev/vg/swap' [32.00 GiB] inherit
      ACTIVE          '/dev/vg/root' [100.00 GiB] inherit
      ACTIVE          '/dev/vg/home' [355.92 GiB] inherit
  

File Systems

Create VFAT file system for UEFI partition:

  ~ $ mkfs.vfat /dev/nvme0n1p1
  

Create EXT4 file system for /boot:

  ~ $ mkfs.ext4 /dev/nvme0n1p2
  

Create BTRFS file system for /:

  ~ $ mkfs.btrfs /dev/vg/root
  

Create BTRFS file system for /home:

  ~ $ mkfs.btrfs /dev/vg/home
  

Create SWAP:

  ~ $ mkswap /dev/vg/swap 
  

Mount Points

Mount root partition to /mnt :

  ~ $ mount -t btrfs /dev/vg/root /mnt
  

Create /mnt/home dir:

  ~ $ mkdir /mnt/home
  

Mount home partition to /mnt/home :

  ~ $ mount -t btrfs /dev/vg/home /mnt/home
  

Create /mnt/boot dir:

  ~ $ mkdir /mnt/boot
  

Mount /boot:

  ~ $ mount -t ext4 /dev/nvme0n1p2 /mnt/boot
  

Create /boot/efi dir:

  ~ $ mkdir /mnt/boot/efi
  

Mount UEFI partition to /mnt/boot/efi:

  ~ $ mount -t vfat /dev/nvme0n1p1 /mnt/boot/efi
  

Check partition scheme:

  ~ $ lsblk
nvme0n1        259:0    0 476.9G  0 disk  
├─nvme0n1p1    259:1    0   511M  0 part  /mnt/boot/efi
├─nvme0n1p2    259:2    0     1G  0 part  /mnt/boot/
└─nvme0n1p3    259:3    0 476.4G  0 part  
  └─lvmcrypt   253:0    0 476.4G  0 crypt 
    ├─vg-swap 253:1    0    32G  0 lvm
    ├─vg-root 253:2    0   100G  0 lvm   /mnt
    └─vg-home 253:3    0 356.4G  0 lvm   /mnt/home
  

Installing Alpine

As simple as

  ~ $ setup-disk -m sys /mnt
  

GRUB settings

Let’s mount and chroot to our fresh installation:

  ~ $ mount -t proc /proc /mnt/proc
~ $ mount --rbind /dev /mnt/dev
~ $ mount --make-rslave /mnt/dev
~ $ mount --rbind /sys /mnt/sys
~ $ chroot /mnt
  

To open configuration file, enter

  ~ $ vi /etc/default/grub
  

and then hit i on the keyboard.

Add new GRUB_PRELOAD_MODULES line to config:

  ...
GRUB_PRELOAD_MODULES="luks cryptodisk part_gpt lvm"
  

Add new cryptodisk parameter:

  ...
GRUB_PRELOAD_MODULES="luks cryptodisk part_gpt lvm"
GRUB_ENABLE_CRYPTODISK=y
  

To save file, press ESC then write :wq and hit Enter.

BTRFS

Tell Alpine to load module on startup:

  ~ $ echo btrfs >> /etc/modules
  

Now enable BTRFS scan service

  ~ $ rc-update add btrfs-scan boot
  

SWAP

Open fstab

  ~ $ vi /etc/fstab
  

Add swap partition (highlighted line) into fstab

  /dev/vg/root	/	btrfs	rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/ 0 1
/dev/vg/home	/home	btrfs	rw,relatime,ssd,space_cache=v2,subvolid=5,subvol=/ 0 2
/dev/vg/swap    none    swap    defaults                                           0 0
...
  

Also enable swap service

  ~ $ rc-update add swap boot
  

GNOME

First, reboot to test changes

To exit chroot enter

  ~ $ exit
  

Then reboot

  ~ $ reboot
  

And then install & setup GNOME: refer to GNOME setup guide

Last updated 30 Mar 2025, 00:20 +03 . history