Arch Linux install

Attention

Please refer to the Arch Wiki for the official guide on how to install Arch Linux.

Setup disk partitions

# parted /dev/sda
(parted) mklabel gpt
(parted) mkpart primary fat32 1MiB 512MiB
(parted) set 1 esp on
(parted) mkpart primary linux-swap 512MiB 2560MiB
(parted) mkpart primary ext4 2560MiB 100%
(parted) quit

Format partitions

# mkfs.fat -F32 /dev/sda1
# mkswap /dev/sda2
# mkfs.ext4 /dev/sda3

Mount partitions

# mount /dev/sda3 /mnt
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot
# swapon /dev/sda2

Install the base system and enter chroot

# pacstrap /mnt base linux vim
# genfstab -U /mnt >> /mnt/etc/fstab
# arch-chroot /mnt

Set local timezone and create /etc/adjtime

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

Set and generate locale

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

Set the host name

# hostnamectl set-hostname <hostname>

Adjust the hosts file

/etc/hosts
127.0.0.1    localhost.localdomain   localhost
::1          localhost6.localdomain   localhost6
192.168.1.250 $myhostname.$mydomain   $myhostname
2001:470:8050:1::250 $myhostname.$mydomain  $myhostname

Enable NTP daemon

# timedatectl set-ntp true

Set the root password

# passwd

Create files for and install systemd-boot

# mkdir -p /boot/loader/entries
/boot/loader/loader.conf
default arch
console-mode max
timeout 5
/boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=/dev/sda3 net.ifnames=0

Install systemd-boot:

# bootctl --path=/boot install

Configure networking

DHCP

/etc/systemd/network/eth0.network
[Match]
Name=eth0

[Network]
DHCP=yes

Static

/etc/systemd/network/eth0.network
[Match]
Name=eth0

[Network]
Address=192.168.1.250/24
Gateway=192.168.1.1
DNS=192.168.1.53

Address=2001:470:8050:1::250/64
Gateway=2001:470:8050:1::1
DNS=2001:470:8050:1::53

Enable networking on boot

# systemctl enable systemd-networkd
# systemctl enable systemd-resolved

Exit chroot and reboot

# exit
# reboot