Skip to content

Instantly share code, notes, and snippets.

@JPenuchot
Forked from mattiaslundberg/arch-linux-install
Last active April 3, 2021 12:11
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save JPenuchot/f7ea84c487a8f306aad3f05a62bc5b36 to your computer and use it in GitHub Desktop.
Arch install. Up-to-date.

Arch install. Up-to-date.

Simple instructions for an Arch install with encrypted root partition. Bootloader and kernel partitions aren't encrypted.

Network setup

Do whatever is necessary to be able to ping 1.1.1.1. iwctl for wi-fi as of today.

Base filesystem

fdisk /dev/sdX
  • 512MB EFI partition
  • 512MB boot partition
  • 100% FREE for LUKS
mkfs.vfat -F32 /dev/sdX1
mkfs.ext2 /dev/sdX2

Encrypted filesystem

This creates one partion for root, modify if /home or other partitions should be on separate partitions.

# Cryptsetup
cryptsetup luksFormat /dev/sdX3
cryptsetup luksOpen /dev/sdX3 luks

# LVM2
pvcreate /dev/mapper/luks
vgcreate archvg /dev/mapper/luks
lvcreate --size 16G archvg --name swap
lvcreate -l +100%FREE archvg --name root

mkfs.ext4 /dev/archvg/root
mkswap /dev/archvg/swap

Then mount it:

swapon /dev/archvg/swap

mount /dev/archvg/root /mnt

mkdir /mnt/boot
mount /dev/sdX2 /mnt/boot

mkdir /mnt/boot/efi
mount /dev/sdX1 /mnt/boot/efi

Base components setup

pacstrap /mnt linux linux-firmware lvm2 dhcpcd intel-ucode base base-devel grub-efi-x86_64 zsh vim git efibootmgr dialog

fstab creation

genfstab -pU /mnt >> /mnt/etc/fstab
vim /mnt/etc/fstab

Change relatime on all non-boot partitions to noatime (reduces wear if using an SSD). Make /tmp a ramdisk by adding the following line to /mnt/etc/fstab:

tmpfs /tmp  tmpfs defaults,noatime,mode=1777  0	0

Enter the new system

arch-chroot /mnt /bin/bash

system clock

ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime
hwclock --systohc --utc

hostname

echo MYHOSTNAME > /etc/hostname

locale setup (don't miss this one if you don't want character display glitches)

echo LANG=en_US.UTF-8 >> /etc/locale.conf
echo LANGUAGE=en_US >> /etc/locale.conf
echo LC_ALL=C >> /etc/locale.conf

Uncomment proper locale in /etc/locale.gen then:

locale-gen

root password

passwd

mkinitcpio

vim /etc/mkinitcpio.conf

Add encrypt and lvm2 to HOOKS before filesystems.

mkinitcpio -p linux

GRUB setup

grub-install
vim /etc/default/grub

Set GRUB_CMDLINE_LINUX to GRUB_CMDLINE_LINUX="cryptdevice=/dev/sdX3:luks:allow-discards".

grub-mkconfig -o /boot/grub/grub.cfg

??? Profit

You're all set, you can now reboot and log as root to set up users and a graphical environment if you want one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment