scripts/afu/README.ARCH.md

7.1 KiB

Installation of Arch Linux

After creating an ISO and starting the system. See archlinux-2024.06.01-x86_64.iso via https://archlinux.org/download/

Create a Live USB or DVD or ISO directly in a Virtual Machine

USB stick on a Linux machine

# dd bs=4M if=/[path_to_archlinux.iso] of=/dev/[path_to_usb_device] statuts=progress && sync

Replace [path_to_archlinux.iso] with the actual path to your Arch Linux ISO file and [path_to_usb_device] with the correct path to your USB device.

Be careful specifieng the path to the USB device. Check the path with

# lsblk

A USB stick is usually mounted under /run/media/ e.g.

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    1 111.8G  0 disk 
├─sda1        8:1    1   102G  0 part /
└─sda2        8:2    1   9.8G  0 part [SWAP]
sdb           8:16   1   3.6T  0 disk /data
                                      /srv
                                      /raid1
sdc           8:32   1   3.6T  0 disk 
sdd           8:48   1   7.6G  0 disk 
└─sdd1        8:49   1   7.6G  0 part /run/media/tom/TUEVAUSTRIA
sr0          11:0    1  1024M  0 rom

In this example the USB device partition is sdd1 and the device itself is sdd which should be used as [path_to_usb_device].

Start the install ISO

Select Arch Linux install medium (x86_64) and press Enter to start the setup process

Set the Keyboard Layout

The default keymap is set to US. To list other available layouts run

# ls /usr/share/kbd/keymaps/**/*.map.gz

To change to the German keyboard layout enter

# loadkeys de-latin1

It is a little difficult to find the correct keys on a US keyboard. The y is swapped with the z, and the - is on the ß key.

Check the Internet Connection

# ping -c 3 google.com

Enable Network Time Protocol (NTP)

# timedatectl set-ntp true

To check the NTP service, use:

# timedatectl status

Partition the Disk

BTRF file system without a partition

Just to get an overview of the drives

# lsblk

Create the filesystem with

# mkfs.btrfs /dev/sdX --label arch

Replace X with the drive letter or if it is an nvme drive use /dev/nvmeXX with the correct drive label. --label or -L defines the Label of the drive, e.g. arch.

Check the Mirror List for an Suitable Mirror

To speed up the download, set up the mirror list so that the fastest mirrors are at the top.

First, sync the Arch repository with pacman

# pacman -Syy

Install reflector to be able to update the mirrors and sort them by download speed. Add reflector by running:

# pacman -S reflector

Backup the mirror list with:

# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak

The reflector updates the mirror list, run:

# reflector -c "XX" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist

Replace "XX" with the your location country code (e.g. enter "US" if you are located in the United States, or "AT,DE" if you are located close to Austria and Germany)

Install Arch Linux

Mount the root partition

Btrfs filesystem has the following options, which are useful to change:

  • noatime, useful to use by default because atime updates increases metadata writes. relatime is default,
  • commit=300, default is 30, the interval of periodic transaction commit,
  • compress=zstd:2, default is no, use zstd compression from [1,15] ratio. Default zstd ratio is 3.

Mount the Drive with Label arch to /mnt

# mount -o compress=zstd:2,noatime,commit=300 LABEL=arch /mnt

PACSTRAP installation script for necessary packages to the bootable device

# pacstrap /mnt base linux linux-firmware nano mc btrfs-progs dhcpcd

Configure Arch Linux

Generate fstab File

The fstab file defines the order in which disks, partitions, block devices, and other data sources are mounted.

Create the fstab file by running:

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

Use Arch-Chroot and Enter the Mounted Disk as Root

Change the root to the newly installed Arch Linux system with the 'arch-chroot' command:

# arch-chroot /mnt

[root@archiso /]#

Set the Time Zone

Setting the correct time zone ensures the system clock reflects the accurate local time.

List all available time zones

# find /usr/share/zoneinfo -type f | more

Find your timezone and make a note of the name, make an lncommand to create a symbolic link from the timezone to /etc/localtime. For Europe/Vienna run

# ln -sf /usr/share/zoneinfo/Europe/Vienna /etc/localtime

Set the Locale

Open the file locale.gen with nano, and uncomment the name by removing the leading # of your preferred locale and any other you would like to use. I uncomment the line with

# nano /etc/locale.gen

I personally like to have an English environment with European setting, so I remove the # for en_DK.UTF-8 UTF-8.

...
#en_CA ISO-8859-1
en_DK.UTF-8 UTF-8
#en_DK ISO-8859-1
#en_GB.UTF-8 UTF-8
...

Enter Ctr + X to exit and type Y to save the changes.

Generate a locale configuration file with the following command:

# locale-gen

Create the locale.conf, run:

# echo LANG=en_DK.UTF-8 > /etc/locale.conf
# export LANG=en_DK.UTF-8

Set the console keyboard layout, make the changes persistent in *vconsole.conf(5):

# echo KEYMAP=de-latin1 > /etc/vconsole.conf

Set Hostname archlinux (or any other name)

# echo archlinux > /etc/hostname

Enable the DHCP, the Dynamic Host Configuration Protocol

Run

# systemctl enable dhcpcd

Set the root password with the command passwd

# passwd

Installation of the Grub Bootloader

Installation on a Non-UEFI System

# pacman -S grub os-prober
# grub-install /dev/sdX

Replace X with the letter of the drive you want to install GRUB on. For example grub-install /dev/sda.

Create a GRUB configuration file with:

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

Installation on a UEFI System

# pacman -S grub efibootmgr
# mkdir /boot/efi
# mount /dev/sdX1 /boot/efi

Replace X with the drive letter of the disk the partition belongs to. Install Grub with:

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

Finally create GRUB configuration file:

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

Create a New User and Set Privileges

Install sudo before adding a new user

# pacman -S sudo

Create a New User with:

# useradd -m [username]

Replace [username] with the real username for the system.

Create the Password

# passwd [username]

Add the User to several groups, granting specific permissions:

# usermod -aG wheel,audio,video,storage [username]

sudoers -- Edit the visudo File, uncomment the wheel group:

# EDITOR=nano visudo

...
## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL:ALL) ALL
...

Exit the Environment of ARCH-Chroot and Reboot

# exit

Unmount the root with:

# umount -l /mnt

Remove the USB or CD/DVD and reboot the system with:

# reboot