DEV Community

Christopher Kapic
Christopher Kapic

Posted on • Originally published at blog.kapic.io on

Arch Linux Installation Tutorial (Tested on T530)

Arch Linux Thumbnail

Follow along to install Arch Linux (tested on ThinkPad T530)

Download the .iso

Flash a USB

Use Rufus (Windows) or Etcher (MacOS or Linux) to flash the .iso to a flash drive.

Boot into the installation media

Common boot buttons include:

  • F12 - ThinkPads

Connect to the internet

Ethernet/virtual machine does not require any extra setup. For wifi, you will use the iwctl utility:

iwctl device list
iwctl station [device] get-networks
iwctl station [device] connect [network]
Enter fullscreen mode Exit fullscreen mode

After the last command runs, you will be prompted to enter a password if the wifi network is private.

Note: If your network has multiple works, it must be enclosed in quotes.

You can test your connection by using the ping command (for example, ping blog.kapic.io).

Advanced: determine the boot mode

Check whether the /sys/firmware/efi/efivars directory exists:

ls /sys/firmware/efi/efivars
Enter fullscreen mode Exit fullscreen mode

If the directory exists, the computer boots with UEFI. If the directory does not exist, it probably boots with BIOS.

Optional: update the system clock

timedatectl set-ntp true
Enter fullscreen mode Exit fullscreen mode

Partition the drive

There are several options for partitioning the drive. You may use whichever you prefer; I suggest cfdisk because it is a GUI. (Video reference)

cfdisk
Enter fullscreen mode Exit fullscreen mode

The Arch Linux Installation Guide suggests using a root and a swap (> 512MiB) partition. If you are booting with UEFI, also create a boot partition.

Create a filesystem

Filesystem

mkfs.ext4 /dev/[root partition]
Enter fullscreen mode Exit fullscreen mode

Example

mkfs.ext4 /dev/sda1
Enter fullscreen mode Exit fullscreen mode

Swap

mkswap /dev/[swap partition]
Enter fullscreen mode Exit fullscreen mode

Example

mkswap /dev/sda2
Enter fullscreen mode Exit fullscreen mode

Mount the partitions

mount /dev/[root partition] /mnt
swapon /dev/[swap partition]
Enter fullscreen mode Exit fullscreen mode

Install essential packages

pacstrap /mnt base linux linux-firmware neovim
Enter fullscreen mode Exit fullscreen mode

Note: You can choose other text editors in place of neovim. If you do so, use that editor instead of nvim for the remainder of the tutorial.

Fstab

genfstab -U /mnt >> /mnt/etc/fstab
Enter fullscreen mode Exit fullscreen mode

Change root into the new system

arch-chroot /mnt
Enter fullscreen mode Exit fullscreen mode

Set the timezone

ln -sf /usr/share/zoneinfo/[continent or country]/[city] /etc/localtime
Enter fullscreen mode Exit fullscreen mode

Example

ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
Enter fullscreen mode Exit fullscreen mode

Note: to see available continents, run ls /usr/share/zoneinfo/. Likewise, to see available cities, run ls /usr/share/zoneinfo/[continent]/.

hwclock --systohc
Enter fullscreen mode Exit fullscreen mode

Choose locales

nvim /etc/locale.gen
Enter fullscreen mode Exit fullscreen mode

Uncomment the locales you wish to use (if you are not sure, just uncomment the line with en_US.UTF-8 UTF-8.

locale-gen
Enter fullscreen mode Exit fullscreen mode

Then run

echo "LANG=[locale]" >> /etc/locale.conf
Enter fullscreen mode Exit fullscreen mode

Example

echo "LANG=en_US.UTF-8" >> /etc/locale.conf
Enter fullscreen mode Exit fullscreen mode

Hostname

echo [hostname] >> /etc/hostname
Enter fullscreen mode Exit fullscreen mode

Edit /etc/hosts

nvim /etc/hosts
Enter fullscreen mode Exit fullscreen mode
# /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 [hostname].localdomain [hostname]
Enter fullscreen mode Exit fullscreen mode

Set the root password

passwd
Enter fullscreen mode Exit fullscreen mode

Install useful programs

To be honest, I am not sure what every one of these is for, but I tried installing Arch without them and ran into problems.

pacman -S networkmanager network-manager-applet dialog wireless_tools wpa_supplicant os-prober mtools dosfstools base-devel linux-headers
Enter fullscreen mode Exit fullscreen mode

Install a boot loader

Look up which boot loader is correct for the computer. I use grub for a ThinkPad T530. This step may be different depending on what hardward is being used. Do your own research to make sure you install a working boot loader.

pacman -S grub
grub-install --target=i386-pc /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
Enter fullscreen mode Exit fullscreen mode

Exit and reboot

exit

umount -a

reboot
Enter fullscreen mode Exit fullscreen mode

Latest comments (0)