Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save Nill-R/32773c2d42cbe7262a3321439a7941d6 to your computer and use it in GitHub Desktop.

Select an option

Save Nill-R/32773c2d42cbe7262a3321439a7941d6 to your computer and use it in GitHub Desktop.

Install base system

Boot the SystemRescue

Install debootstrap:

pacman -S debootstrap

Create partitions. You'll need an EFI partition and a Linux filesystem partition, swap is optional:

gdisk /dev/sda

o
n 1 (default) +1g     ef00   # EFI system partition
n 2 (default) +16g      8200   # Linux swap (optional, same size as RAM)
n 3 (default) (default) 8300   # Linux filesystem (if no swap - change partition number to 2)
w

Create the filesystems:

mkfs.vfat /dev/sda1
mkswap /dev/sda2
mkfs.btrfs /dev/sda3

Create the BTRFS subvolumes:

mount /dev/sda3 /mnt
btrfs su cr /mnt/@
btrfs su cr /mnt/@home
btrfs su cr /mnt/@root
btrfs su cr /mnt/@srv
btrfs su cr /mnt/@cache
btrfs su cr /mnt/@tmp
btrfs su cr /mnt/@log
umount /mnt

Mount the partitions/subvolumes to /mnt:

mount -o  defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@ /dev/sda3 /mnt

mkdir /mnt/{home,root,srv,var}
mkdir /mnt/var/{cache,tmp,log}

mount -o defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@home /dev/sda3 /mnt/home
mount -o defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@root /dev/sda3 /mnt/root
mount -o defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@srv /dev/sda3 /mnt/srv
mount -o defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@cache /dev/sda3 /mnt/var/cache
mount -o defaults,noatime,nodatacow,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@tmp /dev/sda3 /mnt/var/tmp
mount -o defaults,noatime,nodatacow,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@log /dev/sda3 /mnt/var/log

mkdir -p /mnt/boot/efi
mount -o defaults,nosuid,nodev,relatime,errors=remount-ro /dev/sda1 /mnt/boot/efi

swapon /dev/sda2

Disable COW for logs and tmp (better performance for databases and logs):

chattr +C /mnt/var/tmp
chattr +C /mnt/var/log

Install base system using debootstrap. Since I'm installing 24.04, use the noble identifier. You can also specify your mirror, choose one that is faster/closer to you:

debootstrap noble /mnt http://am.archive.ubuntu.com/ubuntu

The mirror will also be written to sources.list, so choose an actually good one. If you don't specify one, the default is the main repository located in US.

Prepare chroot environment

There are some packages I do not want to get installed. Create a file /mnt/etc/apt/preferences.d/ignored-packages:

Package: snapd cloud-init landscape-common popularity-contest ubuntu-advantage-tools
Pin: release *
Pin-Priority: -1

Edit /mnt/etc/apt/sources.list, add -security and -updates suites, as well as restricted and universe repositories:

deb http://am.archive.ubuntu.com/ubuntu noble           main restricted universe
deb http://am.archive.ubuntu.com/ubuntu noble-security  main restricted universe
deb http://am.archive.ubuntu.com/ubuntu noble-updates   main restricted universe

Edit /mnt/etc/fstab

#
/dev/sda3 / btrfs defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@ 0 1
/dev/sda3 /root btrfs defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@root 0 1
/dev/sda3 /home btrfs defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@home 0 1
/dev/sda3 /srv btrfs defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@srv 0 1
#
/dev/sda3 /var/cache btrfs defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@cache 0 1
/dev/sda3 /var/tmp btrfs defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@tmp 0 1
/dev/sda3 /var/log btrfs defaults,noatime,autodefrag,compress-force=zstd:10,space_cache=v2,discard=async,subvol=@log 0 1
#
/dev/sda2 none swap sw 0 0
#
/dev/sda1 /boot/efi vfat defaults 0 1

Chroot into the installation environment:

arch-chroot /mnt

Configure the system

Update and add more necessary packages:

apt update
apt -y upgrade
apt install --no-install-recommends \
  linux-{,image-,headers-}generic \
  linux-firmware initramfs-tools efibootmgr

This is also where you pick your kernel. Now install a text editor:

apt install micro

Install fish-shell

sudo apt-add-repository ppa:fish-shell/release-4
apt install -y fish

Configure your timezone, locales and keyboard layout. I use Asia/Yerevan timezone, en_US.UTF-8 locales, and a standard US keyboard:

dpkg-reconfigure tzdata
dpkg-reconfigure locales
dpkg-reconfigure keyboard-configuration

Set your hostname:

hostnamectl set-hostname your-hostname

Set up users

Set your root password:

passwd

Create your sudo user and set a password for it:

useradd -s/usr/bin/fish -m nill
passwd nill

Set up networking

For most single ethernet cable setups, you can just:

systemctl enable systemd-networkd

And then create a configuration in /etc/systemd/network/ethernet.network:

[Match]
Name=enp1s0

[Network]
DHCP=yes

Replace enp1s0 with your interface name, find it out using ip a.

Install other packages

You can install other useful packages that you need, here's what I install:

apt install at ar arj btrfs-progs bzip2 curl dmidecode duf gdu ethtool fwupd gawk git gnupg htop man mc\
  needrestart openssh-server patch screen software-properties-common tmux zstd

After that, you can install you desktop environment:

apt install sway swayidle swaylock xdg-desktop-portal-wlr

Install a bootloader

Finally, install a bootloader of your choice. I will install GRUB:

apt install grub-efi-amd64
grub-install /dev/sda
update-grub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment