Arch Linux Installation Tutorial
(Works with Arch ISO Image build as of: 2024.02.01)
Arch Linux with BSPWM Window Manager Installation Guide (UEFI & MBR)
Table of Contents
- Disk Partitioning
- Base System Installation
- Chroot
- Boot Freshly Installed System
- User Login
- The Conclusion
- Extras (optional)
- Theming & Customisations
- Maintenance, Performance Tuning & Monitoring
- Changelog
Load Keymaps (for non US ENG Keyboard Users only)
For a list of all the available keymaps, use the command:
localectl list-keymaps
To search for a keymap, use the following command, replacing [search_term]
with the code for your language, country, or layout:
localectl list-keymaps | grep -i [search_term]
Now Loadkeys
loadkeys [keymap]
Check for Internet Connectivity
ping -c 4 google.com
- If you are connected through Ethernet, then your Internet will be working out of the box.
- If you are using Wi-Fi, then use
wifi-menu
to connect to your local network. - If this step is successful then we will head to next one.
Update system clock
timedatectl set-ntp true
Preparing the Disk for System
:warning: Be extremely careful when managing your disks, incase you delete your precious data then DON’T blame me.Disk partitioning type (use UEFI or MBR, go according to your system).
For UEFI System
Disk Partitioning (UEFI)
We are going to make two partitions on our HDD, EFI BOOT & ROOT
using gdisk
.
- If you have a brand new HDD or if no partition table is found, then create GPT Partition Table by pressing
g
.
gdisk /dev/[disk name]
- [disk name] = device to partition, find yours by running
lsblk
. - We will be using one partition for our
/
,/boot
&/home
.
n = New Partition
simply press enter = 1st Partition
simply press enter = As First Sector
+512M = As Last sector (BOOT Partition Size)
ef00 = EFI Partition Type
n = New Partition again
simply press enter = 2nd Partition
simply press enter = As First Sector
simply press enter = As Last sector [ROOT Partition Size (using the remaining disk space left)]
8300 or simply press enter = EXT4 ROOT Partition Type
w = write & exit
Format Partitions (UEFI)
mkfs.fat -F32 /dev/[efi partition name]
mkfs.ext4 /dev/[root partiton name]
Mount Partitions (UEFI)
mount /dev/[root partition name] /mnt
mkdir /mnt/boot/efi
mount /dev/[efi partition name] /mnt/boot/efi
For MBR System
Disk Partitioning (MBR)
We are going to make two partitions on our HDD, SWAP & ROOT
using cfdisk
.
- If you have a brand new HDD or if no partition table is found, then create MSDos Partition Table by selecting
msdos
.
cfdisk /dev/[disk name]
- [disk name] = device to partition, find yours by running
lsblk
. - SWAP Partition should double the size of RAM available in your system. Not applicable on 16GB or more RAM.
- We will be using one partition for our
/
,/boot
&/home
.
Format the Partition, Make SWAP & Mount ROOT (MBR)
Format ROOT Partition as EXT4
mkfs.ext4 /dev/[root partition name]
Make & Turn SWAP Partition on (MBR)
mkswap /dev/[swap partition name]
swapon /dev/[swap partition name]
Mount ROOT Partition (MBR)
mount /dev/[root partition name] /mnt
Base System Installation
Update Mirrors using Reflector
reflector -c County1 -c Country2 -a 12 -p https --sort rate --save /etc/pacman.d/mirrorlist
Replace Country1
& Country2
with countries near to you or with the one you’re living in. Refer to Reflector for more info.
Install base system
pacstrap /mnt base base-devel linux linux-firmware linux-headers nano intel-ucode reflector mtools dosfstools
- Replace
linux
with linux-hardened, linux-lts or linux-zen to install the kernel of your choice. - Replace
linux-headers
with Kernel type type of your choice respectively (e.g if you installedlinux-zen
then you will needlinux-zen-headers
). - Replace
nano
with editor of your choice (i.evim
orvi
). - Replace
intel-ucode
withamd-ucode
if you are using an AMD Processor.
Generate fstab
(use -U
or -L
to define by UUID or labels, respectively)
genfstab -U /mnt >> /mnt/etc/fstab
Check the resulting /mnt/etc/fstab
file, and edit it in case of errors.
Chroot
arch-chroot /mnt
Create Swapfile (UEFI only)
Replace the below 4096 in count=4096
with double the amount of RAM installed your system. Not applicable on 16GB or more RAM.
dd if=/dev/zero of=/swapfile bs=1M count=4096 status=progress
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
Add Swapfile entery in your /etc/fstab
file (UEFI only)
/swapfile none swap defaults 0 0
Insert the above line at the bottom of /etc/fstab
.
Set Time & Date
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
Replace Region
& City
according to your Time zone. Refer to Time zone more info.
Set Language
We will use en_US.UTF-8
here but, if you want to set your language, replace en_US.UTF-8
with yours in all below instances.
Edit locale.gen
nano /etc/locale.gen
Uncomment the below line
#en_US.UTF-8 UTF-8
save & exit.
Generate Locale
locale-gen
Add LANG to locale.conf
echo LANG=en_US.UTF-8 > /etc/locale.conf
Add Keymaps to vconsole
For keyboard users with non US Eng only. Replace [keymap]
with yours.
echo "KEYMAP=[keymap]" > /etc/vconsole.conf
Set Hostname
echo arch > /etc/hostname
Replace arch
with hostname of your choice.
Set Hosts
nano /etc/hosts
add these lines to it
127.0.0.1 localhost
::1 localhost
127.0.1.1 arch.localdomain arch
Replace arch
with hostname of your choice.
save & exit.
Install & Enable NetworkManager
pacman -S networkmanager
systemctl enable NetworkManager
Set ROOT Password
passwd
Install GRUB Bootloader
pacman -S grub
Install EFI Boot manager (UEFI)
pacman -S efibootmgr
For UEFI System
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
For MBR System
grub-install --target=i386-pc /dev/[disk name]
Create Grub configuration file
grub-mkconfig -o /boot/grub/grub.cfg
Final Step
exit
umount -a
reboot
Now boot into your freshly installed Arch system
Login as ROOT
Add new User
useradd -mG wheel [username]
Replace [username]
with your username of choice.
Set User Password
passwd [username]
Allow Wheel Group to use Sudo Commands
EDITOR=nano visudo
Find and uncomment the below line
#%wheel ALL=(ALL) ALL
save & exit.
Logout ROOT
exit
Login as USER
Check for updates
sudo pacman -Syu
Xorg & GPU Drivers
sudo pacman -S xorg [xf86-video-your gpu type]
- For Nvidia GPUs, type
nvidia
&nvidia-settings
. For more info/old GPUs, refer to Arch Wiki - Nvidia. - For newer AMD GPUs, type
xf86-video-amdgpu
. - For legacy Radeon GPUs like HD 7xxx Series & below, type
xf86-video-ati
. - For dedicated Intel Graphics, type
xf86-video-intel
.
Enable Multilib Repo (optional)
multilib contains 32-bit software and libraries that can be used to run and build 32-bit applications on 64-bit installs (e.g. Wine, Steam, etc).
Edit /etc/pacman.conf
& uncomment the below two lines.
#[multilib]
#Include = /etc/pacman.d/mirrorlist
MESA Libraries (32bit)
This package is required by Steam if you play games using Vulkan Backend.
sudo pacman -S lib32-mesa
KDE Plasma & Applications
sudo pacman -S alacritty aria2 bat bat-extras bspwm btrfs-progs evince eza feh ffmpeg firefox-developer-edition flameshot font-manager gimp github-cli gpick htop jq lazygit lxappearance mesa-utils mesa-vdpau mpv ncdu neovim nnn noto-fonts noto-fonts-cjk noto-fonts-extra npm opendoas pass pavucontrol pulseaudio-alsa python-pip python-pipx renameutils reflector ripgrep rofi spotify-launcher stow strawberry sxhkd sxiv terraform thunar tipp10 tmux transmission-cli trash-cli unrar unzip vim wget xorg xorg-xinit zip zsh xf86-video-amdgpu polybar libva-mesa-driver libva-vdpau-driver libva-utils pacman-contrib go
Enable OpenSSH daemon
sudo systemctl enable sshd.service
Final Reboot
reboot
The Conclusion
Now everything is installed and after the final reboot
, you will land in you GUI Login Screen ready to use your system. You can also do some extra steps mentioned below to further improve your experience. I’ll recommend you to install yay
& paccache
.
- Yay will provide your packages from AUR (Arch User Repository), which are not available in the Official Repo.
- Paccache can be used clean pacman cached packages either manually or in an automated way.
Extras (optional)
Install Yay
Yet Another Yogurt - An AUR Helper.
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
Install Zsh
Zsh is a powerful shell that operates as both an interactive shell and as a scripting language interpreter.
sudo pacman -S zsh zsh-completions
Read here for customisation & theming for Zsh. Read below how to change your SHELL.
Changing your SHELL
First check your current SHELL by running:
echo $SHELL
To get list of all available/installed SHELLs:
chsh -l
Set Zsh as our SHELL
For an example, we will set Zsh as default SHELL which we installed in the last step:
chsh -s /usr/bin/zsh
For the changes to apply, you will have Logout and Log back in or better do reboot
.