Arch Linux

Arch Linux is a general-purpose rolling release Linux distribution which is very popular among the enthusiasts and hardcore Linux users. Its most versatile GNU Linux distribution due to its simplicity and cutting edge software packages.

If you want to understand the working of linux kernel and undertand the basic underlying concepts. Arch Linux is the best distribution to learn. Although not much popular among the beginners due to its very basic system installation that too only from command line without any graphical assistance. Prerequisites

Arch linux iso which can be downloaded from here – Download. Choose the closet mirror to your location. One of the benefit of the rolling release system in Arch is you dont always have to get latest iso any iso works as it downlods the latest packages from internet automatically.

Arch Bootable USB which can be done in thousands of ways but my preference is to use dd command if you are on windows you can use rufus. Heres dd command make replace {archlinux.iso} with your path to iso you downloaded and replace {your_usb_drive} with your usb drive path which you can find out by running lsblk and enter the drive path like /dev/sdX where X is your drive letter. Make sure not to enter the partition number at the end:

dd bs=4M if={archlinux.iso} of={your_usb_drive)} status=progress && sync

Wired connection to your system is recommened although not necessary.

Step 1: Boot and Connect to Network

First you need to boot from your usb into arch live environment. After its booted you will be greeted with an all black scary terminal screen.

If using wired connection it would be connected automatically. For wireless you need to connect by using below command

wifi-menu

After that just select your network and enter password and you will be connected. Now Just verify that your system is connected by ping archlinux servers.

ping -c 3 archlinux.org

Now that we have setup network, we must enable Network Time Protocol (NTP) so that system can set correct time.

timedatectl set-ntp true

Step 2: Partition

Next, we have to configure the Hard Disk partitions. For this stage you can run fdisk, parted or gdisk utilities to perform a disk partition layout for a GPT disk. I use fdisk for its simplicity in use. Assuming here your installation disk is /dev/sda

For basic partition layout, I recommend this:

EFI System Partition(ESP) (/dev/sda1) with 512M size, FAT32 formatted. Root partition (/dev/sda2) with at least 20G size or rest of HDD space, ext4 formatted.

Use fdisk to create partition

fdisk /dev/sda

Step 3: Format and Mount

Now before mounting the disk partitions, partition is needed to be formatted with its filesystem. For EFI partition we will use FAT32 and root partition ext4. For above mentioned recommended table we use the following command

mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2

Now our partitions are ready to be mounted. The root partition is mounted first and then ESP partition in /boot.

mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

Step 4 Arch Installation

Now the interesting stuff comes. The installation of packages onto your newly prepared disks for Arch linux. Pacstrap is the tool provided in the iso to install the basic system to your hard disk. The first argument is the mount point of your root partition while anything after that is packages to install.

pacstrap /mnt base base-devel linux linux-firmware vim

It will take some time depending on your internet connection as it prepare the mirrorlist and grabs the packages from mirrors. After it finishes its time to generate the /etc/fstab file which is responsible for mounting the partitions during the boot

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

Here the -U options means it will use the UUID of partition to identify the partitions. There are other options available too but this one is what I prefer.

Step 5 Configure your Arch

At this point you have your install of Arch Linux ready just some basic configurations are needed and it will be ready to boot in no time. To configure lets chroot into the new installation

arch-chroot /mnt

Now when chrooted into the system first thing we have to do is setup timezone and sync the clock. I will setup with my zone Asia/Kolkata. You have to replace it with your zone.

ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
timedatectl set-ntp true
hwclock --systohc

Now we need to setup locales for that we have to enable the required locales and then generate it we need to edit /etc/locale.gen file and uncomment en_US.UTF-8 UTF-8 and any other required locales. And then set it in /etc/locale.conf

vim /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf

Every machine has a hostname, its the name by which the machine is identified on the network. Here I will set my hostname as testserver. You can choose whatever you want. And then enable the dhcpcd service

echo testserver > /etc/hostname
systemctl enable dhcpcd

Now we have to set root password and our configurations are done

passwd

Step 6 Install Bootloader

We reached the final step where are gonna install and configure the bootloader and then we are good to boot into our new Arch system.

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

Now the the installation and configurations are complete. You can now boot the system into your new installtion of Arch. To do that exit the chroot environment and then reboot and remove the installtion media.

exit
reboot