workspace/arch-platform/README.md
2025-04-20 21:36:44 +00:00

119 lines
3.1 KiB
Markdown

# arch-platform
## Introduction
This document describes disk partitioning and installation of the minimal Arch Linux system with LVM-in-LUKS, systemd-boot and network capabilities.
Created at 2022-05-22T23:58:54Z and not so well maintained as I rarely use it.
## Create installation medium
1. [Download](https://archlinux.org/download/) via torrent
2. Verify: `sha256sum <path> | grep <checksum>`
3. Find usb device name: `lsblk`
4. Create installation medium: `dd if=<path> of=/dev/<device> bs=1MiB`
## Install
1. Boot to USB image
2. On loader screen press `e`, append `nomodeset` the at end of `linux` commans
3. Partitioning: `parted <disk>` (see name via `lsblk`)
```
mklabel gpt
mkpart ESP fat32 1MiB 513MiB
set 1 boot on
mkpart primary ext4 514MiB 100%
quit
```
4. Encrypt & open:
```bash
cryptsetup luksFormat <disk>p2
cryptsetup luksOpen <disk>p2 <diskname>p2_crypt
```
5. Create volumes:
```bash
pvcreate /dev/mapper/<diskname>p2_crypt
vgcreate main /dev/mapper/<diskname>p2_crypt
lvcreate -L <RAM+2G>G main -n swap
lvcreate -L <N>G main -n root
lvcreate -l 100%FREE main -n home
```
6. Create FS:
```bash
mkfs.ext4 /dev/mapper/main-root
mkfs.ext4 /dev/mapper/main-home
mkswap /dev/mapper/main-swap
mkfs.fat -F32 /dev/<disk>p1
```
7. Mount:
```bash
mount /dev/mapper/main-root /mnt
mkdir /mnt/home /mnt/boot
mount /dev/mapper/main-home /mnt/home
mount /dev/nvme0n1p1 /mnt/boot
swapon /dev/mapper/main-swap
```
8. Wifi setup (if needed)
```bash
iwctl device list
iwctl station [device] connect [network_name]
```
9. Update keyring (iso may be too old): `pacman -Sy archlinux-keyring`
10. Install (for wifi you also need `networkmanager`):
```bash
pacstrap -i /mnt base linux linux-firmware intel-ucode lvm2 sudo vim polkit
```
11. Disks: `genfstab -U /mnt >> /mnt/etc/fstab`
12. Change root: `arch-chroot /mnt`
13. Add loader hooks: `vim /etc/mkinitcpio.conf`, set
```conf
HOOKS=(base udev autodetect microcode keyboard keymap modconf block encrypt lvm2 filesystems fsck)`
```
14. Make initrams: `mkinitcpio -p linux`
15. Install bootloader: `bootctl install --path=/boot`
16. Save disk UUID: `cryptsetup luksUUID /dev/<disk>p2 > /boot/loader/entries/arch.conf`
17. Make boot config: `vim /boot/loader/entries/arch.conf`
```conf
title Arch
linux /vmlinuz-linux
initrd /initramfs-linux.img
options quiet loglevel=3 cryptdevice=UUID=[uuid]:[disk_name]p2_crypt root=/dev/mapper/main-root rw resume=/dev/mapper/main-swap
```
18. Make generic boot config: `vim /boot/loader/loader.conf`, set `default arch`
19. Create sudo group: `groupadd -g 1000 sudo`
20. Grant privileges: `visudo`, uncomment or add line `%sudo ALL=(ALL:ALL) ALL`
21. Add user
```bash
groupadd -g 2000 <username>
useradd -m --groups sudo --gid 2000 --uid 2000 <username>
passwd <username>
```
22. `exit`, `reboot` into real system
23. login, `sudo su`
24. Uncomment locale in `/etc/locale.gen`, run `locale-gen`
25. `echo "<name>" > /etc/hostname`
26. `systemctl enable NetworkManager --now`
27. Enable and sync time: `systemctl enable systemd-timesyncd --now`
28. Get tz from `tzselect`, set via `timedatectl set-timezone [tz]`
29. Update hwclock: `hwclock -w --utc`