A User Friendly Archlinux Installation Guide

Feb 21, 2021

#linux #archlinux


Step-by-step guide for installing archlinux on a local machine/VirtualBox

Partitions

Disk informations

lsblk

listing all the disks

fdisk -l

Select the disk where you want to install archlinux

fdisk /dev/sda

Make a gpt partition

EFI partition: 500MB                       # dev/sda1

Swap partition: Double of available ram    # dev/sda2

Root partition: Available free space       # dev/sda3

Formating

Format EFI directory

mkfs.fat -F32 /dev/sda1

Create swap

mkswap /dev/sda2

Finally, format root directory

mkfs.ext4 /dev/sda3

Mount drive

Mounting and activating partition

mount /dev/sda3 /mnt  #mount root
swapon /dev/sda2  #swap

We need to mount the esp where bootloader will be installed. We can directly mount esp to /mnt/efi and don’t need to mount it in /mnt/boot/efi. Since there is no /mnt/efi directory by default so we will create and mount that the esp

mkdir /mnt/efi
mount /dev/sda1 /mnt/efi

Base installation

pacstrap /mnt base linux linux-firmware

Fstab

We must write mounting drive information at /mnt/etc/fstab location to mount the drive automatically while booting the machine.

genfstab -U /mnt >> /mnt/etc/fstab

Now change the root path for further installion of the base system

arch-chroot /mnt

Basic packages cab be installed by pacman

pacman -S networkmanager wpa\_supplicant wireless\_tools netctl dialog
nano cups

Enable services

Enable essential services at boot time

NetworkManager

systemctl enable NetworkManager.service

Printing system

systemctl enable cups.service

Refresh mirrorlist

This section is optional and can be headed into next section.

The performance of the mirrorlist varies over time and mostly depends on how far the geographic location of the server from your local machine location.

reflector is a tool which sort out the latest servers from the basis of performance and geographic location. Install additional neccessary packages

pacman -S reflector rsync curl

It is better practise to first create a backup file of the mirrorlist. If something goes wrong with your mirrolist updation process then you can revert back to the previous version.

cp /etc/pacman.d/mirrorlist.bak /etc/pacman.d/mirrorlist`
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak

Sorting the mirrorllist of best 5 server of India

reflector –verbose –country ‘India’ -l 5 –sort rate –save /etc/pacman.d/mirrorlist

Configure

Timezone

Link your zone time with your local time

ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime

Syncing it with Hardware clock

hwclock –systohc

Locale

Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 ,and then generate locale by

locale-gen

Also create the locale.conf file, and set your LANG variable

# FILE nano /etc/locale.conf
LANG=en_US.UTF-8

Hostname

Choose your hostname that you prefer

# FILE nano /etc/hostname
arch

Hosts

Add matching entries to hosts

FILE nano /etc/hosts
127.0.0.1   localhost
::1     localhost
127.0.1.1   arch.localdomain    arch

Ramdisk

Create Ramdisk for the booting process

mkinitcpio -P

User creation

First set the password for the root user

passwd

Add a user with sudo permission, Here the user is added in wheel group

useradd -m -g users -G wheel <user_name>
passwd <user_name>

Install sudo package

pacman -S sudo

Edit the visudo file to give the permission to wheel group

FILE EDITOR=nano visudo
# uncomment the line
%wheel ALL=(ALL) ALL  

Bootloader

Here I have chosengrub as bootloader and for theat this twp packages grub and efibootmgr are required.

pacman -S grub efibootmgr

Below two commands are GRUB specific

grub-install –target=x86_64-efi –efi-directory=/efi –bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Micro-code

cpu micro-code must be loaded by the bootloader, for intel cpu users

pacman -S intel-ucode

for amd cpu pacman -S mesa amd-ucode

DE

First install graphics driver packages

pacman -S mesa xf86-video-intel

for amd gpu pacman -S mesa xf86-video-amdgpu

NB virtualbox only pacman -S xf86-video-vmware virtualbox-guest-utils

Install xorg display server and also install packages for wayland support

pacman -S xorg plasma-wayland-session  # for plasma desktop

Display manager for the plasma desktop is sddm

pacman -S sddm

For gnome user, install gdm display manager

pacman -S gdm

Enable the system display manager

systemctl enable sddm.service

for starting gdm service, systemctl enable gdm.service

Install Plasma Desktop environment and kde applications for the most use cases,

pacman -S plasma kde-applications

for Gnome pacman -S gnome gnome-extra gnome-tweaks

Reboot

exit
umount -R /mnt
reboot

Congratulations you have installed archlinux with your favorite desktop environment. Add a tag on your profile btw I use arch :)