How To Install Arch Linux Step by Step With Screenshots

This tutorial describes all the steps required to install Arch Linux with LVM on UEFI system using GPT (GUID partition table). This tutorial uses LVM (Logical Volume Manager) for installation of Arch Linux.

The steps may seem complicated if you’re doing this for the first time but I’ve simplified them to be clear and precise.To install Arch Linux with LVM, you’ll be required to handle LVM stuff. Please note that this tutorial assumes you are doing installation on an empty hard drive. if you have data on your drive, be careful to avoid corrupting your crucial data.

Table des matières

How To Install Arch Linux Step by Step With Screenshots

Prerequisites

Start to install Arch Linux with LVM

Disk Partitioning

Create LVM and File systems on partitions

Create Physical volume

Create Volume group

Create Logical volumes:

Create file systems

Create mount points and mount the file systems

Install base system

Install base system

Do system configurations

Install basic software

Install Desktop Environment/Windows manager

Finish the installation:

 

Prerequisites

Download and create bootable flash or CD/DVD

1.. Download Arch ISO

Use the following link to download the latest Arch Linux ISO file.

Download Link

2. Create bootable installation media

Once the ISO is downloaded, create a bootable USB device using dd Linux command.

sudo dd if=path-to-image.iso  of=/dev/sdX bs=4M

Replace sdX with your device name, e.g /dev/sdb

Start to install Arch Linux with LVM

Once you have installation media ready, boot into live Arch Linux to start install Arch Linux with LVM. You’ll be prompted with screen similar to one below:

 
 

Select appropriate version of Arch to install on your machine. In my case it’s the first one. You may have to run lsblk command to confirm block devices attached before beginning to partition.

lsblk

 
 

Disk Partitioning

Here we’ll create a new GPT partition table for UEFI system using parted command. Then we’ll create necessary partitions for LVM.

Steps to follow are:

  1. 1.Create GPT partition table 

  2. 2.Create bootable EFI System Partition ( recommended size is 512MiB) 

  3. 3.Mark EFI System partition with the boot flag 

  4. 4.Create partiton for /boot 

  5. 5.Mark remaining partition for LVM 

The syntax to create partition with parted is:

(parted) mkpart part-type fs-type start end

part-type: primary,extended or logical ( meaningful for MBR partition tables only)

fs-type: Used by parted to set 1-byte code used by boot loaders to preview type of data in a partition. It won’t actually create file system.

start: Beginning of the partition from the start of the device. Consist of number followed by unit e.g 1MiB

end: End of the partition from the start of the device. 100% means ends at the end of the device ( use all the remaining space)

Commands:

# parted /dev/sdX

(parted) mklabel gpt

(parted) mkpart ESP fat32 1MiB 513MiB

(parted) set 1 boot on

(parted) name 1 efi

(parted) mkpart primary 513MiB 800MiB

(parted) name 2 boot

(parted) mkpart primary 800MiB 100%

(parted) name 3 lvm-partition

(parted) print

(parted) quit

 
 

Create LVM and File systems on partitions

Remember that our third partition starts at 800MiB and ends at 100%, we’ll mark it for LVM so that we can create Logical volumes on it.

sudo parted /dev/sdX set 3 lvm on

sudo parted /dev/sdX print

 

Create Physical volume

Use pvcreate command to create a physical volume on your OS installation partition.

pvcreate /dev/sdX3

Create Volume group

Volume group is created from the physical volume defined previously.

vgcreate  arch-lvm /dev/sdX3

Before you can install install Arch Linux with LVM:

Create Logical volumes:

Create Logical volumes for system, home and swap.

lvcreate -n arch-root -L 20G arch-lvm

lvcreate -n arch-swap -L 2G arch-lvm

lvcreate -n arch-home -l 100%FREE arch-lvm

To confirm all creations, use the command:

lvs

 

Create file systems

We need filesystems for storing Arch Kernels(boot files), OS installation, home users files and swap partition. Create them as shown.

mkfs.fat -F32 /dev/sdX1

mkfs.ext2 /dev/sdX2

mkfs.btrfs -L root /dev/arch-lvm/arch-root

mkfs.btrfs -L home /dev/arch-lvm/arch-home

mkswap /dev/arch-lvm/arch-swap

swapon /dev/arch-lvm/arch-swap

Create mount points and mount the file systems

Create all required mount points.

mount /dev/arch-lvm/arch-root /mnt

mkdir /mnt/{home,boot}

mount /dev/sdX2 /mnt/boot

mkdir /mnt/boot/efi

mount /dev/sdX1 /mnt/boot/efi

mount /dev/arch-lvm/arch-home /mnt/home

Install base system

Install base system

Packages to install are base-devel packages,efibootmgr and btrfs-progs package:

pacstrap /mnt base base-devel linux linux-firmware efibootmgr vim btrfs-progs --noconfirm

Do system configurations

Generate fstab file with all relevant mount points

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

Make /mnt base root

arch-chroot /mnt /bin/bash

Edit /etc/mkinitcpio.conf to include modules needed for btrfs and LVM

vim /etc/mkinitcpio.conf

Look for the line starting with HOOKS=”…”. Modify the line to add lvm2 BEFORE filesystems as shown below

 

Then you have to regenerate initrd image. use command below

mkinitcpio -p linux