Arch Linux Installation Guide by mt60395
This document is a guide for installing Arch Linux using the live system booted from an installation medium made from an official installation image. Additionally, it includes instructions on how to install GRUB, a desktop environment (KDE), the basic rundown of how to install a window manager, and how to mount /home to a different partition.
Note that this is not the original install guide, which can be found here. This is a modified version with additions that I have found to be fitting after installing Arch on multiple machines, multiple times.
Before installing, it would be advised to view the FAQ. For conventions used in this document, see Help:Reading. In particular, code examples may contain placeholders (formatted in italics
) that must be replaced manually.
For more detailed instructions, see the respective ArchWiki articles or the various programs' man pages, both linked from this guide. For interactive help, the IRC channel and the forums are also available.
Arch Linux should run on any x86_64-compatible machine with a minimum of 512 MiB RAM, though more memory is needed to boot the live system for installation. A basic installation should take less than 2 GiB of disk space. As the installation process needs to retrieve packages from a remote repository, this guide assumes a working internet connection is available.
Pre-installation
Acquire an installation image
Visit the Download page and, depending on how you want to boot, acquire the ISO file or a netboot image, and the respective GnuPG signature.
Verify signature
It is recommended to verify the image signature before use, especially when downloading from an HTTP mirror, where downloads are generally prone to be intercepted to serve malicious images.
On a system with GnuPG installed, do this by downloading the PGP signature (under Checksums in the Download page) to the ISO directory, and verifying it with:
$ gpg --keyserver-options auto-key-retrieve --verify archlinux-version-x86_64.iso.sig
Alternatively, from an existing Arch Linux installation run:
$ pacman-key -v archlinux-version-x86_64.iso.sig
- The signature itself could be manipulated if it is downloaded from a mirror site, instead of from archlinux.org as above. In this case, ensure that the public key, which is used to decode the signature, is signed by another, trustworthy key. The
gpg
command will output the fingerprint of the public key. - Another method to verify the authenticity of the signature is to ensure that the public key's fingerprint is identical to the key fingerprint of the Arch Linux developer who signed the ISO-file. See Wikipedia:Public-key cryptography for more information on the public-key process to authenticate keys.
Prepare an installation medium
The installation image can be supplied to the target machine via a USB flash drive with Rufus if you are currently using a Windows operating system.
balenaEtcher is an alternative.
Boot the live environment
- After heading to BIOS, point the current boot device to the one which has the Arch Linux installation medium. Typically it is achieved by pressing a key during the POST phase, as indicated on the splash screen. Refer to your motherboard's manual for details.
- When the installation medium's boot loader menu appears, select Arch Linux install
medium and press
Enter
to enter the installation environment.Tip: The installation image uses systemd-boot for booting in UEFI mode and syslinux for booting in BIOS mode. See README.bootparams for a list of boot parameters. - You will be logged in on the first virtual console as the root user, and presented with a Zsh shell prompt.
Set the keyboard layout
The default console keymap is US. Available layouts can be listed with:
# ls /usr/share/kbd/keymaps/**/*.map.gz
To modify the layout, append a corresponding file name to loadkeys(1), omitting path and file extension. For example, to set a German keyboard layout:
# loadkeys de-latin1
Console fonts are located in
/usr/share/kbd/consolefonts/
and can likewise be set with setfont(8).
Verify the boot mode
To verify the boot mode, list the efivars directory:
# ls /sys/firmware/efi/efivars
If the command shows the directory without error, then the system is booted in UEFI mode. If the directory does not exist, the system may be booted in BIOS (or CSM) mode. If the system did not boot in the mode you desired, refer to your motherboard's manual.
Connect to the internet
- Ensure your network interface is listed and enabled, for example with ip-link(8):
# ip link
- Connect with ethernet by plugging in the cable.
- For Wi-Fi, make sure the wireless card is not blocked with rfkill. Authenticate to the wireless network using wpa_supplicant.
- If you have connection issues after rebooting into the install (not from a live environment and arch-chroot), use nmcli.
Make sure that the font doesn't confuse you when typing in your SSID for wireless connections. 1's, i's, and L's may look very similar.
The connection may be verified with ping:# ping archlinux.org
Update the system clock
Use timedatectl(1) to ensure the system clock is accurate:
# timedatectl set-ntp true
To check the service status, use timedatectl status
.
If you have a partition for Windows, it is common to have Linux use local time and have Windows sync the time.
Use this command to have Linux use local time:
# timedatectl set-local-rtc 1 --adjust-system-clock
Partition the disks
When recognized by the live system, disks are assigned to a block device such as /dev/sda
,
/dev/nvme0n1
or /dev/mmcblk0
. To identify these devices, use lsblk or fdisk.
# fdisk -l
Results ending in rom
, loop
or airoot
may be ignored.
The following partitions are required for a chosen device:
- One partition for the root directory
/
. - For booting in UEFI mode: an EFI system partition.
If you want to create any stacked block devices for LVM, system encryption or RAID, do it now.
Example layouts
Mount point | Partition | Partition type | Suggested size |
---|---|---|---|
[SWAP]
|
/dev/swap_partition
|
Linux swap | More than 512 MiB |
/mnt
|
/dev/root_partition
|
Linux | Remainder of the device |
Mount point | Partition | Partition type | Suggested size |
---|---|---|---|
/mnt/boot
|
/dev/efi_system_partition
|
EFI system partition | At least 128 MiB |
[SWAP]
|
/dev/swap_partition
|
Linux swap | More than 512 MiB |
/mnt
|
/dev/root_partition
|
Linux x86-64 root (/) | Remainder of the device |
See also Partitioning#Example layouts.
- Use fdisk or parted to modify partition tables, for example
fdisk /dev/the_disk_to_be_partitioned
. - Swap space can be set on a swap file for file systems supporting it. Note that a swap partition is not necessary.
- If the disk from which you want to boot already has an EFI system partition, do not create another one, but use the existing partition instead.
To partition with cfdisk:
# cfdisk /dev/disk_name
I personally have a 128M EFI partition and a 32G size root partition. It works for me because I have plenty of RAM.
Format the partitions
Once the partitions have been created, each newly created partition must be formatted with an appropriate file system. For example, to create an Ext4 file system on
/dev/root_partition
, run:
# mkfs.ext4 /dev/root_partition
Create a FAT32 file system on your EFI partition: (Ignore any further instructions about EFI partitions if you are using BIOS with MBR)
$ pacman -S dosfstools # mkfs.fat -F32 /dev/efi_partition
If you created a partition for swap, initialize it with mkswap(8):
# mkswap /dev/swap_partition # swapon /dev/swap_partition
See File systems#Create a file system for details.
/dev/*_partition
with the appropriate block device path.
Mount the file systems
Mount the root volume to /mnt
. For example, if the root volume is
/dev/root_partition
:
# mount /dev/root_partition /mnt
If you have an EFI partition:
# mkdir /mnt/boot # mount /dev/efi_partition /mnt/boot
genfstab(8) will later detect mounted file systems and swap space.
Installation
Select the mirrors
Packages to be installed must be downloaded from mirror servers, which are defined in /etc/pacman.d/mirrorlist
. On the live system, after connecting to the internet, reflector updates the mirror list by choosing 70 most recently synchronized HTTPS mirrors and sorting them by download rate.[2]
The higher a mirror is placed in the list, the more priority it is given when downloading a package. You may want to inspect the file to see if it is satisfactory. If it is not, edit the file accordingly, and move the geographically closest mirrors to the top of the list, although other criteria should be taken into account.
Install essential packages
Use the pacstrap(8) script to install the base packages, Linux kernel and firmware for common hardware, NetworkManager for networking, GRUB (+ efibootmgr and os-prober) as a bootloader, and nano as a text editor (optionally, you can use vim as a text editor):
# pacstrap /mnt base base-devel linux linux-firmware networkmanager grub nano efibootmgr os-prober
To install other packages or package groups, append the names to the pacstrap command above (space separated) or use pacman while chrooted into the new system. For comparison, packages available in the live system can be found in packages.x86_64.
Configure the system
Fstab
Generate an fstab file (use -U
or -L
to define by UUID or labels, respectively):
# genfstab -U /mnt >> /mnt/etc/fstab
Check the resulting /mnt/etc/fstab
file, and edit it in case of errors.
Chroot
Change root into the new system:
# arch-chroot /mnt
Time zone
Set the time zone:
# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
- "America/Chicago" is a valid Region/City for CDT.
Run hwclock(8) to generate /etc/adjtime
:
# hwclock --systohc
This command assumes the hardware clock is set to UTC. See System time#Time standard for details.
Localization
Edit /etc/locale.gen
and uncomment en_US.UTF-8 UTF-8
and other needed
locales.
Generate the locales by running:
# locale-gen
Create the locale.conf(5) file, and set the LANG variable accordingly:
/etc/locale.conf
LANG=en_US.UTF-8
If you set the keyboard layout, make the changes persistent in vconsole.conf(5):
/etc/vconsole.conf
KEYMAP=de-latin1
Network configuration
Create the hostname file:
/etc/hostname
myhostname
Add matching entries to hosts(5):
/etc/hosts
127.0.1.1 myhostname.localdomain myhostname
Note: Tab indents are in use, not spaces.
If the system has a permanent IP address, it should be used instead of 127.0.1.1
.
Enable NetworkManager at startup.
# systemctl enable NetworkManager
Initramfs
Creating a new initramfs is usually not required, because mkinitcpio was run on installation of the kernel package with pacstrap.
For LVM, system encryption or RAID, modify mkinitcpio.conf(5) and recreate the initramfs image:
# mkinitcpio -P
Root password
Set the root password:
# passwd
Install GRUB Bootloader
Install GRUB to the disk name, not a partition. Run the grub-mkconfig
command if you add another operating system to the same disk.
# grub-install /dev/disk_name --efi-directory=/boot # grub-mkconfig -o /boot/grub/grub.cfg
If you have an Intel or AMD CPU, enable microcode updates in addition.
Reboot
Exit the chroot environment by typing exit
or login
or pressing Ctrl+d
.
Optionally manually unmount all the partitions with umount -R /mnt
: this allows noticing any "busy" partitions, and finding the cause with fuser(1).
Finally, restart the machine by typing reboot
: any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation medium and then login into the new system with the root account.
Post-installation: Adding users
Reference: https://wiki.archlinux.org/index.php/Users_and_groups
Add a new user and password for the user.
# useradd -mg wheel username # passwd username
visudo is a safe way to edit the sudoers file for granting permissions to users. Start by setting up the text editor to use with visudo.
$ export EDITOR=nano $ visudo
/etc/sudoers.tmp
## ## User privilege specification ## root ALL=(ALL) ALL username ALL=(ALL) ALL
You can uncomment out the other options if you wish. I have allowed members of group wheel to execute any command.
For changing permissions in the future after being logged in to a user that is not root, you must do sudo su
and then proceed.
Login as your new user.
$ login
Desktop environment
Visit here for a list of more desktop environments. This guide only focuses on KDE Plasma because I use it.
KDE Plasma
KDE Plasma is a beautiful desktop environment. It is a great choice for those who love customization. However, it isn't very lightweight and I wouldn't recommend this DE for lower end systems.
$ pacman -S plasma-meta kde-applications xorg xorg-xinit
/.xinitrc
exec startkde
$ systemctl enable sddm $ reboot
Window manager
Window managers are solely window managers. Other programs like file managers, display managers, and terminal emulators must be installed separately.
Window managers are more minimalist than desktop environments. I would personally recommend bspwm. i3wm sucks.
The process is as follows:
- Install a window manager. For bspwm, make sure that you make the configuration files executable.
- Optionally, install a display manager. The alternative would be to manually start up your window manager after logging in. Enable it at startup with systemctl.
- Install a terminal emulator.
- Optionally, install a status bar like polybar.
- If you want a file manager, Thunar is a good choice. ranger is also viable.
- I use a clipboard manager, clipit.
Moving /home
You might want to move your /home folder to another drive if the other drive has more storage available for your programs.
- Create a partition with a partition manager or cfdisk. Make sure it's a Linux filesystem type. After, run the following:
# sudo mkfs.ext4 /dev/new_partition # sudo mount /dev/new_partition /mnt # cd /mnt # sudo rm -rf lost+found
-
Copy over /home to /mnt.
# sudo cp -rp /home/* /mnt
List the files and directories of /mnt to make sure everything was copied correctly:
# ls
After making sure, move on:
$ cd / # sudo mv /home /home.orig # sudo mkdir /home # sudo umount /dev/new_partition # sudo mount /dev/new_partition /home/ # sudo cp /etc/fstab /etc/fstab.orig # sudo chmod a=rwx /etc/fstab
/home was archived and a new directory for /home replaced it. The new partition was mounted to the new /home. The fstab file was also archived. chmod granted you permission to edit the file. Now edit /etc/fstab:
/etc/fstab
/dev/new_partition /home ext4 defaults 0 0
Note: Tab indents are in use, not spaces.
Proceed to reboot.
$ sudo reboot now
Check if everything is correct.
# df /dev/new_partition
Delete home.orig.
# sudo rm -rf home.orig
Pacman
pacman is the package manager for Arch Linux.
Usage
Read the wiki to learn how to install packages using pacman and use its other functions; this just provides some basic tips.
You should use pacman -Rns
to remove packages because
it removes the package AND any orphaned dependencies that will occur as a result of this removal.
Its configuration files saved by pacman will not be removed.
pacman -Syy
syncs your packages and refreshes your package database.
pacman -Sc
can clear the cache.
Installing AUR packages
Install yay, an AUR helper.
# git clone https://aur.archlinux.org/yay.git # cd yay # makepkg -si # cd .. # rm -rf yay
To install packages from the AUR, run
yay -S package
Miscellaneous
Setting defaults
xdg-settings can be used to set defaults if you don't have a feature in your desktop environment to do so.
$ xdg-settings set default-web-browser firefox.desktop
Troubleshooting
'Permission denied' or 'Unable to write'
Usually the solution is just to prepend sudo
to the command or switch to the root user by:
$ sudo su
History
- Installation Guide (2020) - ArchWiki
- Arch Linux Installation Guide by mt60395 (2020) - mt60395