scripts/arch-install-btrfs-systemd-boot.md

3.9 KiB

Installation on Dell XPS 9570

Connect to Internet

Sync clock

timedatectl set-ntp true

Create three partitions:

1 512MB EFI partition # Hex code ef00

2 rest Linux partiton # Hex code 8300

cgdisk /dev/nvme0n1

Format EFI partition

mkfs.vfat -F 32 -n BOOT /dev/nvme0n1p1

o=compress=lzo,space_cache,noatime,ssd o_btrfs=$o,defaults,x-mount.mkdir

mount -t btrfs /dev/nvme0n1p2 /mnt

Create BTRFS subvolumes + mount directories

btrfs subvolume create root btrfs subvolume create home btrfs subvolume create snapshots btrfs subvolume create tmp btrfs subvolume create opt btrfs subvolume create var

umount /mnt

Mount BTRFS subvolumes

mount -o subvol=root,$o_btrfs /dev/mapper/root /mnt mount -o subvol=home,$o_btrfs /dev/mapper/root /mnt/home mount -o subvol=snapshots,$o_btrfs /dev/mapper/root /mnt/.snapshots mount -o subvol=tmp,$o_btrfs /dev/mapper/root /mnt/tmp mount -o subvol=opt,$o_btrfs /dev/mapper/root /mnt/opt mount -o subvol=var,$o_btrfs /dev/mapper/root /mnt/var

Mount EFI partition

mkdir /mnt/boot mount /dev/nvme0n1p1 /mnt/boot

Install the base system plus a few packages

pacstrap /mnt base base-devel btrfs-progs zsh neovim git sudo iwd

genfstab -Up /mnt >>/mnt/etc/fstab

Verify and adjust /mnt/etc/fstab

Change relatime on all non-boot partitions to noatime (reduces wear if using an SSD)

arch-chroot /mnt

echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen locale-gen localectl set-locale LANG=en_US.UTF-8

Setup time

ln -s /usr/share/zoneinfo/America/Newyork etc/localtime hwclock --systohc --localtime

Set locale

echo 'LANG=en_US.UTF-8' > /etc/locale.conf

set hostname

echo xcloud >/etc/hostname echo '127.0.0.1 xcloud xcloud.localdomain' > /etc/hosts echo '::1 xcloud xcloud.localdomain' > /etc/hosts

Set password for root

passwd

Add real group / user

groupadd -g 1001 useradd -m -g '' -G users,wheel,audio,video -s /bin/zsh '' passwd '' echo ' ALL=(ALL) ALL' > /etc/sudoers.d/

Configure mkinitcpio with modules needed for the initrd image

vi /etc/mkinitcpio.conf

remove HOOK "fsck", add "keymap encrypt" before "filesystems":

HOOKS="base udev autodetect modconf block btrfs keymap encrypt filesystems keyboard"

Regenerate initrd image

mkinitcpio -p linux

Setup systemd-boot

bootctl --path=/boot install

Enable Intel microcode updates

pacman -S intel-ucode

/boot/loader/entries/arch.conf

title Arch Linux Encrypted linux /vmlinuz-linux initrd /intel-ucode.img initrd /initramfs-linux.img options cryptdevice=UUID=:root root=UUID= rootflags=subvol=@ rw

Set default bootloader entry


/boot/loader/loader.conf

default arch timeout 4 editor 0

Useful services

pacman -S acpid ntp avahi cups cronie

systemctl enable acpid systemctl enable ntpd systemctl enable avahi-daemon systemctl enable org.cups.cupsd.service systemctl enable cronie

systemctl enable systemd-timesyncd.service systemctl start systemd-timesyncd.service

pacman -S networkmanager pacman -S network-manager-applet

systemctl enable NetworkManager

pacman -S bash-completion

vi /etc/modprobe.d/modprobe.conf

content:

blacklist psmouse

X11 / Gnome

pacman -S xorg-server xorg-xinit pacman -S xf86-video-intel pacman -S alsa-utils alsa-tools pulseaudio pavucontrol nm-connection-editor pacman -S gnome gnome-extra gdm pacman -S chromium emacs openssh

exit arch-chroot

exit

cleanup EFI-bootmanager entries

efibootmgr efibootmgr -b 0 -B # e.g. remove Boot0000

unmount all filesystems

umount -R /mnt reboot

Yaourt

Installation from AUR

install package-query first:

curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz tar -xvzf package-query.tar.gz cd package-query makepkg -si

then yaourt itself:

cd .. curl -O https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz tar -xvzf yaourt.tar.gz cd yaourt makepkg -si

systemctl start gdm