This guide explains how to install Arch Linux from scratch, covering disk partitioning, base system installation, and essential system configuration. This setup is ideal for users seeking a minimal and fully customizable Linux environment, ensuring maximum control, performance, and long-term maintainability.
1. Preparation
1.1 Installation USB
Write Arch Linux ISO to a USB drive:
sudo dd if=archlinux-2025.iso of=/dev/sdX bs=4M status=progress oflag=sync
๐ก Tips:
ifโ input ISO fileofโ target USB device (e.g.,/dev/sdb)bs=4Mโ block sizestatus=progressโ show progressoflag=syncโ ensure all data is written
โ ๏ธ Note: Double-check
of=/dev/sdX. Wrong device = data loss.
1.2 Networking
- Wired: plug in the Ethernet cable; DHCP should work automatically.
- Wireless (live environment):
iwctl
station wlan0 connect yourssid
ping archlinux.org
๐ก Tips: Ensure the network works before continuing.
1.3 Disk Partitioning
Partition the disk using fdisk (GPT):
sudo fdisk /dev/nvme0n1
Inside fdisk:
gโ create GPT partition table- Create EFI partition (~512MB)
- Create Root partition (remaining space)
wโ write changes
๐ก Tips: After partitioning, verify:
sudo fdisk -l /dev/nvme0n1
2. Filesystem & Mount Module
Format partitions:
mkfs.fat -F32 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2
Mount partitions:
mount /dev/nvme0n1p2 /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
๐ก Tips: EFI partition must be mounted at
/boot.
3. Mirror Optimization Module
Optimize mirrors for faster downloads:
reflector -c China -l 5 -f 5 --sort rate --save /etc/pacman.d/mirrorlist
๐ก Tips: Use the fastest mirrors to speed up installation and updates.
4. Base System Module
Install base packages:
pacstrap /mnt base base-devel linux linux-firmware vim sudo
Optional packages:
pacstrap /mnt wpa_supplicant # for wireless
pacstrap /mnt grub efibootmgr # for bootloader
Generate fstab:
genfstab -U /mnt >> /mnt/etc/fstab
๐ก Tips: fstab is essential for mounting partitions.
5. System Configuration Module
Enter the new system:
arch-chroot /mnt
5.1 Timezone
ln -sf /usr/share/zoneinfo/Asia/Taipei /etc/localtime
hwclock --systohc
5.2 Localization
Edit /etc/locale.gen and uncomment:
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
Generate locales:
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
5.3 Hostname & Hosts
echo arch > /etc/hostname
cat <<EOF > /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 arch.localdomain arch
EOF
5.4 Root & User
passwd # set root password
useradd -m -G wheel -s /bin/bash yourname
passwd yourname
Enable sudo for wheel group:
visudo
# uncomment: %wheel ALL=(ALL) ALL
๐ก Tips: Avoid using root for daily operations.
6. Bootloader Module
Install GRUB for UEFI:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
Exit and unmount:
exit
umount -R /mnt
reboot
๐ก Tips: EFI partition must be mounted at
/boot.
7. Network Module
7.1 Wireless
sudo wpa_passphrase "yourssid" "yourpassword" | sudo tee /etc/wpa_supplicant/wpa_supplicant-wlp2s0.conf
sudo systemctl enable --now wpa_supplicant@wlp2s0.service
sudo systemctl enable --now systemd-networkd
7.2 Wired
Create /etc/systemd/network/20-dhcp.network:
[Match]
Name=*
[Network]
DHCP=yes
LinkLocalAddressing=no
IPv6AcceptRA=no
Enable:
sudo systemctl enable --now systemd-networkd
7.3 DNS
sudo systemctl enable --now systemd-resolved
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
resolvectl status
๐ก Tips: Make sure resolv.conf points to systemd-resolved.
8. Backup & Rollback
8.1 Backup
sudo mkdir -p /root/backup
sudo cp /etc/fstab /root/backup/fstab.bak
sudo cp -r /etc/systemd/network /root/backup/network-config/
sudo cp /etc/hostname /root/backup/hostname.bak
sudo cp /etc/locale.conf /root/backup/locale.bak
8.2 Restore
sudo cp /root/backup/fstab.bak /etc/fstab
sudo cp /root/backup/hostname.bak /etc/hostname
sudo cp -r /root/backup/network-config/* /etc/systemd/network/
sudo systemctl restart systemd-networkd
๐ก Tips: Backup before modifying critical configurations.
9. Troubleshooting
9.1 Network Issues
sudo systemctl status systemd-networkd
sudo systemctl status wpa_supplicant@wlp2s0.service
resolvectl status
9.2 GRUB Boot Failure
- Check EFI partition is mounted at
/boot - Verify GRUB installation:
ls /boot/EFI/GRUB
9.3 fstab Issues
- Test mount:
sudo mount -a
- Check UUIDs with blkid
9.4 Wireless Failure
- Verify wpa_supplicant config
- Check logs:
journalctl -xe
๐ก Tips: Network setup must be configured correctly after first boot.