The official installation guide is here.
You will need to determine whether your computer is using BIOS or
UEFI. If ls /sys/firmware/efi/efivars returns something
your computer is running on UEFI, otherwise it is on BIOS.
The following guide is meant for machines using UEFI
This particular layout will be covered.
Use parted and format the disk you want to install Arch
to with
lsblk to get the name of said disk
parted /dev/disk-name
mklabel gpt
Exit parted and fire up fdisk with
fdisk /dev/sdX, where X is the ID of the
target harddisk, or fdisk /dev/nvme0n1.
n1 for disk number<ENTER> to use default values+512M or +1G for last sectort, L, and find EFI System
from the listn, 2, <ENTER>+XGB, where X is somewhere around 0.5-1 times the
amount of RAM you havet, L and find Linux swap from
the listn, 3, <ENTER>,
<ENTER> to use up remaining disk spacewYou can check here for alternatives.
For cross-reference
fdisk -l should return something similar to this:
Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: HFS256G39TND-N21
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 51B29D66-921E-48F3-A8D6-D31723075566
Device Start End Sectors Size Type
/dev/sda1 2048 2099199 2097152 1G EFI System
/dev/sda2 2099200 18876415 16777216 8G Linux swap
/dev/sda3 18876416 500118158 481241743 229.5G Linux filesystem
mkfs.fat -F32 /dev/your-boot-partition to format your
boot partition as FAT32
mkswap /dev/swap_partition && swapon /dev/swap_partition
mkfs.ext4 /dev/root_partition to format your root
partition
Check here for more information.
cryptsetup -y -v luksFormat /dev/root_partition
cryptsetup open /dev/root_partition root
mkfs.ext4 /dev/mapper/root
mount /dev/mapper/root /mnt
mount /dev/root_partition /mnt mounts your root
partition at /mnt (For those who skipped the encryption
step)
mkdir -p /mnt/boot/efi to create the EFI boot folder
mount /dev/efi_partition /mnt/boot/efi to mount it
mkdir -p /mnt/boot to create the boot folder
mount /dev/efi_partition /mnt/boot so that the kernel
gets installed to the unencrypted EFI partition rather than the
encrypted root partition
If you’re using ethernet and ping google.com returns
something, you can skip this step.
Try running ip link and see if your wifi card is
detected. Something like this should appear:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
link/ether 3c:6a:a7:8f:e5:17 brd ff:ff:ff:ff:ff:ff
If you see a similar output, you can proceed by starting
iwctl (iwctl is a command provided by the package
iwd)
Here’s what you should be running after launching
iwctl
[iwd]# device list
[iwd]# station *device* scan
[iwd]# station *device* get-networks
[iwd]# station *device* connect *SSID*
pacstrap /mnt base base-devel linux linux-firmware nano networkmanager nmtui
to install essential packages.
genfstab -p /mnt >> /mnt/etc/fstab to create the
fstab
arch-chroot /mnt to chroot into the root partition
Run systemctl enable NetworkManager.service to have
working internet on your next boot.
The timezones are listed in /usr/share/zoneinfo, link
your corresponding city to /etc/localtime with
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc to calibrate your hardware clock.
Note: Both -w and –-systohc are synonymous
nano /etc/locale.gen and uncomment your corresponding
locale. Ex. for those who are using American English, uncomment the
lines en_US.UTF-8 and en_US ISO-8859-1.
Then, run locale-gen to generate your locales.
Create a new file with nano /etc/locale.conf, and append
the lines LANG=en_US.UTF-8. Otherwise, see here.
If you want to set a permanent keyboard layout, go to
/etc/vconsole.conf and append
KEYMAP=your-keyboard-layout. Refer here
and here
for more information.
nano /etc/hostname and append the hostname you want for
your computer.
Then you go to /etc/hosts, and add:
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname
Change myhostname to the hostname you appended into
/etc/hostname.
pacman -S grub efibootmgr os-prober to install grub
nano /etc/default/grub and uncomment
GRUB_ENABLE_CYRPTODISK=y (only required for encrypted root
partitions)
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
to install grub bootloader, if you would want to change the ID of the
bootloader, alter the parameter
--bootloader-id=name-of-your-choice. Change
--efi-directory=/boot/efi to
--efi-directory=/boot if you’re doing the encrypted
installation.
grub-mkconfig -o /boot/grub/grub.cfg to generate the
GRUB config.
If you want GRUB to detect bootable partitions for other OSes, check here.
nano /etc/mkinitcpio.conf and add the hook
encrypt to the HOOKS variable as such (For
systemd-based initramfs check here):
HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block encrypt filesystems fsck)
Refer here for more options that you may require.
Then, regenerate the initramfs with mkinitcpio -P.
Next, run blkid and record down the UUID for
/dev/root_partition (not the UUID for /dev/mapper/root)
and /dev/swap_partition.
nano /etc/default/grub and append
cryptdevice=UUID=device-UUID:root root=/dev/mapper/root to
GRUB_CMDLINE_LINUX_DEFAULT where device-UUID
is the UUID you recorded just now.
For those who are using the sd-encrypt hook, refer here.
For support to suspend to disk, add the option
resume=UUID=swap-UUID to your
GRUB_CMDLINE_LINUX_DEFAULT.
After configuring all the options, don’t forget rerun
grub-mkconfig -o /boot/grub/grub.cfg.
Edit /etc/pacman.conf and uncomment out repositories you
want to include.
passwd to first set the password for root.
useradd -m -g users -s /bin/bash your-username to add a
user which can use the sudo command.
passwd your-username to set the password for the user
you’re going to use for your daily tasks. Run
xdg-user-dirs-update after rebooting to generate the
default folders for your home directory.
Before restarting, it is recommended to have a display manager and/or a windows manager installed. Refer here for a list of choices.
rmmod pcspkr to remove the
annoying keyboard beeps.rsync -aAHX --info=progress2 /location/of/backup /location/of/mounted/filesystem/mnt/etc/fstab and remove (or comment) old
entries, then run
genfstab -U /mnt >> /mnt/etc/fstabarch-chroot into the root your new systempacman -S $(pacman -Qnq) and
yay -S $(pacman -Qqm) (if you’re using yay), which
reinstalls all packages as sometimes files may become corrupted or
missing during transfersgrub-install (The guide above has explained how to
use grub-install) and
grub-mkconfig -o /boot/grub/grub.cfg to get your GRUB
installedA list of less commonly used pacman commands
# Installing a package
pacman -U pkg_name.pkg.tar.zst
pacman -U https://webpage/pkg_name.pkg.tar.zst
# To see which group a package belongs to
pacman -Sg pkg_name
# Removing packages
pacman -Rs # remove with its dependencies
pacman -Rsu # remove even more packages
# Query packages
pacman -Ss pkg_name # Search the online database
pacman -Qs pkg_name # Search the local database
pacman -Si pkg_name # Extensive information of the package online
pacman -Qi pkg_name # Extensive information of the local package
pacman -Qii pkg_name # Shows more extensive information
pacman -Ql pkg_name # Lists installed packages
pacman -Qtd # Find orphaned packages
pacman -Qe # List all parent packages
Edit /etc/pacman.conf and set
ParallelDownloads to a positive integer, i.e. 12 for
generally faster speeds.