Skip to main content

Install Arch Linux

Sebastian
Writer

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

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

ls /sys/firmware/efi/efivars

"Stuff" should show up.

More info: efivars

Test internet connection

ping -c 3 archlinux.org

More info: ping

Update the system clock

timedatectl set-ntp true

More info: timedatectl(1)

Create and format partitions

Find your drive

fdisk -l

More info: fdisk

Wipe the drive

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

cfdisk /dev/`yourdrive`

More info: fdisk | cfdisk | partitioning

  • Partition table: GPT
  • New → Partition Size: 512 MiB → EFI System
  • New → Partition Size: xxxG → Linux Filesystem

List your partitions

fdisk -l `yourdrive`

Format the partitions

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

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

Mount the partitions

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

More info: mount

Installation

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

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

More info: fstab

Chroot

This will change the root directory to our new installation.

arch-chroot /mnt

More info: chroot

Time

Set time zone

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

More info: time zone

Set the hardware clock

hwclock --systohc --utc

More info: hwclock

Localization

Generate locales

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

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
  • Change hostname to your hostname
  • If this system has a public IP address, it should be used instead of 127.0.1.1

More info: hosts(5)

DHCP

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

systemctl enable dhcpcd.service

More info: network managers | dhcpcd

Root password

passwd

More info: password

Bootloader

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.

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

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

GRUB

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

More info: GRUB

Exit chroot

exit

Finish

Reboot

Reboot your system and remove your installation media.

reboot