This is my current Arch linux installation. I created this for myself, so there's not much description.
What I want out of my install:
- EFI boot partition
- Btrfs filesystem to take advantage of snapshots
- Systemd boot loader
Note: If you are not using full disk encryption, replace
/dev/mapper/cryptroot
with/dev/sdX2
throughout this guide.
Mount Point | Partition | Partition Type | Size |
---|---|---|---|
/mnt/boot | /dev/sdX1 | ESP for UEFI | 550 MiB |
/mnt | /dev/mapper/cryptroot | Btrfs | Remainder |
# sgdisk /dev/sdX -o -n 1::+550M -n 2 -t 1:ef00 -t 2:8300
# gdisk /dev/sdX
- Press o: create empty partition table
- Press
y
thenenter
- Press
- Press n: create new partition.
- Partition: 1
- First sector: default
- Second sector: +550M
- Partition type: ef00
- Press n: create new partition
- Partition: 2
- First sector: default
- Second sector: default
- Partition type: default
- Press w: write table to disk and exit
- Press
y
thenenter
- Press
# cryptsetup luksFormat --type luks2 /dev/sdX2
# cryptsetup open /dev/sdX2 cryptroot
# mkfs.fat -F32 /dev/sdX1
# mkfs.btrfs /dev/mapper/cryptroot
# mount /dev/mapper/cryptroot /mnt
# btrfs subvolume create /mnt/@
# btrfs subvolume create /mnt/@home
# umount /mnt
# mount -o compress=lzo,space_cache,subvol=@ /dev/mapper/cryptroot /mnt
# mkdir /mnt/{boot,home}
# mount /dev/sdX1 /mnt/boot
# mount -o compress=lzo,space_cache,subvol=@home /dev/mapper/cryptroot /mnt/home
# pacstrap /mnt base base-devel vim btrfs-progs linux linux-firmware dhcpcd
# genfstab -U /mnt >> /mnt/etc/fstab
# arch-chroot /mnt
# timedatectl set-ntp true
# ln -sf /usr/share/zoneinfo/America/Phoenix /etc/localtime
# systemctl enable systemd-timesyncd.service --now
# hwclock --systohc
# echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
# echo LANG=en_US.UTF-8 > /etc/locale.conf
# locale-gen
# echo your-hostname > /etc/hostname
/etc/hosts
----------
127.0.0.1 localhost
::1 localhost
127.0.0.1 your-host-name.localdomain your-host-name
# ip link
Note replace
device
with the device listed fromip link
.
# systemctl enable dhcpcd@device.service
Remove fsck
and add btrfs
and encrypt
to hooks
/etc/mkinitcpio.conf
--------------------
HOOKS=(base ... block btrfs filesystem ... encrypt)
# mkinitcpio -p linux
Uncomment the two following lines:
/etc/pacman.conf
----------------
...
[multilib]
Include = /etc/pacman.d/mirrorlist
...
# pacman -Syy
# passwd
# useradd -m -G wheel your-username
# passwd your-username
# EDITOR=vim visudo
And uncomment the line:
# %wheel ALL=(ALL) ALL
# btrfs subvolume create /.swap
# truncate -s 0 /.swap/swapfile
# chattr +C /.swap/swapfile
# dd if=/dev/zero of=/.swap/swapfile bs=1M count=2048
# chmod 600 /.swap/swapfile
# mkswap /.swap/swapfile
/etc/fstab
----------
...
/.swap/swapfile none swap defaults 0 0
# bootctl --path=/boot install
# pacman -S amd-ucode
# pacman -S intel-ucode
# mkdir -p /boot/loader/entries
/boot/loader/loader.conf
------------------------
default arch
timeout 3
Note: Make sure your
*-ucode.img
corresponds to the one you installed. If you're not using full disk encryption, omitcryptdevice=...
.
/boot/loader/entries/arch.conf
-------------------------------
title Arch Linux
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux.img
options root=/dev/mapper/cryptroot cryptdevice=/dev/sdX2:cryptroot:allow-discards ro rootfstype=btrfs rootflags=subvol=/@
/boot/loader/entries/arch-fallback.conf
---------------------------------------
title Arch Linux (Fallback)
linux /vmlinuz-linux
initrd /amd-ucode.img
initrd /initramfs-linux-fallback.img
options root=/dev/mapper/cryptroot cryptdevice=/dev/sdX2:cryptroot:allow-discards ro rootfstype=btrfs rootflags=subvol=/@
# exit
# reboot
# pacman -S snapper
# snapper -c root create-config /
# snapper -c root create --description "Initial install"
# pacman -S zsh grml-zsh-config
# chsh -s /usr/bin/zsh
# chsh -s /usr/bin/zsh your-user-name
# exit
# pacman -S xorg-server xorg-xinit ttf-dejavu polkit rxvt-unicode git
# pacman -S xf86-video-intel
# pacman -S xf86-video-amdgpu
# pacman -S xf86-video-nouveau
# pacman -S gnome-keyring
/etc/pam.d/login
----------------
auth
...
auth optional pam_gnome_keyring.so
session
...
session optional pam_gnome_keyring.so auto_start
# pacman -S bspwm sxhkd dmenu
# mkdir -p ~/.config/bspwm
# mkdir ~/.config/sxhkd
# cp /usr/share/doc/bspwm/examples/bspwmrc ~/.config/bspwm
# cp /usr/share/doc/bspwm/examples/sxhkdrc ~/.config/sxhkd
# chmod +x ~/.config/bspwm/bspwmrc
~/.xinitrc
----------
exec bspwm
Note: Bash users should use
.bash_profile
instead of.zprofile
.
~/.zprofile
-----------
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx > /tmp/xorg.log 2>&1
fi
Note: You'll most likely be at a black screen. Here are some basic hotkeys to get started:
super+enter
spawn a terminalsuper+space
run dmenu$ bspc quit
exit your session