Skip to content

Instantly share code, notes, and snippets.

@applicato
Created July 26, 2018 12:17
Show Gist options
  • Select an option

  • Save applicato/63d065a135feb9ac33e1e76467496851 to your computer and use it in GitHub Desktop.

Select an option

Save applicato/63d065a135feb9ac33e1e76467496851 to your computer and use it in GitHub Desktop.
Arch Linux Beginners Guide

This document will guide you through the process of installing Arch Linux using the Arch Install Scripts. Before installing, you are advised to skim over the FAQ.

The community-maintained ArchWiki is the primary resource that should be consulted if issues arise. The IRC channel (irc://irc.freenode.net/#archlinux) and the forums are also excellent resources if an answer cannot be found elsewhere. In accordance with the Arch Way, you are encouraged to type to read the man page of any command you are unfamiliar with.

Table of Contents

Preparation

Arch Linux should run on any i686 compatible machine with a minimum of 256 MB RAM. A basic installation with all packages from the group should take less than 800 MB of disk space.

See :Category:Getting and installing Arch for instructions on downloading the installation medium, and methods for booting it to the target machine(s). This guide assumes you use the latest available version.

After booting into the installation media, you will be automatically logged in as the root user and presented with a Zsh shell prompt. For modifying or creating configuration files, typically in , nano or vim are suggested.

UEFI mode

In case you have a UEFI motherboard with UEFI mode enabled, the CD/USB will automatically launch Arch Linux via systemd-boot.

To verify you are booted in UEFI mode, check that the following directory is populated:

 # ls /sys/firmware/efi/efivars

See UEFI#UEFI Variables for details.

Set the keyboard layout

The default console keymap is set to us. Available choices can be listed with .

For example, to change the layout to , run:

 # loadkeys ''de-latin1''

If certain characters appear as white squares or other symbols, change the console font. For example:

 # setfont ''lat9w-16''

Connect to the Internet

The dhcpcd daemon is enabled on boot for wired devices, and will attempt to start a connection. To access captive portal login forms, use the ELinks browser.

Verify a connection was established, for example with . If no connection is available, see Network configuration or follow the below netctl examples. Otherwise, continue to #Update the system clock.

Netctl preparation
To prevent conflicts, stop the enabled dhcpcd service first, replacing with the correct wired interface:

 # systemctl stop dhcpcd@''enp0s25''.service

Interfaces can be listed using , or for wireless devices. They are prefixed with (ethernet), (WLAN), or (WWAN).

Wireless
List available networks, and make a connection for a specified interface:

 # wifi-menu -o ''wlp2s0''

The resulting configuration file is stored in . For networks which require both a username and password, see WPA2 Enterprise#netctl.

Other
Several example profiles, such as for configuring a static IP address, are available. Copy the required one to , for example :

 # cp /etc/netctl/examples/''ethernet-static'' /etc/netctl

Adjust the copy as needed, and enable it:

 # netctl start ''ethernet-static''

Update the system clock

Use systemd-timesyncd to ensure that your system clock is accurate. To start it:

 # timedatectl set-ntp true

To check the service status, use .

Prepare the storage devices

In this step, the storage devices that will be used by the new system will be prepared. Read Partitioning for a more general overview.

Users intending to create stacked block devices for LVM, disk encryption or RAID, should keep those instructions in mind when preparing the partitions. If intending to install to a USB flash key, see Installing Arch Linux on a USB key.

Identify the devices

Identify the devices where the new system will be installed:

 # lsblk

Not all devices listed are viable mediums for installation; results ending in , or can be ignored.

If the existing partition scheme does not need to be changed, you may skip to #Format the partitions.

Partition the devices

Partitioning a hard drive divides the available space into sections that can be accessed independently. The required information is stored in a partition table using a format such as MBR or GPT. Existing tables can be printed with or .

To partition devices, use a partitioning tool compatible to the chosen type of partition table. Incompatible tools may result in the destruction of that table, along with existing partitions or data. Choices include:

Name MBR GPT Variants
fdisk sfdisk, cfdisk
gdisk cgdisk, sgdisk
parted GParted

The examples below demonstrate a basic partition scheme for both types of partition tables. They assume that a new, contiguous layout is applied to a single device in . Necessary changes to device names and partition numbers must be done beforehand.

UEFI/GPT example layout
Mount point Partition Partition type (GUID) Bootable flag Suggested size
/boot /dev/sdx1 EFI System Partition Yes 260-512 MiB
[SWAP] /dev/sdx2 Linux swap No More than 512 MiB
/ /dev/sdx3 Linux No Remainder of the device
MBR/BIOS example layout
Mount point Partition Partition type Bootable flag Suggested size
[SWAP] /dev/sdx1 Linux swap No More than 512 MiB
/ /dev/sdx2 Linux Yes Remainder of the device

Format the partitions

Once the partitions have been created, each must be formatted with an appropriate file system, except for swap partitions. All available partitions on the intended installation device can be listed with the following command:

 # lsblk /dev/sd'''x'''

With the exceptions noted below, it is recommended to use the file system:

 # mkfs.ext4 /dev/sd'''xy'''

If a swap partition was created, it must be set up and activated with:

 # mkswap /dev/sd'''xy'''
 # swapon /dev/sd'''xy'''

If a new UEFI system partition has been created on a UEFI/GPT system, it must be formatted with a file system:

 # mkfs.fat -F32 /dev/sd'''xy'''

Mount the partitions

Mount the root partition to the directory of the live system:

 # mount /dev/sd'''xy''' /mnt

Remaining partitions except swap may be mounted in any order, after creating the respective mount points. For example, when using a partition:

 # mkdir -p /mnt/boot
 # mount /dev/sd'''xy''' /mnt/boot

is also recommended for mounting the (formatted or already existing) EFI System Partition on a UEFI/GPT system. See EFISTUB and related articles for alternatives.

Installation

Select the mirrors

Packages to be installed must be downloaded from mirror servers, which are defined in . On the live system, all mirrors are enabled, and sorted by their synchronization status and speed at the time the installation image was created.

The higher a mirror is placed in the list, the more priority it is given when downloading a package. You may want to edit the file accordingly, and move the geographically closest mirrors to the top of the list, although other criteria should be taken into account.

The pacstrap tool used in the next step also installs a copy of the file to the new system, so it is worth getting right.

Install the base packages

Execute the pacstrap script:

 # pacstrap /mnt

which defaults to install the group of packages.

This group represents the recommended minimum of packages for an Arch Linux installation. The group does not include all tools from the live installation, such as ; see packages.both for comparison.

To build packages from the AUR or with the ABS, the group is also required. Packages can be installed with anytime after the #Change root step later, or by appending their names to the pacstrap command. For example:

 # pacstrap -i /mnt base base-devel btrfs-progs

The switch ensures prompting before package installation.

With the base group, the first initramfs will be generated and installed to the new system's boot path; double-check output prompts for it.

Configuration

fstab

Generate an fstab file. The option indicates UUIDs. Labels can be used instead through the option.

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

Check the resulting file in afterwards, and edit it in case of errors.

Change root

Chroot to the new system:

 # arch-chroot /mnt /bin/bash

Locale

The Locale defines which language the system uses, and other regional considerations such as currency denomination, numerology, and character sets.

Uncomment in , as well as other needed localisations. Save the file, and generate the new locales:

 # locale-gen

Create , where refers to the first column of an uncommented entry in :

If you set the keyboard layout, make the changes persistent in . For example, if was set with loadkeys, and with setfont, assign the and variables accordingly:

Time

Select a time zone:

 # tzselect

Create the symbolic link , where is the value from tzselect:

 # ln -s /usr/share/zoneinfo/''Zone''/''SubZone'' /etc/localtime

It is recommended to adjust the time skew, and set the time standard to UTC:

 # hwclock --systohc --utc

If other operating systems are installed on the machine, they must be configured accordingly. See Time for details.

Initramfs

Because mkinitcpio was run on installation of with pacstrap, most users do not need to regenerate the intramfs image so this step can be skipped.

For special configurations, set the correct hooks in and re-generate the initramfs image:

 # mkinitcpio -p linux

Boot loader

See :Category:Boot loaders for available choices and configurations. Choices include GRUB (BIOS/UEFI), systemd-boot (UEFI) and syslinux (BIOS).

If you have an Intel CPU, in addition to installing a boot loader, install the package and enable microcode updates.

Network configuration

The procedure is similar to #Connect to the Internet for the live installation environment, except made persistent for subsequent boots.

Hostname

Set the hostname by adding an entry to , where myhostname is the desired host name:

It is recommended to append the same host name to , for example:

Wired

When only requiring a single wired connection, enable the dhcpcd service:

 # systemctl enable dhcpcd@''interface''.service

Where is an ethernet device name.

See Network configuration#Configure the IP address for other available methods.

Wireless

Install the , , and (for wifi-menu) packages:

 # pacman -S iw wpa_supplicant dialog

Additional firmware packages may also be required. When using wifi-menu, do so after #Unmount the partitions and reboot.

See Wireless#Wireless management for other available methods.

Root password

Set the root password with:

 # passwd

User Accounts

It is advised that you run applications with user level privileges and use the root account only for administrative tasks. In order to accomplish this, you should create a new user with:

 # useradd -m -g users -G wheel,storage,power -s /bin/bash 'username'

And give them a password with

 # passwd 'username'

See Users_and_groups for more details.

Unmount the partitions and reboot

Exit from the chroot environment by running or pressing .

Partitions will be unmounted automatically by systemd on shutdown. You may however unmount manually as a safety measure:

 # umount -R /mnt

If the partition is "busy", you can find the cause with fuser. Reboot the computer.

 # reboot

Remove the installation media, or you may boot back into it. You can log into your new installation as root, using the password you specified with passwd.

Post-installation

Your new Arch Linux base system is now a functional GNU/Linux environment ready to be built into whatever you wish or require for your purposes. You are now strongly advised to read the General recommendations article, especially the first two sections. Its other sections provide links to post-installation tutorials like setting up a graphical user interface, sound or a touchpad.

For particular areas of interest, see the List of applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment