Howto: Install and Configure Arch Linux from Scratch

Howto: Install and Configure Arch Linux from Scratch
What is Arch Linux?

Arch Linux is an independently developed, x86-64 general-purpose GNU/Linux distribution that strives to provide the latest stable versions of most software by following a rolling-release model. The default installation is a minimal base system, configured by the user to only add what is purposely required.

It is highly recommended that you join the Arch announcement mailing list so you will stay apprised to security announcements affecting your installation.

You can find a list of all the Arch mailing lists here.

Conventions Used In This Text

The default Arch prompt looks like this:

root@archiso ~ #

Throughout this text I will instead replace the prompt with this shorter version:

#

Any command to be executed will be shown with the hash mark in front of the command. Any resulting output will be shown in the lines thereafter without the hash mark, such as seen here:

# date
Sun Jan 12 21:44:31 PST 2020
Boot Live Arch ISO

As soon as the computer posts (beeps) you should enter the keystroke to activate the BIOS or otherwise interrupt the boot in order to choose a boot disk. After doing so, select your Arch USB drive as your boot disk, and select to boot. You will be dropped into a root shell.

Install Arch Locally

We start by running ip link to find our wi-fi interface. In my case this is wlan0. Next we connect to the wireless network, replacing with wlan0 (or your desired interface) and and with the appropriate credentials. It is recommended you connect to a 2.4GHz network if you are using older wireless hardware technology.

If you are having trouble getting the command wpa_supplicant from running correctly, you can remove the -B argument and try running it with the logging in the foreground to find the error.

After successfully connecting to the wireless network, you need to request an IP address using DHCP. You do this by running the command dhcpcd.

# ip link
# wpa_supplicant -B -i <interface> -c <(wpa_passphrase <ssid> <password>)
# dhcpcd

Set the system clock and hardware clock.

# timedatectl set-ntp true
# hwclock --systohc

First find the partition you want to use for root / by running fdisk -l. Then format the partition. Configure the swap on the swap partition.

# fdisk -l
# mkfs.ext4 /dev/<partition1>
# mkswap /dev/<partition2>
# swapon /dev/<partition2>
# mount /dev/<partition1> /mnt

Bootstrap the kernel.

# pacstrap /mnt base linux linux-firmware

Generate file system table.

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

Change root to the target system.

# arch-chroot /mnt

Update and install base packages.

# pacman -Qqe > pkglist.txt
# pacman -Syu
# pacman -S wpa_supplicant
# pacman -S dhcpcd
# pacman -S man
# pacman -S vim

Set the system hostname.

# hostnamectl set-hostname <example_hostname>

Configure your hosts file.

# vim /etc/hosts

Set the timezone, replacing <Region> and <City> with the appropriate values. List the files in /usr/share/zoneinfo/ to see which region and city files are available for use.

# ls /usr/share/zoneinfo/
# ls /usr/share/zoneinfo/US/
# ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime

Configure which language locales are available and then generate the locale.

# vim /etc/locale.gen
# locale-gen

Open up the locale configuration file.

# vim /etc/locale.conf

Set the language to your desired language.

LANG=en_US.UTF-8

Set a root password. Do not forget this password!

# passwd

Install SUDO

pacman -S sudo

Edit your sudoers file to enable the wheel group.

export EDITOR=/usr/bin/vim
visudo

Add a new user.

useradd -m -g users -G wheel -s /bin/bash <newuser>

Install base development packages needed for building new packages. You also need the enchant package, which requires a Arch user repository install. In order to accomodate this, you need to first install yay.

pacman -S base-devel
cd
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
yay -S aur/enchant1.6

Install Albert.

sudo pacman -S albert

Install NextDNS.

$ sh -c 'sh -c "$(curl -sL https://nextdns.io/install)"'

Install Sublime Text.

$ curl -O https://download.sublimetext.com/sublimehq-pub.gpg && sudo pacman-key --add sublimehq-pub.gpg && sudo pacman-key --lsign-key 8A8F901A && rm sublimehq-pub.gpg
$ echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/stable/x86_64" | sudo tee -a /etc/pacman.conf
$ sudo pacman -Syu sublime-text

Install Visual Studio Code.

$ sudo pacman -S code

Install Thunderbird.

$ sudo pacman -S thunderbird