Notice: I might make a big revision someday to review everything, fix anything that needs fixing, and explain the reason for each step. Maybe.
- Arch Linux now comes with an installer, so if you just want a minimal system ready in a few minutes, you're better off just doing
archinstall. - This guide is for UEFI only, not BIOS.
- The only officially supported architecture by Arch Linux is x86_64, so make sure your computer uses that architecture before attempting to install it.
- Some computers won't work out of the box because of bugs left by the manufacturers.
Example
My laptop spams tty1 with the following logs when the network card starts being used:pcieport 0000:00:1c.5: AER: Error of this agent reported first
pcieport 0000:00:1c.5: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Receiver ID)
pcieport 0000:00:1c.5: device [8086:9d15] error status/mask=00000001/00002000
pcieport 0000:00:1c.5: [ 0] RxErr (First)
rtl8723be 0000:03:00.0: PCIe Bus Error: severity=Corrected, type=Physical Layer, (Receiver ID)
rtl8723be 0000:03:00.0: device [10ac:b723] error status/mask=00000001/00006000
rtl8723be 0000:03:00.0: [ 0] RxErr (First)
Upon investigating, adding the kernel parameters pci=noaer or pcie_aspm=off solves this issue. ¯\(ツ)/¯
- Write the Arch Linux ISO into a USB drive. There are several tools available for this, like dd, balenaEtcher, Rufus, or Ventoy.
- Disable Secure Boot in the UEFI.
- Boot from the USB drive.
- After booting into the USB drive, type
loadkeys(with a space at the end) and tap the TAB key a couple of times to select your keymap. You'll be able to use the arrow keys to move the selection. The most commonly used keymaps are ini386/qwerty. - Take a note of the keymap name. For example, if the final command is
loadkeys i386/qwerty/pt-latin9.map.gz, the keymap name ispt-latin9(everything between the last/and the first.). We'll need this name later. - Do
ls /sys/firmware/efi | grep efito verify that you have indeed booted in UEFI mode. The output should beefivars.
Time to connect to the Internet:
- If you're not going to use DHCP, check the Arch Wiki on how to manually set a static IP.
- If you're using a wired connection (recommended), it should already be working.
- If you're using a wireless connection, the live system comes with
iwdenabled, so you can useiwctl.iwctl's man page (man iwctl) shows a simple example on how to connect to a network.- If scanning with
iwctlisn't working (you get no networks found), simply dosystemctl restart iwdand try again.
- If scanning with
- Do
ping -4c4 archlinux.orgto verify that everything is working properly.
- Now that we have an Internet connection, do
timedatectl set-ntp trueto update the live system clock. - You can then do
timedatectl statusto check the time (in the UTC timezone).
Onto partitioning the disk. This part is quite subjective, and can vary wildely depending on your needs. Consider reading more about this process instead of blindly following my instructions here.
I'll be using a single disk, creating only the necessary partitions (ESP and root). I'll also create a SWAP, but I'll use zram for it. You'll need a SWAP if you want hibernation, but zram will not work for it. I'm using zram because I don't care for hibernation. For more information read the SWAP and hibernation pages in the Arch Wiki.
- Do
lsblkand identify your disk. Most of the time your disk will be identified assda. If you're using NVMe, it'll most likely look something likenvme0n1. I'll usesdafor the example. - Do
gdisk /dev/sda, and then the commandsoandw. They will "erase" everything in the disk and create a new partition table. - Do
cgdisk /dev/sda:- Create the ESP partition:
- First sector is the default one.
- Size is
1G. - Type is
ef00. - Name is
ESP.
- Create the / (root) partition:
- First sector is the default one.
- Size is the default one.
- Type is the default one.
- Name is
ROOT.
- Hit
[Write], and then[Quit].
- Create the ESP partition:
- Now to format the partitions:
- Do
mkfs.vfat -F 32 -n ESP /dev/sda1to format the ESP. - Do
mkfs.ext4 -L ROOT /dev/sda2to format the / (root) partition.
- Do
- Mount the / (root) partition with
mount /dev/sda2 /mnt. - Do
mkdir /mnt/efito create a directory for the ESP. - Mount the ESP with
mount /dev/sda1 /mnt/efi. - Do
lsblk /dev/sdato verify everything is correct. If you did exactly what I did, you should have something like this:- ESP (sda1 @ /mnt/efi)
- / (root) (sda2 @ /mnt)
- Do
pacstrap -i /mnt base{,-devel} dkms linux{{,-lts}{,-headers},-firmware} zram-generator:- For the
libxtables.soprovider, selectiptables-nft. - For the
initramfsprovider, selectmkinitcpio. - If the installation fails, do
pacman-key --refresh-keysto ensure the keyring is up to date and try again.
- For the
- Create the fstab file with
genfstab -U /mnt >> /mnt/etc/fstab. - Create a zram config with
echo '[zram0]' > /mnt/etc/systemd/zram-generator.conf.
- Do
arch-chroot /mntto go into your system. - Install some important packages with
pacman -S efibootmgr git man-{db,pages} networkmanager openssh polkit vi vim zsh{,-{autosuggestions,completions,history-substring-search,syntax-highlighting}}.
- Do
ln -svf /usr/share/zoneinfo/$(tzselect | tail -1) /etc/localtimeto set your timezone. - Then, do
hwclock -wto update the hardware clock. - You can do
hwclock -rto see the current time stored by the hardware clock. You'll notice that it takes the timezone into account.
- Open the file
/etc/locale.gen. Uncomment theen_US.UTF-8and any other locales you want to use. - Do
locale-gento generate the uncommented locales. - Do
echo LANG=LOCALE > /etc/locale.conf, LOCALE being your preferred locale from the ones you just generated. - Do
echo KEYMAP=KEYMAP > /etc/vconsole.conf, KEYMAP being the name of the keymap you're using (set when you used theloadkeyscommand earlier). - Do
echo FONT=lat0-16 >> /etc/vconsole.conf. You can find all fonts available in/usr/share/kbd/consolefonts.
- Do
echo HOSTNAME > /etc/hostname, HOSTNAME being the name you want your system to have. - The hostname must be compatible with the following regex expression:
^(:?[0-9a-zA-Z][0-9a-zA-Z-]{0,61}[0-9a-zA-Z]|[0-9a-zA-Z]{1,63})$. - You can click here and put the hostname you want your computer to have in the text field to see if you can actually use it.
- Edit the file
/etc/hoststo contain the following:
# Static table lookup for hostnames.
# See hosts(5) for details.
127.0.0.1 localhost.localdomain localhost localhost-ipv4
::1 localhost.localdomain localhost localhost-ipv6
127.0.0.1 HOSTNAME.localdomain HOSTNAME HOSTNAME-ipv4
::1 HOSTNAME.localdomain HOSTNAME HOSTNAME-ipv6
HOSTNAME being the hostname you chose in the previous command.
- Enable some services with
systemctl enable sshd NetworkManager. - Do
lsblk -D. If the disk or disks you are using have non-zero values in the DISC-GRAN and DISC-MAX columns, dosystemctl enable fstrim.timer. - Edit the file
/etc/mkinitcpio.confand:- Add to the
MODULESlist:amdgpuif you're using an AMD GPU.i915if you're using an Intel GPU.nvidia nvidia_modeset nvidia_uvm nvidia_drmif you're using an NVidia GPU.
- Change
udevtosystemdin theHOOKSlist.
- Add to the
- Do
passwdto give therootuser a password.
-
Time to install the microcode updater:
- If you're using an Intel CPU, do
pacman -S intel-ucode. - If you're using an AMD CPU, do
pacman -S amd-ucode.
- If you're using an Intel CPU, do
-
Update the initramfs by doing
mkinitcpio -P.
Most people go with GRUB (and I'll provide the steps for using it), but I'll use EFI stubs with unified kernel images.
If you're using GRUB:
- Do
pacman -S grub efibootmgr os-prober. - Then do
grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB. - Do
grub-mkconfig -o /boot/grub/grub.cfg.
If you want to use EFI stub with UKI:
- Create a directory for kernel paramaters with
mkdir -p /etc/cmdline.d. - Do
echo root=UUID=$(blkid -s UUID -o value /dev/sda2) rw > /etc/cmdline.d/root.conf. - Edit the file
/etc/mkinitcpio.d/linux.preset:- For each PRESET line present in the line
PRESETS=(...)- Uncomment the lines with
PRESET_uki=. - Comment the lines with
PRESET_image=. - Uncomment the lines with
PRESET_options=.
- Uncomment the lines with
- Read the UKI article in the Arch Wiki for more info.
- For each PRESET line present in the line
- Do the same for
/etc/mkinitcpio.d/linux-lts.preset. - Create the folder for the UKIs with
mkdir -p /efi/EFI/Linux. - Remove the existing initramfs with
rm /boot/initramfs-*. - Generate the UKIs by doing
mkinitcpio -P. - Create a boot entry with
efibootmgr --create --disk /dev/sda --part 1 --label "Arch Linux" --loader '\EFI\Linux\arch-linux.efi' --unicode. - Do the same for the LTS and fallbacks.
- Set the boot order
efibootmgr -o ....- These last commands (
efibootmgr) might not work, and you might have to configure your UEFI.
- These last commands (
- Do
exitand thenumount -R /mnt. - You can now do
poweroff.
- Start by logining in as
root. - Change
root's shell by doingchsh -s /bin/zsh. - Do
timedatectl set-ntp trueandtimedatectl statusagain to make sure the time is setup correctly. The RTC and Universal time should be in UTC and the Local time in your timezone.
- Now add a user by doing
useradd -m -U -G wheel -s /bin/zsh -c "REAL NAME" USERNAME, REAL NAME being the user's real name, and USERNAME a valid username. - Usernames in Unix-like OSs are valid if they're compatible with the regex expression
^[a-z_]([0-9a-z_-]{0,31}|[0-9a-z_-]{0,30}\$)$. - You can check if a username is valid by clicking here.
- Set the user's password with
passwd USERNAME. - Do
visudo, or, if you don't know how to usevi, doEDITOR=nano visudo, and do the following changes:- Add the line
Defaults pwfeedback, preferably before## Runas alias specification, if you want asterisks when inputting your password. - Uncomment the line
# %wheel ALL=(ALL) ALL.
- Add the line
- Do
nmtuiand setup your Internet connection. - Open the file
/etc/pacman.confand perform the following:- Uncomment the line
#Color, and create a new line below with the contentILoveCandy(yes, I'm serious). - Uncomment the line
#ParallelDownloads = 5. - Uncomment the line
#[multilib]and the line below it.
- Uncomment the line
- Do
pacman -Syuto updatepacman's configuration and to perform any updates available. - Logout with
logout.
- Login as the user you've created. In the ZSH configuration, continue to configure zsh or press q to quit if you already have a configuration in your dotfiles.
- Do
sudo pacman -S bat fastfetch helix lm_sensors. - Do
mkdir ~/.config/{nano,zsh}. - Configure the files
~/.zshenv,~/.config/nano/nanorc, and~/.config/zsh/.zshrc. - Or, instead of configuring them, use your saved dotfiles if you have any. Mine are here.
- Do
rm ~/.bash* - Logout and log in as
root.- Do
rm ~/.bash*. - Do
mkdir -p ~/.config/zsh. - Do
cp /home/USERNAME/.zshenv ~. - Do
cp /home/USERNAME/.config/zsh/.zshrc ~/.config/zsh.
- Do
- Logout as log back in as the created user.
- Now let's install
paru, which is a pacman wrapper. - Do
git clone --depth=1 https://aur.archlinux.org/paru-bin.git, thencd paru-bin, and thenmakepkg -sir. - After the installation is done, do
cd .., and thenrm -rf paru-bin. - From now on you'll be using
paruinstead ofsudo pacman. - I also recommend you configure
parubefore actually using it. - Do
paru -S xdg-user-dirsand thenxdg-user-dirs-update. - Do
paru -S archlinux-contrib pacman-cleanup-hook.
- If you use an AMD GPU, edit
/etc/udev/rules.d/30-amdgpu-pm.rulesand add:
KERNEL=="card0", SUBSYSTEM=="drm", DRIVERS=="amdgpu", ATTR{device/power_dpm_force_performance_level}="high"
- Reboot.
Huge thanks. A great guide