Skip to content

Latest commit

 

History

80 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

Arch Install

The content of this document is a personal guide developed for installing Arch Linux. While it is recommended to refer to the Official Installation Guide, you are free to utilize any information provided here in a manner that suits your needs.

Pre-Installation

Before proceeding with the installation of Arch Linux, it is important to follow a series of preliminary steps to ensure a smooth and successful installation process.

Notes

The Arch Linux installation images do not include built-in support for Secure Boot. However, you can manually set up Secure Boot after completing the installation if desired.

Keyboard Layout and Console Font (Optional)

To configure the console keyboard layout and font, (e.g., us-acentos and ter-132b), use the following commands:

#!/bin/bash

loadkeys us-acentos # to list keymaps use: `localectl list-keymaps`
setfont ter-132b # Console fonts are located in: `/usr/share/kbd/consolefonts/`

Update the system clock

To ensure the system clock is accurate use timedatectl command in Linux:

#!/bin/bash

timedatectl set-ntp on

Partitions (Encrypted with LVM on LUKS)

By utilizing LVM (Logical Volume Manager) within a single LUKS (Linux Unified Key Setup) encrypted partition, you can achieve enhanced partitioning flexibility. This approach allows you to dynamically manage and resize logical volumes within the encrypted container, providing greater control over your storage allocation. With LVM, you can create multiple logical volumes, such as for the root filesystem, home directory, and other data partitions, all securely housed within the LUKS encryption. This setup enables easier management and resizing of partitions without compromising the overall security provided by LUKS encryption.

Erase all data on disk (Optional)

Prior to encrypting the partition or entire device, it is recommended to create a temporary encrypted container to wipe all data still in the disk. You can consider changing the cipher used from the standard aes-cbc to aes-xts, as it may provide improved performance. It's advisable to verify the performance comparison using the cryptsetup benchmark command.

#!/bin/bash

cryptsetup open --type plain -d /dev/urandom /dev/<block-device> to_be_wiped

Wipe the container with zeros. A use of if=/dev/urandom is not required as the encryption cipher is used for randomness.

#!/bin/bash

dd if=/dev/zero of=/dev/mapper/to_be_wiped status=progress

Finally, close the temporary container:

#!/bin/bash

cryptsetup close to_be_wiped

Preparing the disk

Use fdisk or to modify partition tables. Create a partition to be mounted at /boot with a size of 1 GiB and another partition (Linux LVM) which will later contain the encrypted container.

#!/bin/bash

fdisk /dev/sda

Create the LUKS encrypted container at the designated partition. Enter the chosen password twice.

#!/bin/bash

cryptsetup luksFormat /dev/sda2

Open the container and the decrypted container will be available at /dev/mapper/lvm:

#!/bin/bash

cryptsetup open /dev/sda2 lvm

Preparing the logical volumes

Create a physical volume on top of the opened LUKS container:

#!/bin/bash

pvcreate /dev/mapper/lvm

Create a volume group (e.g., vg0) and add the previously created physical volume to it:

#!/bin/bash

vgcreate vg0 /dev/mapper/lvm

Create all your logical volumes on the volume group:

#!/bin/bash

lvcreate -L 8G vg0 -n swap
lvcreate -L 160G vg0 -n root
lvcreate -l 100%FREE vg0 -n home

# leave at least 1 GiB free space in the volume group to allow using e2scrub,
# snapshots, or other metadata operations

lvreduce -L -1G vg0/home

When using BLAST, the 8 GiB swap logical volume acts as fallback swap. BLAST configures zram as the primary compressed swap device with zram-generator:

[zram0]
zram-size = min(ram / 2, 16384)
compression-algorithm = zstd
swap-priority = 100

On a system with 32 GiB of RAM, this creates a 16 GiB zram swap device with higher priority than the disk swap.

Format your file systems on each logical volume:

#!/bin/bash

mkfs.ext4 -L ROOT /dev/vg0/root
mkfs.ext4 -L HOME /dev/vg0/home
mkswap -L SWAP /dev/vg0/swap

Mount your file systems:

#!/bin/bash

mount /dev/vg0/root /mnt
mount --mkdir /dev/vg0/home /mnt/home
swapon /dev/vg0/swap

Preparing the boot partition

Create a file system on the partition intended for /boot and mount the partition to /mnt/boot:

#!/bin/bash

mkfs.fat -n BOOT-EFI -F 32 /dev/sda1
mount --mkdir /dev/sda1 /mnt/boot

Installation

The following section provides guidance on installing Arch Linux. It covers the necessary steps and instructions to successfully install the operating system on your system.

Connect to the internet

To set up a network connection in the live environment, go through the following steps:

Wireless

  • (Wireless/WWAN): Make sure the card is not blocked with rfkill.
  • Authenticate to the wireless network using iwctl.

Ethernet

  • Plug in the cable.

Select The Mirrors

Use reflector to automatically update /etc/pacman.d/mirrorlist:

#!/bin/bash

reflector --country COUNTRY,

Install Essential Packages

Use pacstrap to install the base package, Linux kernel, firmware for common hardware and other packages. If you encrypted your device or partition, make sure to also install lvm2. Install the CPU microcode package that matches your processor: intel-ucode for Intel or amd-ucode for AMD.

#!/bin/bash

pacstrap -K /mnt base base-devel linux linux-firmware linux-firmware-qlogic linux-firmware-marvell sof-firmware vim git openssh lvm2 intel-ucode

Replace intel-ucode with amd-ucode on AMD systems.

Generate fstab

Generate an fstab file (use -U or -L to define by UUID or labels, respectively):

#!/bin/bash

genfstab -L /mnt >> /mnt/etc/fstab

Chroot

Change root into the new system:

#!/bin/bash

arch-chroot /mnt

Configuring mkinitcpio

Make sure the lvm2 package is installed and add the keyboard, encrypt and lvm2 hooks to mkinitcpio.conf.

#!/bin/bash

EDITOR /etc/mkinitcpio.conf
HOOKS=(base `udev` autodetect modconf kms `keyboard` `keymap` `consolefont` block `encrypt` `lvm2` filesystems fsck)

Regenerate initramfs after saving the changes.

#!/bin/bash

mkinitcpio -p linux  # Or linux-lts

Configuring the bootloader

In order to unlock the encrypted root partition at boot, the following kernel parameter needs to be set on the bootloader cryptdevice=UUID=DEVICE_UUID:lvm:

PS: If you'll be using BLAST, skip to Post-Installation setup.

Systemd-boot

Install it:

bootctl install
mkinitcpio -p linux
systemctl enable systemd-boot-update.service

Create the loader configuration:

#!/bin/bash
$ cat /boot/loader/loader.conf

default      arch.conf
timeout      1
console-mode max
editor       no

Use /intel-ucode.img on Intel systems or /amd-ucode.img on AMD systems.

#!/bin/bash
$ cat /boot/loader/entries/arch.conf

title   Arch Linux
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options cryptdevice=UUID=e8bdb9ea-134f-47aa-9c4f-459a4a60acaa:lvm root=UUID=c12ea209-1f90-4d69-946f-766deef7bfe1 rw zswap.enabled=0

$ cat /boot/loader/entries/arch-fallback.conf

title   Arch Linux (fallback initramfs)
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux-fallback.img
options cryptdevice=UUID=e8bdb9ea-134f-47aa-9c4f-459a4a60acaa:lvm root=UUID=c12ea209-1f90-4d69-946f-766deef7bfe1 rw zswap.enabled=0

Post-Installation

Use BLAST to automatically configure Arch with my dotfiles, Niri, packages, and system settings. Or follow the Official Installation Guide#Configure the system.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors