8.5 KiB
Install Arch Linux
Install Arch Linux is thing I always want to do for my laptop/PC since I had my laptop in ninth grade.
This is not a guide for everyone, this is just save for myself in a future and for anyone who want to walk in my shoes.
Installation guide
Pre-installation
Check disks carefully:
lsblk
Verify the boot mode
Check UEFI mode:
ls /sys/firmware/efi/efivars
Connect to the internet
For wifi, use iwd.
Partition the disks
cgdisk /dev/sdx
UEFI/GPT layout:
Mount point | Partition | Partition type | Suggested size |
---|---|---|---|
/mnt/efi |
/dev/efi_system_partition |
EFI System Partition | 512 MiB |
/mnt/boot |
/dev/extended_boot_loader_partition |
Extended Boot Loader Partition | 1 GiB |
/mnt |
/dev/root_partition |
Root Partition |
Why not /boot/efi
? See
Lennart Poettering comment.
BIOS/GPT layout:
Mount point | Partition | Partition type | Suggested size |
---|---|---|---|
BIOS boot partition | 1 MiB | ||
/mnt |
/dev/root_partition |
Root Partition |
LVM:
# Create physical volumes
pvcreate /dev/sdaX
# Create volume groups
vgcreate RootGroup /dev/sdaX /dev/sdaY
# Create logical volumes
lvcreate -l +100%FREE RootGroup -n rootvol
Format:
# efi
mkfs.fat -F32 /dev/efi_system_partition
# boot
mkfs.fat -F32 /dev/extended_boot_loader_partition
# root
mkfs.ext4 -L ROOT /dev/root_partition
# root with btrfs
mkfs.btrfs -L ROOT /dev/root_partition
# root on lvm
mkfs.ext4 /dev/RootGroup/rootvol
Mount:
# root
mount /dev/root_partition /mnt
# root with btrfs
mount -o compress=zstd /dev/root_partition /mnt
# root on lvm
mount /dev/RootGroup/rootvol /mnt
# efi
mount --mkdir /dev/efi_system_partition /mnt/efi
# boot
mount --mkdir /dev/extended_boot_loader_partition /mnt/boot
Installation
pacstrap -K /mnt base linux linux-firmware
# AMD
pacstrap -K /mnt amd-ucode
# Intel
pacstrap -K /mnt intel-ucode
# Btrfs
pacstrap -K /mnt btrfs-progs
# LVM
pacstrap -K /mnt lvm2
# Text editor
pacstrap -K /mnt neovim
Configure
fstab
genfstab -U /mnt >> /mnt/etc/fstab
Chroot
arch-chroot /mnt
Time zone
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
Localization:
Edit /etc/locale.gen
:
# Uncomment en_US.UTF-8 UTF-8
Generate locales:
locale-gen
Edit /etc/locale.conf
:
LANG=en_US.UTF-8
Network configuration
Edit /etc/hostname
:
myhostname
Initramfs
Edit /etc/mkinitcpio.conf
:
# LVM
# https://wiki.archlinux.org/title/Install_Arch_Linux_on_LVM#Adding_mkinitcpio_hooks
HOOKS=(base udev ... block lvm2 filesystems)
# https://wiki.archlinux.org/title/mkinitcpio#Common_hooks
# Replace udev with systemd
mkinitcpio -P
Root password
passwd
Addition
NetworkManager (WIP)
pacman -Syu networkmanager dhcpcd iwd
systemctl enable NetworkManager.service
systemctl enable systemd-resolved.service
Edit /etc/NetworkManager/conf.d/dns.conf
:
[main]
dns=systemd-resolved
Edit /etc/NetworkManager/conf.d/dhcp-client.conf
:
[main]
dhcp=dhcpcd
Edit /etc/NetworkManager/conf.d/wifi_backend.conf
:
[device]
wifi.backend=iwd
See dhcpcd
Append /etc/dhcpcd.conf
noarp
nohook resolv.conf
Bluetooth
pacman -Syu bluez
systemctl enable bluetooth.service
Clock
timedatectl set-ntp true
Boot loader
systemd-boot
Install using XBOOTLDR:
bootctl --esp-path=/efi --boot-path=/boot install
systemctl enable systemd-boot-update.service
Edit /efi/loader/loader.conf
:
default archlinux.conf
timeout 4
editor no
console-mode max
Edit /boot/loader/entries/archlinux.conf
:
title Arch Linux
linux /vmlinuz-linux
# Intel
initrd /intel-ucode.img
# AMD
initrd /amd-ucode.img
initrd /initramfs-linux.img
# Kernel parameters
#
# Acer Nitro AN515-45
# https://wiki.archlinux.org/title/backlight#Kernel_command-line_options
# acpi_backlight=vendor
#
# NVIDIA
# https://wiki.archlinux.org/title/NVIDIA#DRM_kernel_mode_setting
# nvidia-drm.modeset=1
options root="LABEL=ROOT" rw
General recommendations
Always remember to check dependencies when install packages.
System administration
Sudo:
pacman -Syu sudo
EDITOR=nvim visudo
# Uncomment group wheel
# Add user if don't want to use systemd-homed
useradd -m -G wheel -c "The Joker" joker
# Or using zsh
useradd -m -G wheel -s /usr/bin/zsh -c "The Joker" joker
# Set password
passwd joker
systemctl enable systemd-homed.service
homectl create joker --real-name="The Joker" --member-of=wheel
# Using zsh
homectl update joker --shell=/usr/bin/zsh
Note: Can not run homectl
when install Arch Linux. Should run on the first
boot.
Desktop Environment
Install Xorg:
pacman -Syu xorg-server
GNOME
pacman -Syu gnome-shell \
gnome-control-center gnome-system-monitor power-profiles-daemon \
gnome-tweaks gnome-backgrounds gnome-firmware \
nautilus xdg-user-dirs-gtk xdg-desktop-portal \
gnome-console gnome-text-editor loupe evince
# Login manager
pacman -Syu gdm
systemctl enable gdm.service
Quirks:
- Fix black screen when open game in fullscreen in external monitor with kazysmaster/gnome-shell-extension-disable-unredirect
List of applications
pacman
Uncomment in /etc/pacman.conf
:
# Misc options
Color
ParallelDownloads
Pipewire (WIP)
pacman -Syu pipewire wireplumber \
pipewire-alsa pipewire-pulse \
gst-plugin-pipewire pipewire-v4l2
See Advanced Linux Sound Architecture
pacman -Syu sof-firmware
Flatpak (WIP)
pacman -Syu flatpak
Improving performance
- https://wiki.archlinux.org/index.php/swap#Swap_file
- https://wiki.archlinux.org/index.php/swap#Swappiness
- https://wiki.archlinux.org/index.php/Systemd/Journal#Journal_size_limit
- https://wiki.archlinux.org/index.php/Core_dump#Disabling_automatic_core_dumps
- https://wiki.archlinux.org/index.php/Solid_state_drive#Periodic_TRIM
- https://wiki.archlinux.org/index.php/Silent_boot
- https://wiki.archlinux.org/title/Improving_performance#Watchdogs
- https://wiki.archlinux.org/title/sysctl
/etc/sysctl.d/99-sysctl.conf
:
# https://lwn.net/Articles/911219/
kernel.split_lock_mitigate = 0
Hardware dependent
- https://wiki.archlinux.org/title/Laptop
- https://wiki.archlinux.org/title/ASUS_Linux
- https://wiki.archlinux.org/title/PRIME
Experiment
Do it at your own risk!!!
- https://wiki.archlinux.org/title/Pacman/Pacnew_and_Pacsave
- https://github.com/AdnanHodzic/auto-cpufreq
- https://github.com/nbfc-linux/nbfc-linux
In the end
This guide is updated regularly I promise.