How to install Arch Linux on a PC

Arch Linux is known for its complex command-based installation. But once you get to grips with the ins and outs of the process, you can install Arch on any computer without worrying about the terminal. We’ll help you get there.

Note: The Arch Linux ISO contains a script called archinstall is supposed to help you through the process. As of this writing, however, the script is still experimental and prone to errors in our tests. Instead, this guide covers the standard installation method.

table of contents

Download the Arch Linux ISO
Preparatory steps
Install the Arch Linux system
Create the required partitions
Formatting the partitions
Installation and configuration of the system
Create and configure users
Setting up the GRUB boot loader
Install a desktop environment in Arch

Download the Arch Linux ISO

The first step is to download the Arch Linux installation image from a suitable mirror. To do this, visit the Arch Linux download Page, and depending on how you want to download the ISO, select the appropriate option. Options available include direct download, torrenting, virtual machine image, “netboot” installation for wired connections, and more.

For the sake of simplicity, we are performing a direct download. Scroll down to the list of available mirrors and select one. Choosing a server close to your geographic location will ensure that you get a fast and stable download speed. Check the ISO checksums to confirm that the downloaded file is genuine and safe.

The next steps include creating a bootable USB drive, restarting your computer, and booting from the newly created installation media instead of the hard drive. The Arch Linux boot interface will load and you will be prompted to choose from the various options displayed.

Select the option highlighted by default by clicking “Enter. “After the system has successfully loaded the files required for the installation, you will see the” root @ archiso “prompt.

Preparatory steps

If you continue, you will need an active internet connection for the installation to complete. The Arch installer indicates that Ethernet and DHCP connections should work automatically. However, users on a wireless network must set up a connection manually.

To be sure, verify that you are connected to a network by typing ping . If the output looks something like this, you can jump to it the next section .

Check network under Arch Linux with ping

However, if you get the “Temporary Name Resolution Failure” error, you will need to connect to the Internet using the iwctl command.

First start the utility interactively by typing iwctl in the terminal. Then check the name of your wireless interface by doing the device list Command. In general, the name of the wireless interface starts with a “w”, such as B. wlan0 or wlp2s0.

Next, run the commands below to find and connect to your SSID. Substitute [device] and [SSID] in the commands with your wireless interface or your Wi-Fi name.

                      iwctl station [device] get-networks
iwctl station [device] connect [SSID]

The system will then ask you for the WiFi password if you have one set up. Enter it and press “Enter”carry on. Run ping again to check the connection.

Enable network time synchronization with timedatectl by running the following command:

                      timedatectl set-ntp true

Install the Arch Linux system

With your PC connected to the internet, you’re ready to begin. The Arch installation process is essentially similar to installing any other Linux distribution. So what’s the catch?

While other distributions provide a graphical user interface for configuring and setting up the operating system, Arch Linux only comes with a command line interface. All instructions, commands or configurations must be executed through the shell.

Create the required partitions

To install Arch you need to create three partitions viz EFI , root , and To deceive . List the available storage devices on your system. on fdisk -l . Most of the time the HDD is saved as a /dev/sda and SSDs are listed as /dev/nvme0n1 .

Run fdisk by entering fdisk /dev/sda or fdisk /dev/nvme0n1 , depending on whether you are installing the operating system on an HDD or SSD. Then enter g and press “Enter”To create a new GPT partition table.

How to use Fdisk to manage partitions on Linux

Type n to create a new EFI partition and select the partition type primary . Blow “Enter”Twice to continue with the default partition number and the first sector value.

As the partition size, you can either enter the sector number manually or specify the desired partition size. Since you don’t want to waste space on EFI partitions, any number between 500MB and 1GB would work. Type +550M and press “Enter” keep going.

You are free to replace 550M in the above command with the desired size for the partition.

Create partitions with fdisk

Similarly, create a swap partition with +2G as the last sector value. Finally, create a root partition and assign any remaining sectors to it by simply continuing with the default configurations.

How big should your swap file or swap partition be?

By default, all partitions are of the Linux file system type. To change this, enter t and press “Enter”. Select the EFI partition by typing 1 . Then enter ef to change the file system to EFI system type.

Similarly, select the swap partition (partition number 2) and enter 82 to convert partition type to Linux swap. The root partition should be Linux File System type so we don’t need to change it.

Type w and press “Enter“To write the changes to the hard disk.

How to choose a partition scheme for your Linux PC

Formatting the partitions

Now you need to format the partitions with the mkfs Command. Format the /dev/sda1 (EFI) partition on FAT32 by typing:

                      mkfs.fat -F32 /dev/sda1

Run the following command again to format the file /dev/sda3 (root) partition on ext4:

                      mkfs.ext4 /dev/sda3

Issue the following commands in sequence to format and activate the swap partition:

                      mkswap /dev/sda2
swapon /dev/sda2

Warning: For those dual booting Linux with Windows, make sure you have the correct partitions set up. Be especially careful when formatting partitions or creating new ones as a mistake here could render your Windows system unusable.

Installation and configuration of the system

In order to be able to install Arch on your hard drive, you have to mount the created partitions in the appropriate directories. Mount the root partition ( /dev/sda3 ) to the /mnt Directory.

                      mount /dev/sda3 /mnt

The next step is to install the basic Linux packages on the mounted root partition.

                      pacstrap /mnt base linux linux-firmware

This can take some time, depending on the network connection. When you’re done, generate a filesystem table with the genfstab Command.

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

The Arch Linux system runs on the /mnt Directory. You can change root to access the system by typing:

                      arch-chroot /mnt

The change in the bash Prompt indicates that you have now logged into the newly installed Arch Linux system. Before you can proceed, you need to configure some settings and install the necessary packages for the system to work properly.

Set the local time zone by creating a symlink between the directories “/ usr / share / zoneinfo” and “/ etc / localtime”.

                      ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

Replace “Region” and “City” in the above command with the appropriate time zone. You can refer to this time zone database to check the region and city you need to enter.

Then synchronize the hardware clock with the system time by doing the following:

                      hwclock --systohc

Before proceeding, install Vim (or another text editor of your choice) and the networkmanager package.

                      pacman -S vim networkmanager

Next, edit the /etc/locale.gen file with your text editor and uncomment the locale statement that suits your needs. For the purposes of this guide we will use the comment characters of the en_US.UTF-8 UTF-8 Line in the file with Vim.

                      vim /etc/locale.gen

After editing the file, type locale-gen in the terminal to generate the locale configuration.

Next, create a new hostname file in it /etc and paste the desired host name for your computer into the file. This can be anything you want and all you have to do is type in the name. When you’re done, don’t forget to save the file.

                      vim /etc/hostname

Create another text file named hosts under the /etc Directory.

                      vim /etc/hosts

You will notice that the file already has some comments in it. Leave the comments as they are and append the following text to the file. Remember to replace hostname in the command with the system host name you set in the previous step.

::1              localhost        hostname.localdomain        hostname

Create and configure users

Set up the root user password by entering: passwd Command. Then create an additional non-root user with useradd replace as follows username with your username:

                      useradd -m username

Configure the new user’s password with the passwd Command to replace again username with your username.

                      passwd username

Add the new user to the groups wheel , audio , and video with the command given below. Substitute username with your username and note that the group names in the command do not contain spaces after the commas.

                      usermod -aG wheel,video,audio username

Setting up the GRUB boot loader

First install the grub Package with Pacman.

                      pacman -S grub

Then install these additional packages that are required for the boot loader to work properly.

                      pacman -S efibootmgr dosfstools os-prober mtools

Mount your EFI partition ( /dev/sda1 ) to the /boot/EFI Directory. Note that you have to create the directory first mkdir .

                      mkdir /boot/EFI
mount /dev/sda1 /boot/EFI

Finally run the grub-install Script to install the boot loader in the EFI directory.

                      grub-install --target=x86_64-efi --efi-directory=/boot/EFI --bootloader-id=grub

Generate a GRUB configuration file with grub-mkconfig as follows:

                      grub-mkconfig -o /boot/grub/grub.cfg

Install a desktop environment in Arch

Unlike other Linux distributions, Arch Linux doesn’t come with a pre-installed desktop environment. And if you want to control the system through a GUI, you have to install one manually.

You can install any DE, but we’ll install the KDE plasma Desktop on this system. But first, let’s configure the display server, network manager, and similar services.

Run the following command to install the xorg , plasma-meta , and kde-applications Packages:

                      pacman -S xorg plasma-meta kde-applications

Then enable the SDDM and NetworkManager services by typing:

                      systemctl enable sddm
systemctl enable NetworkManager

Exit the arch-chroot environment by typing exit . Then unmount the root partition that is in the /mnt Directory as follows:

                      umount -f /mnt

Finally, restart your system by typing reboot and remove the installation media. As soon as the system boots you will find that the dark terminal screen has now been replaced by the colorful SDDM splash screen.

Arch Linux login screen after reboot

To log in, enter the user password and click on “Enter. ”You can also install and switch between multiple desktop environments using the Session drop-down menu on the Welcome screen.

How to install and use a different desktop environment on Linux

Related Posts