keyboard_arrow_up

Arch Linux Installation

expand_circle_right

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

  • you don’t need dual boot and just want to install it as first OS on your drive.
  • your computer is not too old and it supports GPT , UEFI , etc.
  • you don’t need LVM, system encryption or RAID .
  • you don’t mind to read the wiki pages.

See also: Official Installation Guide

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 details, 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

  1. BOOT Partition /dev/sda1
    500MB or 1GB is recommended.
    Partition Type ef00
    Mounted to /boot
    Formatted as FAT32 filesystem
    # mkfs.fat -F32 /dev/sda1
  2. ROOT Partition /dev/sda2
    30GB is recommended.
    Partition Type 8300
    Mounted to /
    Formatted as EXT4 filesystem
    # mkfs.ext4 /dev/sda2
  3. SWAP Partition /dev/sda3
    8GB is recommended.
    Partition Type 8200
    No need to format and mount
    But make it swap partition
    # mkswap /dev/sda3
  4. HOME Partition /dev/sda4
    Size depends on available space on the disk /dev/sda
    Partition Type 8300
    Mounted to /home
    Formatted as EXT4 filesystem
    # mkfs.ext4 /dev/sda4
# mkfs.fat -F32 /dev/sda1
# mkfs.ext4 /dev/sda2
# mkswap /dev/sda3
# mkfs.ext4 /dev/sda4

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

Find locale you want and uncomment it. E.g. en_US.UTF-8 UTF-8. If nano is not available, run pacman -S nano to install it first.

en_US.UTF-8 UTF-8

Generate Locale

# locale-gen

Create Locale File

# nano /etc/locale.conf

Write locales. E.g.:

LANG=en_US.UTF-8

Hostname

# nano /etc/hostname

Write the hosename:

myhostname

Hosts

# nano /etc/hosts

Edit like the followings:

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:

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(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

Write the followings:

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 .

Categories   •  Tech  •  Linux
Tags   •  Arch Linux  •  Installation