Few days back my long time running system broke due to some inconsistent package and I was forced to reinstall Arch. There are many tutorials and how-to pages to do so, but I found none to be exhaustive or seemless, so I decided to write my own.
Here are the steps to install Arch Linux from scratch
Make a bootable drive
Download Arch Linux from here
If using Windows, download Rufus and create a bootable drive. If you are on Linux, you can use the dd command to create a live USB.
Installation
Insert your bootable drive and select “Install Arch Linux”.
Follow below steps:
-
Verify boot mode
ls /sys/firmware/efi/efivars
If the command shows the directory without error, then the system is booted in UEFI mode. If the directory does not exist, the system may be booted in BIOS (or CSM) mode.
-
Connect to Internet
-
Check network interfaces
ip link
-
For wifi:
Connect Internet
iwctl --passphrase <passphrase> station <wlan0> connect <wifi_ssid>
Replace
<passphrase>
,<wlan0>
,<wifi_ssid>
appropriately.<wlan0>
is wifi interface, useip link
to check yours.-
Check if Internet is working
ping google.com
-
-
-
Setup datetime
System clock, read more here
-
Set Network Synchronization
timedatectl set-ntp true
-
Setting timezone, run
timedatectl list-timezones
to list all timezonestimedatectl set-timezone Asia/Kolkata
-
Check if properly configured
timedatectl status
We will sync with hardware clock later.
-
-
Partition devices
Note: If you have dual boot, make sure you have already alloted blank space for linux partition. Else please do this in the current os (Windows for me).
-
Check partition volumes
lsblk
Output for me:
-
Minimum we need the following partitions:
- One partition for the root directory
/
. - For booting in UEFI mode: an EFI system partition.
You can have separate partition for SWAP, and even your home directory, skipping this here.
- One partition for the root directory
-
Use
fdisk
to partition your drives.Be careful with the tool, it may delete your existing data and drives.
In my case, the drive was
/dev/sdb
, see below image:Create a new partition using the tool (delete existing partition if required, be careful before you save your changes, you might lose your data on the drive).
-
Format the partition
mkfs.ext4 /dev/sdb5
Use the partition which you created with fdisk, for me it is
/dev/sdb5
-
Format partition for UEFI filesystem (boot menu)
If reinstalling or replacing old linux distro, this would have been already there, so you can skip this. Replace with the partition you created, for me it is
/dev/sdb1
mkfs.fat -F32 /dev/sdb1
-
Extra:
If using SWAP, format SWAP partition also, replace
swap_partition
mkswap /dev/swap_partition
-
-
Mount the file system
mount /dev/sdb5 /mnt
Here, I mounted
/dev/sdb5
which was my partition.
-
Installation
-
Essential packages
pacstrap /mnt base base-devel linux linux-firmware vim vi
-
-
Configurations
-
Fstab: Defines how disk partitions, various other block devices, or remote filesystems should be mounted into the filesystem
genfstab -U /mnt >> /mnt/etc/fstab
-
Change root directory for the process (bootdrive)
This step is very important and all other configurations need to follow after this.
arch-chroot /mnt
-
Timezone
-
Local time configuration, see this
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
-
Sync with hardware clock
hwclock --systohc --utc
-
-
Localization
-
Edit
/etc/locale.gen
and uncommenten_US.UTF-8 UTF-8
-
locale-gen
-
echo "LANG=en_US.UTF-8" > /etc/locale.conf
-
-
Network
Configuring
hostname
andhosts
file-
echo "wilstation" > /etc/hostname
-
echo "127.0.0.1 localhost ::1 localhost 127.0.1.1 wilstation.localdomain wilstation" > /etc/hosts
-
-
Users
-
Create user and setup password, creating
wilspi
hereuseradd -m -g users -G wheel -s /bin/bash wilspi passwd wilspi
-
-
pacman -S sudo
-
echo "root ALL=(ALL) ALL %wheel ALL=(ALL) ALL" > /etc/sudoers
-
chown -c root:root /etc/sudoers chmod -c 0440 /etc/sudoers
-
-
-
Boot Configuration
-
pacman -S grub efibootmgr
-
mkdir /boot/efi
-
Note: Here,
/dev/sdb1
(my UEFI partition) is mounted to/boot/efi
mount /dev/sdb1 /boot/efi
-
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
-
grub-mkconfig -o /boot/grub/grub.cfg
-
mkinitcpio -P
-
-
Root Password
-
passwd
-
-
-
Desktop Environment (GNOME)
Setting up GNOME as my desktop environment, you can use any other from here
-
pacman -S xorg gnome
-
systemctl enable gdm.service
-
-
Pre final steps
We are almost done, setting up drivers and enabling services.
-
Graphics driver
pacman -S nvidia
nvidia
pkg works for my graphics driver, check here for your driver. -
Enable
NetworkManager
systemctl enable NetworkManager.service
You can use other managers as well.
-
-
Final steps before rebooting
-
Unmount uefi partition
umount /boot/efi
-
Exit
chroot
exit
-
Unmount system partition
umount /mnt
-
Reboot
reboot now
-
Post Installation
After logging in,
Add wifi details:
nmcli device wifi connect <wifi_SSID> password <password>
nmcli
is cli tool for NetworkManager
Install packages:
sudo pacman -S amd-ucode git bash-completion ntfs-3g pacman-contrib firefox net-tools gnome-tweak-tool
Setup yay
for AUR:
# Install yay
git clone https://aur.archlinux.org/yay.git
cd yay/
makepkg -si
cd .. && rm -rf yay
Remedies
-
GDM takes too much time to reboot, sometimes get stuck on loading screen. This happens because nvidia drivers are not getting loaded before gdm.
Add nvidia modules in
MODULES
in file:/etc/mkinitcpio.conf
, see below:MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)
Rebuild image:
mkinitcpio -P
More details: Nvidia page on Arch Wiki
-
Sometimes due to some mishap (configs/packages go outdated, you missed installing something) you are not able to connect to Internet. You can
chroot
into the machine and fix the network issue.- Reload the bootloader
- Load into the terminal (by choosing installing Arch)
- Setup your internet
- Change root to your system using
chroot
System Screenshots
Keeping it simple silly.