Skip to content

Instantly share code, notes, and snippets.

@myTerminal

myTerminal/steps.md

Last active Apr 30, 2021
Embed
What would you like to do?
Arch installation steps on my Lenovo ThinkPad X1 Extreme (Gen 3)

Installation steps

Connecting to a wireless network

  1. Start iwctl
  2. List devices with device list
  3. Scan for networks with station <device-name> scan
  4. List the available networks with station <device-name> get-networks
  5. Connect to a network with station <device-name> connect <network-name> and enter a password.

Verify internet connectivity with ip a.

Setting up time

timedatectl set-ntp true
timedatectl status

Setting up the partition map

Creating partitions

Perform partitioning with cfdisk and verify with lsblk before proceeding.

Preparing partitions (btrfs model)

Format the first partition as EFI (boot)

mkfs.fat -F32 /dev/nvme0n1p1

Create a swap

mkswap /dev/nvme0n1p2

Prepare the main encrypted partition

cryptsetup -y -v luksFormat /dev/nvme0n1p3

Respond with a "YES" and enter a passphrase twice.

Open the main partition with a name "enc"

cryptsetup open /dev/nvme0n1p3 enc
<passphrase>

Format the main partition as btrfs

mkfs.btrfs /dev/mapper/enc

Mounting partitions

Creating BTRFS subvolumes

Mount main partition

mount /dev/mapper/enc /mnt

Create subvolumes for root, home, var and snapshots

btrfs su cr /mnt/@
btrfs su cr /mnt/@home
btrfs su cr /mnt/@var
btrfs su cr /mnt/@snapshots

Unmount the partition

umount /mnt

Re-mounting subvolumes as partitions

mount -o noatime,nodiratime,compress=lzo,space_cache,subvol=@ /dev/mapper/enc /mnt
mkdir -p /mnt/{boot,home,var,.snapshots}
mount /dev/nvme0n1p1 /mnt/boot
mount -o noatime,nodiratime,compress=lzo,space_cache,subvol=@home /dev/mapper/enc /mnt/home
mount -o noatime,nodiratime,compress=lzo,space_cache,subvol=@var /dev/mapper/enc /mnt/var
mount -o noatime,nodiratime,compress=lzo,space_cache,subvol=@snapshots /dev/mapper/enc /mnt/.snapshots
swapon /dev/nvme0n1p2

Installing base system

pacstrap /mnt base base-devel linux linux-firmware linux-headers vim git wget intel-ucode

Generating file-system table

genfstab -U /mnt >> /mnt/etc/fstab

Logging into the new system

arch-chroot /mnt

Setting timezone and locales

Set local timezone

ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc

Set locales by uncommenting en_US.UTF-8 from /etc/locale.gen and then generate the selected locale(s)

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

Configuring network identity

Set hostname

echo "excelsior" > /etc/hostname

Place below content in the file /etc/hosts

127.0.0.1    localhost
::1          localhost
127.0.1.1    excelsior.localdomain excelsior

Setting root password

passwd

Enabling network service

pacman -S dhcpcd --noconfirm
systemctl enable dhcpcd

Creating users and groups

Create user

useradd ismail -m -c "Mohammed Ismail Ansari"

Set password for user

passwd ismail

Add user to wheel (and other) group(s)

usermod -aG wheel,audio,video,optical,storage ismail

Configure sudo for 'wheel' group

visudo

Setting up pacman

Enable multilib repository for pacman by uncommenting [multilib] section in /etc/pacman.conf and then update pacman database with pacman -Syu.

Installing a few packages

Install grub and company

pacman -S grub efibootmgr btrfs-progs os-prober ntfs-3g mtools dosfstools

Install a network related packages

pacman -S networkmanager network-manager-applet wireless_tools wpa_supplicant dialog

Setting up grub

Add hook for encryption

vim /etc/mkinitcpi.conf

Add "encrypt" after "block" under HOOKS.

Init mkinitcpio

mkinitcpio -p linux

Install grub

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

Generate grub configuration file

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

Use blkid to get the UUID of the encrypted partition

Make grub aware of the encrypted partition

vim /etc/default/grub

Enter the following kernel parameters under GRUB_CMDLINE_LINUX: "cryptdevice=UUID=[uuid-of-encrypted-partition]>:enc root=/dev/mapper/enc"

Re-generate grub configuration file

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

Enabling network-manager service

systemctl enable NetworkManager

Ending with a clean up

Exit chroot

exit

Unmount all mounted partitions

umount -a

Reboot

reboot now

Post installation

Connecting to the internet

Use nmtui for a text-based interface.

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