References:
Download archlinux iso file from: Download page.
You can use etcher to create USB flash device.
Disable the reflector to prevent the mirror from auto-updating:
systemctl stop reflector
curl http://baidu.com
timedatectl set-ntp true
timedatectl status
Edit /etc/pacman.d/mirrorlist
:
Server = https://mirrors.ustc.edu.cn/archlinux/$repo/os/$arch
Please refer to: Example layouts.
lsblk
cfdisk /dev/your_main_disk
mkfs.fat -F32 /dev/boot_partition
mkfs.ext4 /dev/root_partition
mkswap /dev/swap_partition # Optional
mkfs.ext4 /dev/home_partition # Optional
mount /dev/root_partition /mnt
mount --mkdir /dev/boot_partition /mnt/boot
swapon /dev/swap_partition # Optional
mount --mkdir /dev/home_partition /mnt/home # Optional
pacstrap /mnt base base-devel linux linux-firmware
pacstrap /mnt networkmanager vim sudo zsh zsh-completions
If pacstrap reports GPG error, execute:
pacman -S archlinux-keyring
genfstab -U /mnt > /mnt/etc/fstab
cat /mnt/etc/fstab
arch-chroot /mnt
# Set hostname
vim /etc/hostname
# 127.0.0.1 localhost
# ::1 localhost
# 127.0.0.1 your_hostname.localdomain your_hostname
vim /etc/hosts
# time zone
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
hwclock --systohc
# Uncomment: en_US.UTF-8 UTF-8
vim /etc/locale.gen
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
# Set password for root
passwd root
# Install ucode
pacman -S intel-ucode # Intel
pacman -S amd-ucode # AMD
# Install boot loader
pacman -S grub efibootmgr os-prober
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ARCH
# GRUB_CMDLINE_LINUX_DEFAULT="loglevel=5 nowatchdog"
# GRUB_DISABLE_OS_PROBER=false (Optional, if you need to boot Windows)
vim /etc/default/grub
grub-mkconfig -o /boot/grub/grub.cfg
# Normal user
useradd -m -G wheel -s /bin/bash your_user
passwd your_user
# Uncomment: %wheel ALL=(ALL:ALL) ALL
EDITOR=vim visudo
# Complete installation
exit
umount -R /mnt
reboot