Low Orbit Flux Logo 2 F

Arch Linux Install

This guide is meant to be a little bit faster and easier to follow than the official documentation. We also try to keep all the essentials in one place so you don’t have to follow too many links just to get your system up and running. The offical install doc doesn’t include everything you need to configure the network, bootloader, and some important packages. You should check out the official install guide even if you just plan on following the instructions here. The offical Arch Linux install guide can be found here: https://wiki.archlinux.org/index.php/Installation_guide

NOTE - Change any device names or IP addresses in this guide to match your environment.

Download Install Media

Downloads can be found here: https://www.archlinux.org/download/

You can download with BitTorrent if you like. Many people recommend using BitTorrent. My BitTorrent download froze halfway through so I just used an HTTP download from one of the mirrors. It worked great and downloaded in just a few minutes.

Verify the GnuPG Signature



gpg --keyserver-options auto-key-retrieve \
    --verify archlinux-version-x86_64.iso.sig

Use the signature from archlinux.org and not one of the mirrors as the signature on a mirror is more likely to have been tampered with.

Create a USB Install Disk

If you are already running Linux, you can create a Live install USB disk like this:



dd bs=4M if=/home/user/archlinux-2018.01.01-x86_64.iso \
         of=/dev/sdc status=progress && sync

Boot From Your Install Media

You will be logged into a virtual console as root by default. Your shell will be Zsh.

These text editors are available:

Note:

NOTE - You can view the install guide while installing like this:



vim install.txt

Pro Tip - You can launch SSHD from the install media and connect to it over a nice SSH session to perform the installation.



systemctl start sshd
ip a
passwd root

ssh root@192.168.3.151

Keyboard Layout:

The default keyboard layout is US. If you want to change it you can do this:



 ls /usr/share/kbd/keymaps/**/*.map.gz
 loadkeys de-latin1

 

Verify Boot Mode

If this file exists, the system is going to boot in UEFI mode. If it doesn’t exist, it may boot up in BIOS or CSM mode.



ls /sys/firmware/efi/efivars

OR just use this to check for BIOS vs UEFI:



[ -d /sys/firmware/efi ] && echo UEFI || echo BIOS

Network Setup

NOTE - This is for your connection DURING the install.

DHCP will be enabled by default for wired connections. If this is what you want, you should be all set and can skip the rest of this section. Otherwise, you might need to manually configure networking. You can configure a static IP address if you like.

Check here for more info: https://wiki.archlinux.org/index.php/Network_configuration

Verify that you have connectivity by pinging archlinux.org:



ping archlinux.org

Show network interfaces:



ip link
ip addr

If you are using DHCP, you should be all set. If not, here is the basic syntax you will need to bring up a network interface and add any needed routes. The example assumes the following:


ifconfig enp0s3 192.168.1.5 netmask 255.255.255.0 up
route add default gw 192.168.1.1
echo "nameserver 8.8.8.8" > /etc/resolv.conf

WIFI

If you are using WIFI, you can get your device name from the command above. Run the following command to configure WIFI:


wifi-menu -o wlo1

Time and Date

Make sure the system has the correct time and date:



timedatectl set-ntp true

Verify that the service is working:



timedatectl status

Disk Partitioning

Partitioning is loads of fun. It is even more fun when you fully understand the purpose of each type of partition and the uses cases for each of them. You usually also want a swap partition. Sometimes you may potentially want other partitions as well.

Other Partitions ( like /var ):

You probably want to keep things simple but there are plenty of use cases for creating additional partions. The most common addtion would be to create a separate partition for /var. This has the advantage of not impacting your system as much if the partition fills up. This makes sense for /var because this is usually where your logs and other variable length data will go. This also makes it easier to replace or expand the disk later, if needed.

Basic Partition Layout

This is a basic example of how you will probably want to layout your partitions. This is a minimal setup.

Firmware and partition terms:

Partition types:

Partition schemes:

UEFI / BIOS with GPT EFI, BIOS Boot, Swap, Root Most flexible combination, supports almost everything
UEFI with GPT EFI, Swap, Root Most modern combination
BIOS with GPT BIOS Boot, Swap, Root Supports old hardware and VMs but with nice modern partitions
BIOS with MBR Swap, Root Potentially better dual booting support with windows
UEFI with MBR ???? CRAZY / pointless - no one does this

UEFI and BIOS support with GPT ( most flexible option ):

Mount point Partition Partition type Suggested size
/boot/efi /dev/sda1 EFI 512 MiB
na /dev/sda2 BIOS Boot 2Mib
[SWAP] /dev/sda3 Linux swap >= RAM (for hibernate)
/ /dev/sda4 root FS Remainder of the device

NOTE - You can use a swap file instead of a swap partition but there are disadvantages to this.

Partitioning with parted

You can still use fdisk or gdisk if you like but I’ve replaced those instructions with parted.

Check which disk devices are available on your system.



lsblk

You can copy and paste the below commands one at a time or you can just run them as a script.



DISK="/dev/sda"


mem=`free -m|grep -i Mem: | awk '{print $2}'`     # swap set to RAM size to support hibernate

START=1
ESP=$(( $START+512 ))
BIOS_BOOT=$(( $ESP+2 ))
SWAP=$(( $BIOS_BOOT+mem ))
ROOT=100%

echo "Wiping Disk"

wipefs -a $DISK

echo "Creating Label"

parted -s ${DISK} mklabel gpt

echo "Partitioning"

parted -s --align=optimal ${DISK} mkpart ESP fat32 ${START}MiB ${ESP}MiB
parted -s ${DISK} set 1 esp on
parted -s --align=optimal ${DISK} mkpart BIOS_BOOT fat32 ${ESP}MiB ${BIOS_BOOT}MiB
parted -s ${DISK} set 2 bios_grub on
parted -s --align=optimal ${DISK} mkpart linux-swap ${BIOS_BOOT}MiB ${SWAP}MiB
parted -s --align=optimal ${DISK} mkpart linux ${SWAP}MiB 100%

parted -s ${DISK} print

Disk Formatting

IMPORTANT NOTE - In this example, I actually put the swap partition on /dev/sda1 and the / partition on /dev/sda2.

Format the the root file system ( assuming it is on /dev/sda1 ):



mkfs.ext4 /dev/sda4

Format the EFI ( ESP ) partition:



mkfs.fat -F 32 /dev/sda1

Initialize and turn on your swap partition ( assuming /dev/sda2 ):



mkswap /dev/sda3
swapon /dev/sda3

Temporarily mount your root partition on /mnt so that it is ready for installation:



mount /dev/sda4 /mnt

Also, mount any other filesystems you created on /mnt, for example:



mkdir -p /mnt/boot/efi
mount /dev/sda1 /mnt/boot/efi

These will be detected later.

Installation

Optionally, edit this file and place your preferred mirror at the top:



vim /etc/pacman.d/mirrorlist

It will be used during installation and by the package manager after install.

Install Essential Packages

This will install:



pacstrap -K /mnt base linux linux-firmware

Extra network task ( will need this later but can’t do it within the chroot env ):



ln -sf /run/systemd/resolve/stub-resolv.conf /mnt/etc/resolv.conf

Fstab and Chroot

Filesystem Table ( /etc/fstab )

Generate your filesystem table:



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

Chroot

Chroot into into your new system. This will mount the root fs of your new system over / so you can operate on it as you would after installation.



arch-chroot /mnt

Software Installation

These are package that we thought should be installed during the system installation. Often times Arch Linux users install them after system install.

Important Packages

These are packages that really should be on any Linux system.

Important / Semi-critical:



pacman -S man-pages man-db dnsutils ethtool \
iputils net-tools iproute2 openssh wget \
usbutils usb_modeswitch tcpdump \
smartmontools  gnu-netcat \
grub efivar efibootmgr efitools 


Nice to have:



pacman -S mc dosfstools exfat-utils ntfs-3g \
partclone parted partimage gptfdisk

Note:

Install WIFI Software

Install these packages if you want to be able to use WIFI. WPA supplicant has a lot of features and is included in the ISO. We’re going to use this tool.



pacman -S iw wpa_supplicant dialog

Development Software

It is always a good idea to have development software installed. This includes compilers and other tools.



pacman -S base-devel

Install VIM

You are going to need vim to finish the installation anyway. Also, while you are at it, create a link so that when you type ‘vi’ it will run ‘vim’.



pacman -S vim
cd /usr/bin/
ln -s vim vi

echo "set mouse=v" >>  ~/.vimrc

System Configuration

Time Zone



# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

This will generate /etc/adjtime and assumes your hardware clock is set to UTC:



hwclock --systohc

Edit your /etc/locale.gen file. You will want to add en_US.UTF-8, UTF-8, and any other locales yiou might want.

For example, just uncomment this line:



vi /etc/locale.gen
    en_US.UTF-8 UTF-8

Generate your locales:



locale-gen

Edit /etc/locale.conf and set the lang:



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

Edit /etc/vconsole.conf to make any changes persistent.



/etc/vconsole.conf
KEYMAP=de-latin1

Network Configuration

The official Arch Linux network documentation can be found here:

https://wiki.archlinux.org/index.php/Network_configuration

Create / edit your hostname file:



vi /etc/hostname
myhostname

Edit your /etc/hosts file, assuming a static IP of 192.168.0.25. This may be different for you. If you are using DHCP you can just set this to 127.0.0.1 too.



vi /etc/hosts

127.0.0.1	localhost
::1		localhost
192.168.0.25	myhostname.localdomain	myhostname

Persistent Network Config

If you want your network configuration to persist, you can either create a script / systemd combo that configures the interfaces or use a network manager. We’re going to show you how to use a network manager. There are many different choices of network managers. We are going to use systemd-networkd here.

DNS Settings

Personally, I would recommend using these settings in your resolv.conf file regardless of whether or not you are using DHCP or static network configuration. I generally trust Google’s DNS servers (8.8.8.8 and 8.8.4.4).

Don’t do this if using systemd-resolved ( which I’m setting up further on ) so skip this unless you really want it setup this way:



vi /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

Choose either DHCP or Static:

DHCP



vi /etc/systemd/network/20-wired.network

[Match]
Name=enp1s0

[Network]
DHCP=ipv4

[DHCPv6]
UseDomains=true

Static IP



vi /etc/systemd/network/20-wired.network

[Match]
Name=enp1s0

[Network]
Address=10.1.10.9/24
Gateway=10.1.10.1
DNS=10.1.10.1
DNS=8.8.8.8

Network Manager

Enable the network manager. The two commented commands shouldn’t be used during install if you already have an established connection but might come in handy later.



systemctl enable systemd-networkd
systemctl enable systemd-resolved
#systemctl start systemd-networkd
#systemctl status systemd-networkd

Wifi

The official Arch Linux Wireless Network Configuration documentation can be found here: https://wiki.archlinux.org/index.php/Network_configuration/Wireless

You can configure the interface like this:



vi /etc/systemd/network/25-wireless.network
[Match]
Name=wlp2s0

[Network]
DHCP=ipv4

User Setup

Root password:



passwd

Add a user account:



useradd -m -G wheel,users -s /bin/bash user1
passwd user1

GRUB Boot Loader

You have a bunch of options for a boot loader. Two popular options are GRUB and systemd-boot. We’re going to cover GRUB here because I like it.

Here we assume you are using /dev/sda. If your system is installed on another disk, use that.



pacman -Sy grub os-prober
mkdir /boot/grub
grub-mkconfig -o /boot/grub/grub.cfg
grub-install /dev/sda

If you want ot learn more, the offical Arch Linux GRUB docs are here: https://wiki.archlinux.org/index.php/GRUB

Microcode

Linux has the abiltiy to apply CPU microcode updates. This is important for buggy CPUs. You only need either Intel or AMD microcode depending on which CPU you have. You can load both if you want which is a good idea if you are building a system on a USB drive that may run on a system with either CPU. We just add both here:



pacman -S intel-ucode amd-ucode
grub-mkconfig -o /boot/grub/grub.cfg

Time Service

Enable systemd-timesyncd:



systemctl enable systemd-timesyncd

Reboot

Exit the chroot environment and reboot:



exit  
reboot

Make sure you remove the install media before the system starts back up.

What Next?

You might want to take a look at these:

Here is my old video with bad sound and no X Windows in case you want to watch it:

Here is a slightly newer but still old Arch install video that includes KDE, XFCE, and i3 Gaps.