The Arch Wiki has this information spread across multiple pages, and I think this is much more clearly laid out and straight forward. It also contains some packages and decisions that are personal preference.
The Arch Wiki is a very powerful resource. If you have any problems it's the first place to search for solutions: https://wiki.archlinux.org
Especially for the installation please read: https://wiki.archlinux.org/index.php/installation_guide
Sometimes packages need manual intervention which is announced at https://www.archlinux.org/news/
This tutorial is inspired by https://arch.d3sox.me/ and have taken out most stuff of it.
Download the latest Arch Linux ISO version and create a bootable USB drive. Make sure you enable USB boot in BIOS settings and set USB Disk as boot priority.
Before booting from an usb stick you better check your hardware settings. Boot into your hardware settings or BIOS or UEFI settings. Then check following settings. It can have different names and different keyboard shortcuts to reach it.
-
Set Boot Mode to UEFI. Most modern systems use UEFI, so it's generally on by default.
-
Disable Secure Boot. If secure boot is enabled it must be turned off since Linux boot loaders don't typically have digital signatures. Note that if you intend on running a dual-boot system with Windows and Linux you won't be able to use disk encryption on the partition containing Windows, as it requires secure boot.
-
Disable Launch CSM or Legacy Support.
-
Disable Fast Startup Mode. If you are dual booting with Windows turn off Fast Startup. This feature puts Windows into hibernation when you power off. Because some systems are still active during hibernation, booting into Linux can cause various nasty problems.
After booting Arch from the USB drive...
The default keymap is US. Available layouts can be listed with:
localectl list-keymaps
or
find /usr/share/kbd/keymaps/ -type f | more
โจ๏ธ Set your keymap (e.g. fr
) with:
loadkeys fr
Available fonts can be listed with:
ls /usr/share/kbd/consolefonts/
๐ค Set the console font with:
setfont ter-v18b
ls /sys/firmware/efi/efivars
or
efivar -l
If the directory does not exist, the system may be booted in Legacy BIOS Mode. Most likely you want to do a UEFI install so please double-check if your system supports UEFI and you selected the correct entry in the boot menu (In most cases prefixed with UEFI).
- Ensure your network interface is listed and enabled, for example with:
ip link
- For wireless and WWAN, make sure the card is not blocked with
rfkill
.
rfkill unblock wlan
-
Connect to the network:
-
Ethernet: plug in the cable.
-
Wi-Fi: authenticate to the wireless network using
iwctl
.
-
iwctl
device list
# Your device name might be different (replace wlan0)
station wlan0 scan
station wlan0 get-networks
# Replace <SSID> with your network name from the previous command
station wlan0 connect <SSID>
exit
ping -c 4 archlinux.org
๐ Ensure the system clock is accurate:
timedatectl set-ntp true
๐ Set your time zone:
timedatectl set-timezone Africa/Tunis
Tip: When recognized by the live system, disks are assigned to a block device such as /dev/sda, /dev/nvme0n1 or /dev/mmcblk0.
To get an overview use fdisk
or lsblk
to list your partition table and find out the device you want to use.
fdisk -l
or
lsblk
wipefs -a /dev/the_disk_to_be_partitioned
If that is not working for you, you can try this one as well:
sgdisk -Z /dev/the_disk_to_be_partitioned
fdisk /dev/the_disk_to_be_partitioned
gdisk /dev/the_disk_to_be_partitioned
cfdisk /dev/the_disk_to_be_partitioned
cgdisk /dev/the_disk_to_be_partitioned
- BIOS: You can use both GPT and MBR (DOS)
- UEFI: You need to use GPT
Needed | Partition | Partition type | Code (fdisk) | Flags | Mount point |
---|---|---|---|---|---|
โ | /dev/sdXY | Linux swap | 82 | - | - |
โ๏ธ | /dev/sdXY | Linux filesystem | 83 | Bootable (a) | /mnt |
โ | /dev/sdXY | Linux filesystem | 83 | - | /mnt/home |
Needed | Partition | Partition type | Code (fdisk/gdisk) | Mount point |
---|---|---|---|---|
โ๏ธ | /dev/sdXY | BIOS boot | 4 / ef02 | - |
โ | /dev/sdXY | Linux swap | 82 / 8200 | - |
โ๏ธ | /dev/sdXY | Linux filesystem | 83 / 8300 | /mnt |
โ | /dev/sdXY | Linux filesystem | 83 / 8300 | /mnt/home |
Needed | Partition | Partition type | Code (fdisk/gdisk) | Mount point |
---|---|---|---|---|
โ๏ธ | /dev/sdXY | EFI partition | 1 / ef00 | /mnt/boot/efi |
โ | /dev/sdXY | Linux swap | 82 / 8200 | - |
โ๏ธ | /dev/sdXY | Linux filesystem | 83 / 8300 | /mnt |
โ | /dev/sdXY | Linux filesystem | 83 / 8300 | /mnt/home |
* EFI partition:
- At least 300 MiB.
- If multiple kernels will be installed, then no less than 1 GiB.
* BIOS boot:
- 1MB (unformatted)
* Swap:
System RAM | Recommended swap space | Swap space if using hibernation |
---|---|---|
< 2GB | 2x the amount of RAM | 3x the amount of RAM |
2-8GB | Equal to amount of RAM | 2x the amount of RAM |
8-64GB | At least 4GB | 1.5x the amount of RAM |
64GB | At least 4GB | Hibernation not recommended |
๐ฝ This will create the file system where the system will be installed on.
To create a btrfs file system on /dev/root_partition
, run
mkfs.btrfs -f /dev/root_partition
If you created an EFI system partition, format it to FAT32 using mkfs.fat
mkfs.fat -F32 /dev/efi_system_partition
If you created a partition for swap, initialize it with mkswap
:
mkswap /dev/swap_partition
mount /dev/root_partition /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@root
btrfs subvolume create /mnt/@srv
btrfs subvolume create /mnt/@log
btrfs subvolume create /mnt/@cache
btrfs subvolume create /mnt/@tmp
btrfs subvolume create /mnt/@snapshots
btrfs subvolume create /mnt/@swap
Let us unmount /mnt and remount all the subvolumes with options. For example if the root volume is /dev/root_partition
:
umount /mnt
mount -o defaults,noatime,compress=zstd,subvol=@ /dev/root_partition /mnt
mkdir -p /mnt/{home,root,srv,var/log,var/cache,tmp,.snapshots,swap}
mount -o defaults,noatime,compress=zstd,subvol=@home /dev/root_partition /mnt/home
mount -o defaults,noatime,compress=zstd,subvol=@root /dev/root_partition /mnt/root
mount -o defaults,noatime,compress=zstd,subvol=@srv /dev/root_partition /mnt/srv
mount -o defaults,noatime,compress=zstd,subvol=@log /dev/root_partition /mnt/var/log
mount -o defaults,noatime,compress=zstd,subvol=@cache /dev/root_partition /mnt/var/cache
mount -o defaults,noatime,compress=zstd,subvol=@tmp /dev/root_partition /mnt/tmp
mount -o defaults,noatime,compress=zstd,subvol=@snapshots /dev/root_partition /mnt/.snapshots
mount -o defaults,noatime,subvol=@swap /dev/root_partition /mnt/swap
Create any remaining mount points (such as /mnt/boot) and mount the volumes in their corresponding hierarchical order
mkdir /mnt/boot
mount /dev/boot_partition /mnt/boot
or shortly:
mount --mkdir /dev/boot_partition /mnt/boot
mkdir -p /mnt/boot/efi
mount /dev/efi_system_partition /mnt/boot/efi
or shortly:
mount --mkdir /dev/efi_system_partition /mnt/boot/efi
- If you created a swap volume, enable it with swapon:
swapon /dev/swap_partition
- As an alternative to creating an entire partition, a swap file offers the ability to vary its size on-the-fly, and is more easily removed altogether. To create a swap file:
### Ram-size in bytes:
RAM_SIZE=$(free -b -t | awk 'NR == 2 {print $2}')
### Create a swap file equal to the ram size:
btrfs filesystem mkswapfile --size $RAM_SIZE --uuid clear /mnt/swap/swapfile
### When activating the swap file you can use -p or --priority flag to set the swap file priority, by default it is -2
swapon -p 100 /mnt/swap/swapfile
You can select the mirrors that are closest to you geographically. BUT it does not mean they will be the fastest. Normally I will change nothing until the speed is not satisfactory. On the live system, after connecting to the internet, reflector updates the mirror list by choosing 20 most recently synchronized HTTPS mirrors and sorting them by download rate. Read the info about mirror servers as this is quite important.
reflector --latest 20 --protocol http,https --sort rate --save /etc/pacman.d/mirrorlist
โณ This will install the system and may take a while.
- Enable parallel downloads for faster installation:
sed -i 's/^#ParallelDownloads/ParallelDownloads/' /etc/pacman.conf
โ ๏ธ Warning: To ensure system stability append the microcode package for your CPU to the following command.
- amd-ucode for AMD CPUs
- intel-ucode for Intel CPUs
See https://wiki.archlinux.org/index.php/Microcode
pacstrap -K /mnt base base-devel linux linux-firmware linux-headers intel-ucode btrfs-progs sudo nano bash-comlpetion terminus-font
This will create the filesystem table which contains all the partitions and mountpoints:
genfstab -U /mnt >> /mnt/etc/fstab
Edit the fstab configuration to add an entry for the swap file (if created):
echo '/swap/swapfile none swap defaults 0 0' >>/mnt/etc/fstab
After you entered this command, you are basically in the installed system.
arch-chroot /mnt
๐ Set the time zone (You can tab-complete your stuff after typing zoneinfo):
ln -sf /usr/share/zoneinfo/Africa/Tunis /etc/localtime
hwclock --systohc
๐ Edit /etc/locale.gen
and uncomment (remove the # in front of) all languages you need:
nano /etc/locale.gen
๐ Generate locales
locale-gen
๐ Set the system language
echo 'LANG=en_US.UTF-8' >> /etc/locale.conf
echo 'LC_ADDRESS=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_IDENTIFICATION=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_MEASUREMENT=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_MONETARY=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_NAME=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_NUMERIC=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_PAPER=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_TELEPHONE=en_US.UTF-8' >> /etc/loacle.conf
echo 'LC_TIME=en_US.UTF-8' >> /etc/loacle.conf
โจ๏ธ Set tty keymap ( e.g. fr
) and console font ( e.g. ter-v18b
)
echo 'KEYMAP=fr' >> /etc/vconsole.conf
echo 'FONT=ter-v18b' >> /etc/vconsole.conf
๐ Create the hostname file. The hostname will be the name of your PC on your network.
echo 'ArchLinux' >> /etc/hostname
# Edit /etc/hosts file using echo command or open it with nano and add the lines:
echo '127.0.0.1 localhost' >> /etc/hosts
echo '::1 localhost' >> /etc/hosts
echo '127.0.1.1 ArchLinux.localdomain ArchLinux' >> /etc/hosts
๐ถ Complete the network configuration for the newly installed environment. That may include installing suitable network management software.
We will use the application NetworkManager
afterwards in any of our desktops we would like to install. Therefore it makes sense to install and activate this application right now. Then, you can use nmtui
or wifi-menu
to configure your network profile.
Make sure you type NetworkManager
in the second line. It is case sensitve. You will get 3 symlink lines as a result. When we boot we will have internet on board.
pacman -S networkmanager
systemctl enable NetworkManager
๐ด Install necessary drivers for wireless card if needed (e.g. for my Broadcom BCM4312 card)
pacman -S --needed dkms
pacman -S --needed broadcom-wl-dkms
#pacman -S --needed broadcom-wl
To find out what hardware you have in your computer:
lspci -v | grep -i network
Modify mkinitcpio.conf
:
nano /etc/mkinitcpio.conf
- Add
btrfs
to MODULES - Add
setfont
to BINARIES - Replace
keymap
andconsolefont
HOOKS withsd-vconsole
- Uncomment the following line:
#COMPRESSION="ZSTD"
And recreate the initramfs image with:
mkinitcpio -P
๐ Use a strong and complicated password
passwd
pacman -S --needed grub os-prober efibootmgr mtools dosfstools
# Change the directory to /boot if you mounted the EFI partition at /boot
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
pacman -S --needed grub os-prober mtools dosfstools
# Replace sdX with your disk name, not the partition
grub-install --target=i386-pc /dev/sdX
grub-mkconfig -o /boot/grub/grub.cfg
exit
umount -R /mnt
reboot
And log in back with root.
๐ฆ This will be the user you'll use to log in. For group reference see https://wiki.archlinux.org/index.php/Users_and_groups#Group_list
useradd -m -g users -G audio,video,network,wheel,storage,rfkill -s /bin/bash anisbsalah
passwd anisbsalah
๐ง This will give your user administrative privileges.
EDITOR=nano visudo
โญ Uncomment (remove the # in front of) the following line:
%wheel ALL=(ALL:ALL) ALL
And log in back with user account.
Edit pacman configuration file:
nano /etc/pacman.conf
๐ Depending on your internet connection enabling parallel downloads may speed up the package download process.
โญ Uncomment (remove the # in front of) this line and set it to your desired value:
#ParallelDownloads = 5
๐ฌ If you want some extra candy you can uncomment Color
and VerbosePkgLists
and add ILoveCandy
under Misc options
.
๐พ multilib
is a repository which contains 32-bit libraries and is disabled by default (needed for some games & software; highly recommended to enable).
If you plan on using 32-bit applications, you will want to enable the multilib repository.
โญ Uncomment (remove the # in front of) the following lines:
#[multilib]
#Include = /etc/pacman.d/mirrorlist
sudo pacman -Syu
Xorg is the public, open-source implementation of the X Window System (commonly X11, or X). It is required for running applications with graphical user interfaces (GUIs), and the majority of users will want to install it.
sudo pacman -S --needed xorg xorg-apps xorg-server xorg-xinit xorg-xkill xorg-xwayland
The default modesetting display driver will work with most video cards, but performance may be improved and additional features harnessed by installing the appropriate driver for AMD or NVIDIA products.
โ ๏ธ Warning: The linux kernel can handle many graphical cards, so try first without any extra installation.
To find out what hardware you have in your computer:
lspci -v | grep -e VGA -e 3D
sudo pacman -S --nedded mesa lib32-mesa
sudo pacman -S --nedded vulkan-icd-loader lib32-vulkan-icd-loader
Only install this if you use an AMD or Intel GPU or want to use the open source NVIDIA driver (Nouveau, not developed by NVIDIA)
sudo pacman -S <driver>
xf86-video-amdgpu
is for newer AMD GPUsxf86-video-nouveau
is the open source NVIDIA driverxf86-video-intel
is the open source Intel driver (You probably want to leave this out, and it will use the modesetting driver. For more information refer to the wiki)xf86-video-ati
is for older AMD GPUsxf86-video-vmware
for VirtualBox, VMWare, QEMUxf86-video-fbdev
for Hyper-V- If you don't know it you can install all, but it could happen that the internal graphics card is used if you install the driver for it
Only install these packages if you are using an AMD GPU
sudo pacman -S libva-mesa-driver lib32-libva-mesa-driver mesa-vdpau lib32-mesa-vdpau libva-vdpau-driver lib32-libva-vdpau-driver vulkan-radeon lib32-vulkan-radeon
Only install this package if you are using an Intel GPU
sudo pacman -S vulkan-intel
Only install these packages if you are using an NVIDIA GPU
sudo pacman -S nvidia nvidia-utils lib32-nvidia-utils libvdpau lib32-libvdpau
โ ๏ธ Warning NVIDIA's Linux drivers have a bad reputation when it comes to stability and compatibility with all systems. If you experience any problems later on consult https://wiki.archlinux.org/title/NVIDIA for troubleshooting.
Some systems require early KMS start to work properly. Read the Arch Wiki entry about it
nano /etc/mkinitcpio.conf
Change MODULES=()
to
MODULES=(amdgpu)
if you installedxf86-video-amdgpu
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
if you installednvidia
MODULES=(i915)
if you are using Intel graphics- for any other driver you can skip this step
Remove kms
inside HOOKS=()
if you installed nvidia
and run
mkinitcpio -P
sudo pacman -S plasma-desktop konsole kate dolphin firefox ssdm
sudo systemctl enable ssdm.service
Well-known user directories like Downloads or Music are created by the xdg-user-dirs-update.service user service, that is provided by xdg-user-dirs and enabled by default upon install.
sudo pacman -S --needed xdg-user-dirs xdg-utils
โ ๏ธ Note: The installation can just end here. Then you add more applications to have a system suited to your needs and theme it anyway you like.
The Arch User Repository is a community-driven repository for Arch users. yay is a pacman wrapper that allows installing AUR packages.
pacman -S --noconfirm --needed git base-devel
git clone https://aur.archlinux.org/yay.git /tmp/yay
cd /tmp/yay
makepkg -si
paru is a good alternative to yay
. It's easy to use due to its similarity with yay's CLI. To install it, simply execute the following commands:
pacman -S --noconfirm --needed git base-devel
git clone https://aur.archlinux.org/paru.git /tmp/paru
cd /tmp/paru
makepkg -si
sudo pacman -S --needed avahi curl bind bridge-utils dhclient dialog dnsutils dnsmasq gvfs gvfs-smb ifplugd inetutils ipset iptables-nft iw iwd mobile-broadband-provider-info modemmanager net-tools netctl networkmanager network-manager-applet networkmanager-openconnect networkmanager-openvpn networkmanager-pptp networkmanager-qt networkmanager-vpnc nfs-utils nm-connection-editor nss-mdns ntp openbsd-netcat openconnect openssh openvpn samba wireless-regdb wireless_tools wget wpa_supplicant
sudo systemctl enable avahi-daemon.service
sudo systemctl enable ntpd.service
sudo systemctl enable sshd.service
sudo systemctl enable wpa_supplicant.service
sudo pacman -S --needed alsa-card-profiles alsa-firmware alsa-lib alsa-plugins alsa-utils sof-firmware pipewire pipewire-alsa pipewire-audio pipewire-docs pipewire-ffado pipewire-jack pipewire-pulse pipewire-roc pipewire-v4l2 pipewire-x11-bell pipewire-zeroconf lib32-pipewire lib32-pipewire-jack wireplumber gst-plugin-pipewire gstreamer gst-plugins-good gst-plugins-bad gst-plugins-base gst-plugins-ugly pavucontrol playerctl volumeicon
See https://wiki.archlinux.org/title/PipeWire
sudo pacman -S --needed alsa-card-profiles alsa-firmware alsa-lib alsa-plugins alsa-utils sof-firmware pulseaudio pulseaudio-alsa pulseaudio-bluetooth pulseaudio-equalizer pulseaudio-jack pulseaudio-lirc pulseaudio-rtp pulseaudio-zeroconf lib32-alsa-plugins lib32-libpulse gstreamer gst-plugins-good gst-plugins-bad gst-plugins-base gst-plugins-ugly pavucontrol playerctl volumeicon
See https://wiki.archlinux.org/title/PulseAudio
sudo pacman -S --needed bluez bluez-utils bluez-libs bluedevil
sudo systemctl enable bluetooth.service
sudo pacman -S --needed cups cups-pdf cups-filters cups-pk-helper foomatic-db foomatic-db-engine foomatic-db-gutenprint-ppds foomatic-db-ppds foomatic-db-nonfree foomatic-db-nonfree-ppds ghostscript gsfonts gutenprint gtk3-print-backends libcups system-config-printer sane skanlite
sudo systemctl enable cups.service
sudo pacman -S --needed xf86-input-synaptics xf86-input-libinput xf86-input-evdev xf86-input-elographics
sudo pacman -S --needed acpi acpid acpi_call tlp
sudo systemctl enable acpid.service
sudo systemctl enable tlp.service
sudo pacman -S --needed arj bash-completion cabextract cifs-utils e2fsprogs exfat-utils filelight file-roller man-db man-pages nfs-utils nilfs-utils ntfs-3g p7zip rar reflector rsync sharutils squashfs-tools terminus-font texinfo udiskie udisks2 unace unarchiver unrar unzip usbutils uudeview xz zip
sudo systemctl enable reflector.timer