libre.io|

/arch/

.. (parent directory)

A minimal Arch Linux installation guide for servers.

0. partitioning

Adjust the parameters accordingly.
# gdisk /dev/nvme0n1
n, enter, enter, +512M, EF00  // nvme0n1p1: efi
n, enter, enter, +512M, FD00  // nvme0n1p2: boot
n, enter, enter,  -16G, FD00  // nvme0n1p3: root
n, enter, enter, enter, 8200  // nvme0n1p4: swap
w, y
Clone partitions.
# sgdisk /dev/nvme0n1 -R=/dev/nvme1n1
# sgdisk -G /dev/nvme1n1
# reboot

1. creating raid arrays

md0 consists of the boot partitions (nvme0n1p2, nvme1n1p2) in RAID-1. md1 consists of the root partitions (nvme0n1p3, nvme1n1p3) in RAID-0.

(scrollbar is hidden, drag to see the whole command)
# mdadm --create /dev/md0 --raid-devices=2 --level=1 /dev/nvme[01]n1p2
# mdadm --create /dev/md1 --raid-devices=2 --level=0 /dev/nvme[01]n1p3
# mdadm --detail --scan >> /etc/mdadm.conf

2. formatting

Format the EFI partitions as fat32.
# mkfs.vfat -F 32 /dev/nvme0n1p1
# mkfs.vfat -F 32 /dev/nvme1n1p1
Format /boot and / as ext4.
# mkfs.ext4 /dev/md0
# mkfs.ext4 /dev/md1
Setup the swap partitions.
# mkswap /dev/nvme0n1p4
# mkswap /dev/nvme1n1p4

3. setting up the base system

Mount the partitions. Notice only one efi partition is mounted.
# mount /dev/md1 /mnt
# mkdir /mnt/boot
# mount /dev/md0 /mnt/boot
# mkdir /mnt/boot/efi
# mount /dev/nvme0n1p1 /mnt/boot/efi
Install arch and chroot into the system. intel-ucode is optional.
# pacstrap /mnt base base-devel grub efibootmgr intel-ucode
# genfstab -U /mnt >> /mnt/etc/fstab
# arch-chroot /mnt
Setup system configs.
# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
# hwclock --systohc
# nano /etc/locale.gen  // uncomment en_US.UTF-8 UTF-8 and other needed localizations
# locale-gen
# passwd                // set root password
Create a new initramfs.
# nano /etc/mkinitcpio.conf  // add mdadm_udev inside HOOKS=" ... "
# mkinitcpio -p linux
Install grub.
# grub-install --target=x86_64-efi --efi-directory=/boot/efi
# grub-mkconfig -o /boot/grub/grub.cfg
Setup network.
# nano /etc/systemd/network/dhcp.network
[Match]
Name=en*
[Network]
DHCP=ipv4
# systemctl enable systemd-networkd
Setup ssh.
# pacman -S openssh
# nano /etc/ssh/sshd_config  // password login is disabled by default. modify PasswordAuthentication accordingly.
# systemctl enable sshd
Exit out of chroot.
# ^D

4. finishing

Unmount drives, clone the EFI partition, then reboot.
# umount -R /mnt
# dd if=/dev/nvme0n1p1 of=/dev/nvme1n1p1
# reboot