Arch linux personal installation

2021-11-09

TL;DR

Base(d) installation notes: UEFI, LVM, full disk encryption with LUKS.

1. Host

$ loadkeys us
$ timedatectl set-ntp true
$ fdisk -l /dev/sda

> *TARGET*
> /dev/sda1    2048    206847    204800   100M EFI System
> /dev/sda2  206848   2303999   2097152     1G Linux filesystem
> /dev/sda3 2204000 488397134 486093135 221.8G Linux filesystem

$ mkfs.fat -F32 /dev/sda1
$ mkfs.ext4 -m 1 -b 4096 /dev/sda2
$ cryptsetup luksFormat /dev/sda3
$ cryptsetup luksOpen /dev/sda3 cryptlvm
$ pvcreate /dev/mapper/cryptlvm
$ vgcreate ArchGroup /dev/mapper/cryptlvm
$ lvcreate -L 32G ArchGroup -n root
$ lvcreate -l 100%FREE ArchGroup -n home
$ mkfs.ext4 -m 1 -b 4096 /dev/ArchGroup/root
$ mkfs.ext4 -m 1 -b 4096 /dev/ArchGroup/home
$ mount /dev/ArchGroup/root /mnt
$ mkdir /mnt/home
$ mount /dev/ArchGroup/home /mnt/home
$ mkdir /mnt/boot
$ mount /dev/sda2 /mnt/boot
$ mkdir /mnt/boot/efi
$ mount /dev/sda1 /mnt/boot/efi
$ reflector --latest 20 --sort rate --country Germany,France,Italy --save /etc/pacman.d/mirrorlist
$ pacman -Syy
$ pacstrap /mnt base base-devel git linux linux-firmware vim grub lvm2 sudo intel-ucode ntfs-3g
$ genfstab -U /mnt >> /mnt/etc/fstab
$ arch-chroot /mnt

2. Chroot

$ ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
$ hwclock --systohc
$ vim /etc/locale.gen

> en_US.UTF-8

$ locale-gen
$ echo "LANGUAGE=en_US.UTF-8" > /etc/locale.conf
$ echo "KEYMAP=us" > /etc/vconsole.conf
$ echo "itsasecret" > /etc/hostname
$ vim /etc/mkinitcpio.conf

> HOOKS=(base udev autodetect keyboard keymap consolefont modconf block encrypt lvm2 filesystems fsck)

$ mkinitcpio -p linux
$ passwd
$ blkid /dev/sda3 | cut -d'"' -f2 >> /etc/default/grub
$ vim /etc/default/grub

> GRUB_CMDLINE_LINUX="cryptdevice=UUID=xxxxxxxxxxxxxxxx-xxxxxxxxx-xxx:cryptlvm:allow-discards root=/dev/ArchGroup/root"
> GRUB_DEFAULT=saved
> GRUB_SAVEDEFAULT=true
> GRUB_DISABLE_OS_PROBER=false

$ vim /etc/lvm/lvm.conf

> issue_discards = 1

$ pacman -S efibootmgr os-prober
$ grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB /dev/sda
$ grub-mkconfig -o /boot/grub/grub.cfg
$ cd /boot/efi/EFI/GRUB
$ mv grubx64.efi bootx64.efi
$ Ctrl^D