概要

A simple, lightweight distribution

変数

MY_SSID
MY_DEVICE
MY_TIMEZONE
MY_USER

Pre-installation

Connect to the internet

iwctl station wlan0 connect "$MY_SSID"

Partition the disks

cp /dev/zero /dev/nvme0n1
sgdisk \
  -Z \
  -o \
  -n 1:0:+1G -t 1:ef00 -c 1:"EFI" \
  -n 2:0:0 -t 2:8304 -c 2:"Root" \
  "$MY_DEVICE"
udevadm wait \
  /dev/disk/by-partlabel/"EFI" \
  /dev/disk/by-partlabel/"Root"

Format the partitions

mkfs.fat -F 32 /dev/disk/by-partlabel/"EFI"
mkfs.ext4 /dev/disk/by-partlabel/"Root"

Mount the file systems

mount /dev/disk/by-partlabel/"Root" /mnt
mount -mo uid=0,gid=0,dmask=0077,fmask=0077 /dev/disk/by-partlabel/"EFI" /mnt/boot

Installation

Select the mirrors

reflector \
  --save /etc/pacman.d/mirrorlist \
  --sort rate \
  -l 50 \
  -n 5 \
  -p https

Install essential packages

pacstrap -K /mnt \
    base \
    linux \
    linux-firmware
arch-chroot /mnt /usr/bin/pacman -S intel-ucode
arch-chroot /mnt /usr/bin/pacman -S iwd
arch-chroot /mnt /usr/bin/pacman -S neovim
echo "export EDITOR=nvim" > /mnt/etc/profile.d/editor.sh
arch-chroot /mnt /usr/bin/pacman -S man-db manpages texinfo
arch-chroot /mnt /usr/bin/pacman -S bash-completion
 
arch-chroot /mnt /usr/bin/pacman -S sudo
echo "%wheel ALL=(ALL:ALL) ALL" > /mnt/etc/sudoers.d/wheel
arch-chroot /mnt /usr/bin/useradd -G wheel -m "$MY_USER"
arch-chroot /mnt /usr/bin/passwd "$MY_USER"
 
arch-chroot /mnt /usr/bin/pacman -S starship
echo 'eval "$(starship init bash)"' > /mnt/etc/profile.d/prompt.sh
echo "export STARSHIP_CONFIG=/etc/starship.toml" >> /mnt/etc/profile.d/prompt.sh
arch-chroot /mnt /usr/bin/starship preset -o /etc/starship.toml plain-text-symbols
 
arch-chroot /mnt /usr/bin/pacman -S zoxide
echo 'eval "$(zoxide init bash)"' > /mnt/etc/profile.d/zoxide.sh

Configure the system

Fstab

genfstab -t PARTLABEL /mnt >> /mnt/etc/fstab

Time

ln -fs /usr/share/zoneinfo/"$MY_TIMEZONE" /mnt/etc/localtime
arch-chroot /mnt /usr/bin/hwclock -w

Localization

sed -i 's/^#\(en_US\.UTF-8\)/\1/' /mnt/etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf

Network configuration

echo "vcbcitrus" > /mnt/etc/hostname
arch-chroot /mnt /usr/bin/systemctl enable systemd-resolved
arch-chroot /mnt /usr/bin/systemctl enable iwd
cp -aT /var/lib/iwd /mnt/var/lib/iwd
mkdir /mnt/etc/iwd
echo "[General]" > /mnt/etc/iwd/main.conf
echo "EnableNetworkConfiguration=true" >> /mnt/etc/iwd/main.conf

Root password

arch-chroot /mnt /usr/bin/passwd -l root

Boot loader

arch-chroot -S /mnt /usr/bin/bootctl install
echo "default @saved" > /mnt/boot/loader/loader.conf
echo "editor no" >> /mnt/boot/loader/loader.conf
echo "title Arch Linux" > /mnt/boot/loader/entries/arch.conf
echo "linux /vmlinuz-linux" >> /mnt/boot/loader/entries/arch.conf
echo "initrd /intel-ucode.img" >> /mnt/boot/loader/entries/arch.conf
echo "initrd /initramfs-linux.img" >> /mnt/boot/loader/entries/arch.conf
echo 'options root="PARTLABEL=Root" rw' >> /mnt/boot/loader/entries/arch.conf
echo "title Arch Linux (fallback initramfs)" > /mnt/boot/loader/entries/arch-fallback.conf
echo "linux /vmlinuz-linux" >> /mnt/boot/loader/entries/arch-fallback.conf
echo "initrd /intel-ucode.img" >> /mnt/boot/loader/entries/arch-fallback.conf
echo "initrd /initramfs-linux-fallback.img" >> /mnt/boot/loader/entries/arch-fallback.conf
echo 'options root="PARTLABEL=Root" rw' >> /mnt/boot/loader/entries/arch-fallback.conf

Reboot

umount -R /mnt
reboot

Post-installation

参照