Install Arch Linux

This is my personal step-by-step guide for installing Arch Linux on x86-64 UEFI based machines. This guide is a slimmed down and simplified version of the Installation guide on ArchWiki.

Pre-installation

Keyboard layout

Terminal window
loadkeys sv-latin1

More info: console keymap

Pacman mirrors

Edit /etc/pacman.d/mirrorlist and uncomment a couple of nearby mirrors.

More info: mirrorlist

Verify the boot mode

Terminal window
ls /sys/firmware/efi/efivars

“Stuff” should show up.

More info: efivars

Test internet connection

Terminal window
ping -c 3 archlinux.org

More info: ping

Update the system clock

Terminal window
timedatectl set-ntp true

More info: timedatectl(1)

Create and format partitions

Find your drive

Terminal window
fdisk -l

More info: fdisk

Wipe the drive

Terminal window
shred --verbose --random-source=/dev/urandom --iterations=1 /dev/`yourdrive`

yourdrive should be replaced with your storage device, e.g. sda.

More info: shred

Create a boot and root partition

Terminal window
cfdisk /dev/`yourdrive`

More info: fdisk | cfdisk | partitioning

List your partitions

Terminal window
fdisk -l `yourdrive`

Format the partitions

Terminal window
mkfs.fat -F32 /dev/`efipartition`
mkfs.ext4 /dev/`rootpartition`

More info: filesystems | mkfs.fat | mkfs.ext4

Mount the partitions

Terminal window
mount /dev/`rootpartition` /mnt
mkdir /mnt/boot
mount /dev/`efipartition` /mnt/boot

More info: mount

Installation

Terminal window
pacstrap /mnt base base-devel linux linux-firmware dhcpcd efibootmgr grub inetutils lvm2 man-db man-pages nano netctl sudo sysfsutils texinfo usbutils vi which

More info: pacstrap | base | base-devel

Configure the system

Fstab

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

More info: fstab

Chroot

This will change the root directory to our new installation.

Terminal window
arch-chroot /mnt

More info: chroot

Time

Set time zone

Terminal window
ln -sf /usr/share/zoneinfo/Europe/Stockholm /etc/localtime

More info: time zone

Set the hardware clock

Terminal window
hwclock --systohc --utc

More info: hwclock

Localization

Generate locales

Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8.

Terminal window
locale-gen

More info: localizations

Set system language

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

More info: locale.conf

Set keyboard layout

For a Swedish keyboard layout, the file should contain: KEYMAP=sv-latin1.

/etc/vconsole.conf
KEYMAP=sv-latin1

More info: vconsole.conf

Network

Hostname

This file should only contain the hostname for this device

/etc/hostname
yourhostname

More info: hostname

Hosts

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

More info: hosts(5)

DHCP

To get network access we need to enable dhcpcd.service.

Terminal window
systemctl enable dhcpcd.service

More info: network managers | dhcpcd

Root password

Terminal window
passwd

More info: password

Bootloader

Terminal window
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub

More info: GRUB | UEFI | grub | efibootmgr

Microcode

Depending on your CPU you need to install the latest microcode.

Terminal window
pacman -S <intel-ucode or amd-ucode>

More info: Microcode | intel-ucode | amd-ucode

GRUB

Terminal window
grub-mkconfig -o /boot/grub/grub.cfg

More info: GRUB

Exit chroot

Terminal window
exit

Finish

Reboot

Reboot your system and remove your installation media.

Terminal window
reboot

← Back to all posts