Min Soe Han

LegalBusinessElse


backTech:


Installing Arch Linux

DATE 20240807

Arch linux installation is not that hard if you do it simple as if:

If so, it is done in 10 minutes (without downloading and installation time). In this tutorial, The Arch Linux is installed as

Preparing Installation Media

# dd if=/path/to/archlinux-version-x86_64.iso of=/dev/sdb

Boot up from the Installation Media

Getting the installation media booted up, choosing UEFI in boot menu if needed. How to get the installation booted up?

Connect to Internet

To connect to internet (WiFi) using iwd

# iwctl

for more deatils, see: Connect to a network

Partitioning and Formatting Partitions

Partitioning

GPT fdisk is personally recommended for partitioning the disk. GPT fdisk— consisting of the gdisk, cgdisk, sgdisk and fixparts programs—is a set of text-mode partitioning tools. Assuming your device is /dev/sda, run the following command and follow on-screen instructions.

# gdisk /dev/sda

Formatting Partitions

Partitioning the disk by gdisk is just creating partition table on the disk. Formatting is still needed. In other words, formatting is writing filesystem on the partition. In this tutorial, EXT4 Filesystem is used for all partition except /boot partition where bootlader's files will reside and which is created as EFI System Partition.

Example of Partitioning and Formatting

Mounting and Activating Swap

Mounting involves creating directories where the partitions will be mounted. Activating swap can be done by using swapon command.

  1. Mount ROOT partition to /mnt.
  2. Create directories where the next partitions will be mounted.
    • /mnt/boot for BOOT Partition
    • /mnt/home for HOME Partition
  3. Mount BOOT and HOME partitions to /mnt/boot and /mnt/home.
  4. Activate SWAP partition using swapon.
# mount /dev/sda2 /mnt
# mkdir /mnt/boot                
# mkdir /mnt/home                
# mount /dev/sda1 /mnt/boot                
# mount /dev/sda4/mnt/home
# swapon /dev/sda3

Installing Base System

At this stage, base system can be installed. It is also recommended to install other useful packages such as base-devel, nano, nvim, networkmanager.

# pacstrap /mnt base linux linux-firmware base-devel neovim networkmanager

Configuration

fstab

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

chroot

# arch-chroot /mnt

Timezone

# ln -sf /usr/share/zoneinfo/Asia/Yangon /etc/localtime
# hwclock --systohc

Uncomment Locale

# nano /etc/locale.gen

Uncomment en_US.UTF-8 UTF-8. If nano is not available, run pacman -S nano to install it first.

Generate Locale

# locale-gen

Create Locale File

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

Hostname

# nano /etc/hostname
myhostname

Hosts

#nano /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 myhostname.localdomain myhostname

Root Password

# passwd

Create New User

# useradd -m -G wheel -s /bin/bash myusername
# passwd myusername

Make User Sudoer

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

Bootloader

Bootloader Installation

See: Systemd-boot for more details. Below command would be working only if EFI System Partition (ESP) is mounted to /boot or /efi. Mounting ESP to /boot is the most recommended and simplest. Read ESP Typical Mount Points for more knowledge.

# bootctl install

When running bootctl install, systemd-boot will try to locate the ESP at /efi, /boot, and /boot/efi. Setting esp to a different location requires passing the --esp-path=esp option.

Bootloader Entry File

# nano /boot/loader/entries/arch.conf
title Arch Linux
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=/dev/sda2 rw

Exit, Unmount and Reboot

# exit
# umount -R /mnt
# reboot

Post Installation

At this stage, the base installation finished. See General recommendations for system management directions and post-installation tutorials (like creating unprivileged user accounts, setting up a graphical user interface, sound or a touchpad). For a list of applications that may be of interest, see List of applications.