Last active
October 9, 2021 17:08
-
-
Save yakimka/39c5b9428366b4564f0896a23b077312 to your computer and use it in GitHub Desktop.
Instructions for installing Arch Linux on an UEFI system with LUKS and systemd-boot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Connect to the internet | |
dhcpcd # или wifi-menu | |
# Create partitions | |
cgdisk /dev/sdX | |
1 550MiB Boot partition # Set type EFI system | |
2 100% size partiton # (to be encrypted) Hex code 8300 | |
mkfs.vfat -n BOOT -F32 /dev/sdX1 | |
# Setup the encryption of the system | |
cryptsetup -c aes-xts-plain64 -y --use-random luksFormat /dev/sdX2 | |
cryptsetup luksOpen /dev/sdX2 luks | |
# If you need to change password | |
# cryptsetup luksChangeKey /dev/sdX2 | |
# Create encrypted partitions | |
pvcreate /dev/mapper/luks | |
vgcreate vg0 /dev/mapper/luks | |
lvcreate --size 8G vg0 --name swap | |
lvcreate --size 62G vg0 --name root | |
lvcreate -l +100%FREE vg0 --name home | |
# Create filesystems on encrypted partitions | |
mkfs.xfs -L root /dev/mapper/vg0-root | |
mkfs.xfs -L home /dev/mapper/vg0-home | |
mkswap /dev/mapper/vg0-swap | |
# Mount the new system | |
mount /dev/mapper/vg0-root /mnt # /mnt is the installed system | |
swapon /dev/mapper/vg0-swap | |
mkdir /mnt/{boot,home} | |
mount /dev/sdX1 /mnt/boot | |
mount /dev/mapper/vg0-home /mnt/home | |
# Edit mirrorlist | |
nano /etc/pacman.d/mirrorlist | |
# Install the system also includes stuff needed for starting wifi when first booting into the newly installed system | |
pacstrap -i /mnt base base-devel linux linux-firmware xfsprogs lvm2 dialog wpa_supplicant net-tools zsh intel-ucode wifi-menu dhcpcd nano | |
# 'install' fstab | |
genfstab -pU /mnt >> /mnt/etc/fstab | |
# Change relatime on all non-boot partitions to noatime (reduces wear if using an SSD) (maybe add discard flag (for trim)?) | |
# Enter the new system | |
arch-chroot /mnt | |
# Set hostname | |
echo HOSTNAME > /etc/hostname | |
# Generate locales | |
nano /etc/locale.gen # uncomment needed locales | |
locale-gen | |
# Update locale | |
echo LANG=en_US.UTF-8 >> /etc/locale.conf | |
echo LANGUAGE=en_US >> /etc/locale.conf | |
echo LC_ALL=C >> /etc/locale.conf | |
# Setup system clock | |
ln -sf /usr/share/zoneinfo/Europe/Kiev /etc/localtime | |
# Edit pacman.conf | |
nano /etc/pacman.conf | |
# Uncomment multilib section | |
# Add archlinuxfr repo | |
[archlinuxfr] | |
SigLevel = Never | |
Server = http://repo.archlinux.fr/$arch | |
# Configure mkinitcpio with modules needed for the initrd image | |
nano /etc/mkinitcpio.conf | |
# Add 'xfs' to MODULES | |
# Add 'encrypt' and 'lvm2' to HOOKS before filesystems | |
# Regenerate initrd image | |
mkinitcpio -p linux | |
# Set password for root | |
passwd | |
# Add user | |
groupadd username | |
useradd -m -g username -G users,wheel,audio,lp,sys,optical,power,storage,video,games,uuidd -s /bin/zsh username | |
# Set password for user | |
passwd username | |
# Edit sudoers file | |
EDITOR=nano visudo # uncomment %wheel ALL=(ALL) ALL | |
# Configure systemd-boot | |
bootctl --path=/boot install | |
cat /boot/loader/entries/arch.conf | |
title Arch Linux | |
linux /vmlinuz-linux | |
initrd /intel-ucode.img | |
initrd /initramfs-linux.img | |
options cryptdevice=/dev/sdX2:luks:allow-discards resume=/dev/mapper/vg0-swap root=/dev/mapper/vg0-root rw quiet | |
cat /boot/loader/loader.conf | |
default arch | |
# reboot | |
exit | |
umount /mnt/{boot,home} | |
umount /mnt | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment