The Arch Linux Handbook - Learn Arch Linux For Beginners

Download as pdf or txt
Download as pdf or txt
You are on page 1of 82

The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.

org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

JANUARY 18, 2022 / #ARCHLINUX

The Arch Linux Handbook –


Learn Arch Linux for
Beginners
Farhan Hasin Chowdhury

If you ask a group of developers what Linux is, most of


them will probably say it's an open-source operating
system. Those with more technical knowledge will
probably call it a kernel.

1 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
For me, though, Linux is not just an operating system or a kernel. For
Learn
me, it's freedom. Thetofreedom
code — free 3,000-hour
of putting curriculum
together an operating
system according to my needs, and that's where Arch Linux comes
in.

According to their wiki,

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, con�gured


by the user to only add what is purposely required.

In other words, Arch Linux is a distribution optimized for x86-64


architecture targeted at experienced Linux users. It lets you have
full responsibility and control over your system.

You'll get to choose what packages you want, the kernel (yes there
are multiple), the boot-loader, the desktop environment, and so on.

Have you ever heard someone say,

Oh – by the way, I use Arch Linux!

This is because installing Arch Linux on a machine requires you to


have proper knowledge of how different parts of a Linux
distribution work. So running Arch Linux on your system is kind of a
testament to your understanding of Linux.

Speaking from experience, installing Arch Linux is not very different


2 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Speaking from experience, installing Arch Linux is not very different


Forum Donate
from installing something like Fedora or Ubuntu. It's just that you
Learnthe
have to go through to code — free 3,000-hour
individual curriculum
steps manually instead of having
an installer do the things for you. But once you've gone through the
process, you'll start to understand how the other distributions work
in general.

In this article, I'll walk you through the entire process of installing
and con�guring Arch Linux on your machine. I'll also discuss some
common tasks and troubleshooting tips near the end.

So come with me and I'll show you how deep the rabbit hole goes.

Table of Contents
• Some Assumptions I'm Making

• How to Create a Bootable Arch Linux USB Drive

• How to Prepare Your Computer for Installing Arch Linux

• How To Install Arch Linux

• How To Set the Console Keyboard Layout and Font

• How To Verify the Boot Mode

• How To Connect to the Internet

• How To Update the System Clock

• How To Partition the Disks

• How To Format the Partitions

• How To Mount the File Systems

• How To Con�gure the Mirrors

• How To Install Arch Linux Base System

3 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

• How To Con�gure Arch Linux Forum Donate

• How ToLearn to code


Generate — free
the Fstab3,000-hour
File curriculum

• How To Login to The Newly Installed System Using


Arch-Chroot

• How To Con�gure the Time Zone

• How To Con�gure the Localization

• How To Con�gure the Network

• How To Set the Root Password

• How To Create a Non-root User

• How To Install Microcode

• How To Install and Con�gure a Boot Loader

• How To Install Xorg

• How To Install Graphics Drivers

• How To Install a Desktop Environment

• How To Install GNOME

• How To Install Plasma

• How To Finalize The Installation

• How To Switch Between Desktop Environments

• How To Manage Packages Using Pacman

• How To Install Packages Using Pacman

• How To Remove Packages Using Pacman

• How To Upgrade Packages Using Pacman

• How To Search for Packages Using Pacman

4 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

• How To Use AUR in Arch Linux Forum Donate

• How ToLearn to code


Install — freeUsing
Packages 3,000-hour curriculum
a Helper

• How To Install Packages Manually

• How To Troubleshoot Common Problems

• How To Use the Live Arch ISO as a Rescue Media

• Further Reading

• Conclusion

Some Assumptions I’m Making


Before I jump into the core of the tutorial, I want to clarify a few
things. To make this entire article approachable, I'm making the
following assumptions about you and your system:

• You know about Arch Linux at a basic level

• Arch Linux

• Frequently asked questions

• Arch compared to other distributions

• Your computer is using UEFI and not BIOS

• You have a USB drive large enough (4GB) to boot Linux from

• You have some previous experience installing Linux


(Ubuntu/Fedora)

• You have enough space to install linux on your HDD or SSD

That's pretty much it. If you have all of the above, you're good to go.

5 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
How to Create a Bootable Arch
Learn to code — free 3,000-hour curriculum
Linux USB Drive
To download Arch Linux, head to https://archlinux.org/download/
and download the latest release (2022.01.01 as of this writing). The
ISO should be around 870 megabytes in size.

Once downloaded, you'll need to put it in your USB. You can use the
Fedora Media Writer program to do that. Download and install the
application on your system. Now connect your USB drive and open
the application:

Click on "Custom image" and use the �le browser to pick the
downloaded Arch Linux ISO �le.

6 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

The application will now let you pick one of your connected USB
drives. Be very careful in selecting the right one if you have multiple
USB drives connected to your machine. Now hit the "Write to Disk"
button and wait until the process is �nished.

How to Prepare Your Computer


for Installing Arch Linux
In this step you'll have to make a few changes to your system,
otherwise Arch Linux may fail to boot or run properly.

The �rst change that you'll have to make is disabling secure boot in
your UEFI con�guration. This feature helps prevent malware
attacks during boot but it also prevents the Arch Linux installer from
booting.

Detailed instructions on how you can disable this vary depending on


your motherboard or laptop brand. You'll have to search the
internet yourself to �nd the right way this time.

The second thing that you should disable is only relevant if you're
installing Arch Linux alongside Windows. There is a Windows
feature called fast startup that reduces the boot time of your

7 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

computer by partially hibernating it. Forum Donate

Learn
This is generally to code
a nice — free
feature 3,000-hour
to have but it curriculum
prevents any other
operating system in a dual boot con�guration from accessing the
hard disk in the process.

To disable this feature, open the start menu and search for "Choose
a power plan" as follows:

Then on the next window, click on "Choose what the power buttons
do" from the left sidebar:

8 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Then on the next window you'll see a list of "Shutdown settings" and
the "Turn on fast startup (recommended)" option should be shown
as read only there.

Click the "Change settings that are currently unavailable" at the top

9 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

and you should then be able to change the settings. Forum Donate

Learn to code — free 3,000-hour curriculum

Untick the "Turn on fast startup (recommended)" option and press


the "Save changes" button at the bottom. From now on the boot
process may take a few moments extra but it's all worth it.

In this article, I'll install Arch Linux as my default operating system.


So I'll allocate my entire disk space to it.

If you're trying to install it alongside Windows, however, I have a


dedicated article on the topic. And in that article, there is a section
that discusses the partitioning process in great detail.

How To Install Arch Linux


Assuming that you have a bootable USB drive and your computer is
con�gured properly, you'll have to boot from the USB drive. The

10 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

process of booting from a USB drive differs from machine


Forumto Donate
machine.
Learn to code — free 3,000-hour curriculum

On my machine, hitting the F12 key during boot takes me to the list
of bootable devices. From there I can pick my bootable USB drive.
You may already know the appropriate technique for your computer
or you may have to research a bit.

Once you've managed to land on the list of connected bootable


devices, select your USB drive to boot from and the following menu
should show up:

Choose the �rst one from the list and wait until the Arch installer
�nishes booting up. Once fully booted up, you'll see something like
this:

11 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

That's it. That's all you'll get. Unlike other operating systems that
you maybe familiar with, the Arch installer doesn't have any
graphical user interface to automate the installation.

It rather requires you to invest your time and effort and con�gure
each part of the distribution piece by piece. It may sound daunting
but, to be honest, if you understand what you're doing, installing
Arch Linux is quite fun.

How To Set the Console Keyboard Layout


and Font
As I've already said, the Arch installer doesn't have a graphical user
interface so there's going to be a lot of typing. Con�guring your

12 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

keyboard layout and a nice looking font can make the Forum
installation Donate
process a lot less frustrating.
Learn to code — free 3,000-hour curriculum
By default, the console assumes that you have a standard US
keyboard layout. This should be �ne for most people but just in case
if you happen to have a different one, you can change to that.

All the available keymaps are usually kept inside the /usr/share
/kbd/keymaps directory in the form of map.gz �les. You can see the
list of them by using the ls command:

ls /usr/share/kbd/keymaps/**/*.map.gz

This will list out all the available key maps:

13 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Now for example,


Learnif to
you have
code the Mac-US
— free keyboard
3,000-hour layout, locate
curriculum
the corresponding map.gz �le from this list which is the mac-
us.map.gz one.

You can use the loadkeys command to load the desired keymap. To
set mac-us.map.gz as default, execute the following command:

loadkeys mac-us

You can also change the console font if you don't like the default
one. Just like the keymaps, the console fonts are kept inside the
/usr/share/kbd/consolefonts which you can list out using the ls
command:

ls /usr/share/kbd/consolefonts

This will list out all the available fonts:

14 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

You can now use the setfont command for setting one of these. For
example, if you want to set the drdos8x16 as default, execute the
following command:

setfont drdos8x16

Both the loadkeys and setfont commands are part of the kbd
package containing essential Linux keyboard tools. They have great
documentation so if you'd like to learn more, feel free to check it out.

How To Verify the Boot Mode


Now that you have your console con�gured, the next step is to make
sure that you've booted in UEFI mode and not in BIOS mode.

To be honest, this step seems unnecessary to me since it literally


says x86_64 UEFI in the live boot menu. But let's do it for the sake
of the of�cial Arch installation guide.

To verify the boot mode, execute the following command:

15 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
ls /sys/firmware/efi/efivars

Learn to code — free 3,000-hour curriculum

If you're in UEFI mode then, it will list out a bunch of �les on your
screen:

In case of a BIOS boot, the efi directory won't even exist inside the
/sys/firmware directory. If you're in UEFI mode, (which you should
be if you've followed everything properly) continue to the next step.

How To Connect to the Internet


Unlike a lot of other live distributions, the Arch live environment
doesn't come with all necessary packages built into it. It contains a

16 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

number of bare minimum packages that you can use to install the Donate
Forum
rest of the system. So, a working internet connection is a must.
Learn to code — free 3,000-hour curriculum
If you're using a wired network then you should have a working
internet connection from the get go. To test it out, ping any of the
public addresses out there:

I'm making these screenshots using VirtualBox, so the internet


connection works perfectly with the wired connection. But if you
have a wireless connection, things can get a bit tricky.

The live environment comes with the iwd or iNet wireless daemon
package. You can use this package to connect to a nearby wireless
network.

To begin with, execute the following command:

17 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum


iwctl

This will start an interactive prompt as follows:

Now execute the following command to see the list of available


wireless devices:

device list

This will spit out a list of available wireless devices. By wireless

18 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

devices I mean any wireless adapter connected to your computer. Donate


Forum
Let's assume wlan0 is the device name.
Learn to code — free 3,000-hour curriculum

To scan for nearby wireless networks using the found device,


execute the following command:

# station <device> scan

station wlan0 scan

You may think that this command will print out a list of all the
nearby networks, but that's not the case. To see the list of networks,
execute the following command:

# station <device> get-networks

station wlan0 get-networks

Now assuming the name of your home network is called Skynet ,


you can connect to it by executing the following command:

# station <device> connect <SSID>

station wlan0 connect Skynet

The iwctl program will prompt you for the wi-� password. Put it in
carefully and, once connected to the network, exit the program by

19 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

writing exit and hitting enter. Try pinging a public address


Forumonce Donate
again and make sure that the internet is working �ne.
Learn to code — free 3,000-hour curriculum

How To Update the System Clock


In Linux, NTP or Network Time Protocol is used for synchronizing
computer system clocks over a network. You can use the
timedatectl command to enable NTP on your Arch live
environment:

timedatectl set-ntp true

This command will start outputting some output and after a few
seconds. If you do not see the command cursor show up again, try
pressing Enter. I've faced this inconvenience a few times in the past.

How To Partition the Disks


This is probably the most sensitive step of the entire installation
process – because if you mess up your partitions, you lose your
precious data. So my advice would be to not immediately follow
along with this section. Instead, read the whole section �rst and
then follow along.

To begin the partitioning process, you'll have to �rst know about the
different disks connected to your computer. You can use fdisk
which is a dialog-driven program for creation and manipulation of
partition tables.

fdisk -l

20 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum


This command will list the partition tables for all the available
devices on your computer.

As you can see, there are two devices connected to my computer


(virtual machine actually). Depending on the number of devices you
have, this list can be longer so ignore any device ending with rom ,
loop , or airoot when reviewing the list. You can not use those
devices for the installation.

So that leaves us with the /dev/sda device. Keep in mind that this
can be completely different on your machine. For example, if you
have an NVME drive, you may see /dev/nvme0n1 instead.

21 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Once you've decided which device to use, it's a good idea to check ifDonate
Forum
there are any existing partitions inside that device. To do so, you can
Learn to code — free 3,000-hour curriculum
use the following variation of the same fdisk command:

fdisk /dev/sda -l

Remember to replace /dev/sda with what you have. This command


will list out all the partitions inside the given device.

Although there are no partitions in this device, in a real life situation


you may have previously created partitions. Those partitions will
show up as /dev/sda1 , /dev/sda2 or in the case of a NVME drive

22 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

/dev/nvme0n1p1 , /dev/nvme0n1p2 and so on. Forum Donate


The fdisk program can do a lot more than just listing partitions.
Learn to code — free 3,000-hour curriculum
Consult the corresponding ArchWiki page to know about the tasks
you can perform using this program.

There is another program cfdisk which is a curses- (programming


library) based disk partition table manipulator for Linux. It's similar
in functionality with fdisk but being curses-based means it has an
interface which makes it easier to work with.

Execute the following command to start cfdisk on your preferred


device:

cfdisk /dev/sda

Remember to replace /dev/sda with what you have. If the device


has a previously created partition table, then cfdisk will directly
show the list of partitions. Otherwise you'll get to choose a partition
table type to begin with:

23 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Choose gpt for your UEFI based system. Next, you'll land on the list
of partitions and free space on the device:

You can move vertically along the list of devices using your up/down
arrow keys and move horizontally along the different actions using
the left/right arrow keys.

To install Arch, or any other Linux distribution, you'll need three

24 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

separate partitions. They are as follows: Forum Donate

Learn to code — free 3,000-hour curriculum


• EFI system partition – for storing �les required by the UEFI
�rmware.

• ROOT – for installing the distribution itself.

• SWAP – for serving as the over�ow space for your RAM.

Make sure the right partition/free space is highlighted in the list and
select the [ New ] action.

Put the desired partition size. You can use M to denote megabytes,
G for gigabytes, and T for terabytes.

For an EFI system partition, you should allocate at least 500MB.

25 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Once you've put your desire size, press Enter to �nalize. The
Forum Donate
updated list of partitions may look as follows:
Learn to code — free 3,000-hour curriculum

The EFI system partition is a special type of partition. It has to be in a


speci�c type and format. To change the default type, keep the newly
created partition highlighted and select [ Type ] from the list of
actions.

26 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

From this long list of types, highlight EFI System and press Enter.
The type of the partition in the list should update accordingly:

Next is the root partition. Highlight the remaining free space and
select [ New ] once again. This time assign 10GB to this partition.

27 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

The ideal size of the root partition depends on your necessities.


Forum Donate
Personally I allocate at least 100GB to the root partition of all my
Learn to code — free 3,000-hour curriculum
Linux installations.

You don't need to change the type of this partition. The default
Linux filesystem will do.

Create one last partition with the remaining space and change its
type to Linux swap from the menu:

28 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

The ideal size of a swap partition is a matter of debate. Personally I


don't have swap partitions on my machines. The amount of physical
RAM I have is more than enough. But if I ever feel the need for one
later on, I use a swapfile instead. Anyways, the �nal state of your
device should be as follows:

29 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum


If you're happy with the set-up, highlight [ Write ] from the action
list and hit Enter. The program will ask whether you want to persist
these changes or not. You'll have to write yes and press enter if you
agree. Once the partition table has been altered, select [ Quit ] to
exit from the program.

One thing that I would like to mention for those trying to install
Arch Linux alongside Windows is, in that case, the EFI system
partition should already exist in your device. So don't touch that.
Just create the other partitions and move on.

How To Format the Partitions


Now that you've created the necessary partitions, you'll have to
format them accordingly. You can use the mkfs and mkswap
programs to do that. Before the formatting, take a �nal look at your
partition list by executing the following command:

fdisk /dev/sda -l

This time you'll see the three newly created partitions with their
details:

30 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Take note of the device names, like /dev/sda1 , /dev/sda2 ,


/dev/sda3 and so on. The EFI system partition has to be in FAT32
format. Execute the following command to format a partition in
FAT32 format:

mkfs.fat -F32 /dev/sda1

The next one is the root partition. It can be in a number of formats,


but I prefer using EXT4 for all of my Linux �lesystems. Use the
following command to format the partition in EXT4:

mkfs.ext4 /dev/sda2

This operation may take a few moments to �nish depending on your


partition size. Finally, the swap partition. Use the following

31 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

command to format that: Forum Donate

Learn to code — free 3,000-hour curriculum


mkswap /dev/sda3

With that, you've �nished the process of preparing your partitions


for the installation.

How To Mount the File Systems


Now that you've created and formatted your partitions, you're
ready mount them. You can use the mount command with
appropriate mount points to mount any partition:

# mount <device> <mount point>

mount /dev/sda2 /mnt

I hope you remember that the /dev/sda2 partition was created to


be the root partition. The /mnt mount point in Linux is for mounting
a storage device temporarily. As we only need to mount the
partition for installing Arch Linux on it, the /mnt mount point is
perfect.

In the case of a swap partition, you won't mount it like the other
ones. You'll have to tell Linux to use this partition as swap explicitly.
To do so, execute the following command:

swapon /dev/sda3

32 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn
As you may have to codethe
guessed, — free 3,000-hour
swapon curriculum
command tells the system to
swap on this device. We'll work with the EFI system partition in a
later section. For now, mounting these two partitions will suf�ce.

How To Configure the Mirrors


There is one last step before you can install Arch Linux on your
machine, and that is con�guring the mirrors. Mirrors are servers
located at different pointes around the world for serving the nearby
population.

The installer comes with Re�ector, a Python script written for


retrieving the latest mirror list the Arch Linux Mirror Status page. To
print out the latest mirror list, simply execute the following
command:

reflector

If you have a slow internet connection, you may encounter an error


message as follows:

failed to rate http(s) download (https://arch.jensgutermuth.de/community/os/x86_

This happens when the default timeout (5 seconds) is lower than the
actual time it's taking to download the information.

You can remedy to this problem by using the --download-timeout


33 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

You can remedy to this problem by using the --download-timeout


Forum Donate
option:
Learn to code — free 3,000-hour curriculum

reflector --download-timeout 60

Now re�ector will wait for a whole minute before starting to


scream. A long list of mirrors should show up on your screen:

Going through the entire list to �nd nearby mirrors would be a pain.
That's why re�ector can do that for you.

Re�ector can generate a list of mirrors based on a plethora of given


constraints. For example, I want a list of mirrors that were

34 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

synchronized within the last 12 hours and that are located


Forumeither inDonate
India or Singapore (these two are closest to my location), and sort
Learn to code — free 3,000-hour curriculum
the mirrors by download speed.

Turns out, re�ector can do that:

reflector --download-timeout 60 --country India,Singapore --age 12 --protocol ht

The found servers will be listed like before:

Printing out a mirror list like this is not enough. You'll have to persist
the list in the /etc/pacman.d/mirrorlist location. Pacman, the
default package manager for Arch Linux, uses this �le to learn about

35 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

the mirrors. Forum Donate

Before overwriting
Learn the default
to code mirror
— free list, make
3,000-hour a copy of it:
curriculum

cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak

Now execute the re�ector command with the --save option as


follows:

reflector --download-timeout 60 --country India,Singapore --age 12 --protocol ht

This command will generate the mirror list and overwrite the
default one. Now you're ready to install the base Arch Linux system.

How To Install Arch Linux Base System


Before installing the base system, it's a good idea to update the
package cache according to the new mirror list. To do so, execute the
following command:

pacman -Sy

The pacman program to Arch Linux is what apt is to Ubuntu or dnf


is to Fedora. The -S option means sync which is equivalent to
install in apt or dnf package managers.

Once the update process is �nished, you can use the pacstrap

36 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Once the update process is �nished, you can use the pacstrap
Forum Donate
script to install the Arch Linux system. Execute the following
command to start
Learnthe
to installation process: curriculum
code — free 3,000-hour

pacstrap /mnt base base-devel linux linux-firmware sudo nano ntfs-3g networkmana

The pacstrap script can install packages to a speci�ed new root


directory. As you may remember, the root partition was mounted on
the /mnt mount point, so that's what you'll use with this script.
Then you'll pass the package names you want to install:

• base – Minimal package set to de�ne a basic Arch Linux


installation.

• base-devel – Group of packages required for building


software from source.

• linux – The kernel itself.

• linux-firmware – Drivers for common hardware.

• sudo – You want to run commands as root right?

• nano – A pico editor clone with some enhancements.

• ntfs-3g – NTFS �lesystem driver and utilities required for


working with NTFS drives.

• networkmanager – Provides detection and con�guration for


systems to automatically connect to networks.

I would like to clarify that this list of seven packages is not


something mandatory. To have a functional Arch Linux installation,
you just need the base , linux , and linux-firmware packages. But

37 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

considering you'll need the other ones anyway, why not catch 'em all
Forum Donate
in one go.
Learn to code — free 3,000-hour curriculum
Depending on your internet connection, the installation process
may take a while. Sit back and relax until pacstrap does its thing.
Once it's done, you'll see something as follows:

Congratulations, you've successfully installed Arch Linux on your


computer. All that is left to do now is con�guring the system.

How To Configure Arch Linux


Installing Arch Linux wasn't that hard right? In fact in my opinion,
installing it is way more straightforward than con�guring it. There is
a lot to do here. So let's get started.

38 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
How To Generate the Fstab File
Learn to code — free 3,000-hour curriculum
According to the ArchWiki,

The fstab �le can be used to de�ne how disk partitions,


various other block devices, or remote �le systems should be
mounted into the �le system.

In other distributions like Ubuntu or Fedora this gets generated


automatically during the installation. On Arch however, you'll have
to do it manually. To do so, execute the following command:

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

The genfstab program can detect all the current mounts below a
given mount point and print them in fstab-compatible format to
standard output. So genfstab -U /mnt will output all current
mounts under the /mnt mount point. We can save that output to
the /mnt/etc/fstab �le using the >> operator.

How To Login to The Newly Installed


System Using Arch-Chroot
Right now you're logged into the live environment and and not into
your newly installed system.

To continue con�guring your newly installed system, you'll have to


�rst log into it. To do so, execute the following command:

39 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

arch-chroot /mnt Forum Donate

Learn to code — free 3,000-hour curriculum

The arch-chroot bash script is part of the arch-install-scripts


package and lets you change to the newly installed system's root
user without any reboot. How cool is that!

How To Configure the Time Zone


Once you've switched root, the �rst thing to con�gure is the time
zone. To see a list of all the available zones, execute the following
command:

ls /usr/share/zoneinfo

All the major zones should be in the directory.

40 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

I live in Dhaka, Bangladesh which resides inside the Asia zone. If I list
out the content of Asia, I should see Dhaka there:

To set Asia/Dhaka as my default time zone, I'll have to make a


symbolic link of the �le at the /etc/localtime location:

ln -sf /usr/share/zoneinfo/Asia/Dhaka /etc/localtime

The ln command is used for creating symbolic links. The -sf

41 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

options indicate soft and force, respectively. Forum Donate

Learn to code — free 3,000-hour curriculum


How To Configure the Localization
Now you'll have to con�gure your languages. Arch Linux has an easy
way to set that up as well.

First, you'll have to edit the etc/locale.gen �le according to your


localization. Open the �le in the nano text editor:

nano /etc/locale.gen

You'll see a long list of languages:

42 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum
You'll have to uncomment the languages that you want to enable. I Donate
usually only need English
Learn and
to code Bengali.
— free So I'll locate
3,000-hour the en_US.UTF-8
curriculum
UTF-8 , bn_BD UTF-8 , and bn_IN UTF-8 languages. Save the �le by
pressing Ctrl + O and exit nano by pressing the Ctrl + X key
combination.

Now you'll have to execute the following command:

locale-gen

The locale-gen command will read your /etc/locale.gen �le and


generate the locales accordingly.

43 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum
Now that you've enabled multiple languages, you'll have Donate
to tell Arch
Linux which one to use
Learn by default.
to code To do so, open
— free 3,000-hour the
curriculum
/etc/locale.conf �le and add the following line to it:

LANG=en_US.UTF-8

That's all you gotta do to con�gure your locale. You can always go
back to the /etc/locale.gen �le and add or remove languages from
it. Just remember to run locale-gen whenever you do that.

Apart from the locales, if you've made any changes to your console
keymaps in the �rst step of installation, you may want to persist
them now. To do so, open the /etc/vconsole.conf �le and add your
preferred keymaps there.

For example, if you changed the default keymaps to mac-us in the


�rst step, then you may want to add the following line to the
vconsole.conf �le:

KEYMAP=mac-us

Now every time you use the virtual console, it'll have the correct
keymap and you will not have to con�gure it every time.

How To Configure the Network


Con�guring a network manually in any Linux distribution can be

44 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

tricky. That's why I advised you to install the networkmanager


Forum Donate
package during the system installation. If you did as I said, you're
Learn to code — free 3,000-hour curriculum
good to go. Otherwise, use pacman to install the package now:

pacman -S networkmanager

Pacman is a package manager. You'll learn more about it later. Let's


set the host name for your computer now. A host name is a unique
name created to identify a machine on a network, written in the
/etc/hostname �le.

Open the �le with nano and write your host name in it. You can use
anything to identify your machine. I usually use my device brand or
model as my hostname and as I'm on a legion laptop, I'll simply write
the following:

legion

Local host name resolution is provided by nss-myhostname (an NSS


module provided by systemd) without having to edit /etc/hosts
�le. It is enabled by default.

But some software may still read the /etc/hosts �le directly. Open
the �le in nano and add the following lines to it:

127.0.0.1 localhost
::1 localhost

45 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

127.0.1.1 legion
Forum Donate

Learn to code — free 3,000-hour curriculum


Make sure to replace legion with your host name. Now you may
install the aforementioned package:

pacman -S networkmanager

Enable the NetworkManager service by executing the following


command:

systemctl enable NetworkManager

Make sure to write NetworkManager and not networkmanager as the


service name. If the command succeeds, network manager will start
automatically on boot from now on and do its thing.

How To Set the Root Password


You may want to set a password for the root user because why not?
To do so, execute the following command:

passwd

The passwd command lets you change the password for a user. By
default it affects the current user's password which is the root

46 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

right now. Forum Donate


It'll ask for a new password and con�rmation password. Input them
Learn to code — free 3,000-hour curriculum
carefully and make sure you don't forget the password.

How To Create a Non-root User


Using your Linux system as the root user for long is not a good idea.
So creating a non-root user is important. To create a new user,
execute the following command:

useradd -m -G wheel farhan

The useradd command lets you create a new user. Make sure to
replace my name with the one you want to use. The -m option
indicates that you also want it to create the corresponding home
directory. The -G option will add the new user to the wheel group
which is the administration user group in Arch Linux.

Now you can use the passwd command once again to set the
password for the newly created user:

passwd farhan

The program will prompt you for a new password and a password
con�rmation. Again, don't forget to replace my name with the one
you've used.

Finally, you'll have to enable sudo privilege for this new user. To do

47 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

so, open the /etc/sudoers �le using nano. Once open,Forum


locate the Donate
following line and uncomment it:
Learn to code — free 3,000-hour curriculum

# %wheel ALL=(ALL) ALL

This �le essentially means that all users in the wheel group can use
sudo by providing their password. Save the �le by hitting Ctrl + O
and exit nano by hitting Ctrl + X. Now the new user will be able to
use sudo when necessary.

How To Install Microcode


According to PCMag,

A set of elementary instructions in a complex instruction set


computer (CISC). The microcode resides in a separate high-
speed memory and functions as a translation layer between
the machine instructions and the circuit level of the
computer. Microcode enables the computer designer to
create machine instructions without having to design
electronic circuits.

Processor manufacturers such as Intel and AMD often release


stability and security updates to the processor. These updates are
crucial for the system's stability.

In Arch Linux, microcode updates are available through of�cial


packages that every user should install on their systems.

48 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

# for amd processors Forum Donate


pacman -S amd-ucode
Learn to code — free 3,000-hour curriculum
# for intel processors
pacman -S intel-ucode

Just installing these packages is not enough though. You'll have to


make sure that your bootloader is loading them. You'll learn about it
in the next section.

How To Install and Configure a Boot Loader


According to Wikipedia,

A bootloader, also spelled as boot loader or called boot


manager and bootstrap loader, is a computer program that is
responsible for booting a computer.

The internals of bootloader is out of scope of this article so I'll just


go on with the installation process. If you've used any other Linux
distribution in the past you may have encountered the GRUB menu.

GRUB is one of the most popular bootloaders out there. Although


there are a number of options available, I'll demonstrate the
installation of GRUB because it is what most people will likely use.

To install GRUB, you'll have to �rst install two packages.

pacman -S grub efibootmgr

If you're installing alongside other operating systems, you'll also


49 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

If you're installing alongside other operating systems, you'll also


need the os-prober package: Forum Donate

Learn to code — free 3,000-hour curriculum

pacman -S os-prober

This program will search for already installed operating systems on


your system and will make them a part of the GRUB con�guration
�le.

Now, you'll have to mount the EFI system partition you created a
few sections ago. To do so, you'll have to �rst create an efi
directory:

mkdir /boot/efi

According to Wikipedia,

In Linux, and other Unix-like operating systems, the /boot/


directory holds �les used in booting the operating system.

This directory is present in all Unix-like operating systems. The


above mentioned command creates a directory called efi inside
the /boot directory. After creating the directory, you'll have to
mount your EFI system partition in that directory.

mount /dev/sda1 /boot/efi

50 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum
I hope you remember that we formatted the /dev/sda1 device as Donate
the EFI systemLearn
partition during
to code the
— free partitioning
3,000-hour phase. Make sure to
curriculum
use the correct one for your device.

Now, we'll use the grub-install command to install GRUB in the


newly mounted EFI system partition:

grub-install --target=x86_64-efi --bootloader-id=grub

You can more or less use this command verbatim. You can change
the --bootloader-id to something more expressive like arch or
something else. If the installation �nishes without any errors, you'll
then have to generate the GRUB con�guration �le.

51 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
If you're installing
Learnalongside
to code —other operatingcurriculum
free 3,000-hour systems, you'll have to
enable os-prober before generating the con�guration �le. To do so,
open the /etc/default/grub �le in nano text editor. Locate the
following line and uncomment it:

#GRUB_DISABLE_OS_PROBER=false

This should be the last line in the aforementioned �le so just scroll to
the bottom and uncomment it.

Now execute the following command to generate the con�guration

52 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

�le: Forum Donate

Learn to code — free 3,000-hour curriculum


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

The grub-mkconfig command generates the GRUB con�guration


�le and saves it to a given target location. In this case /boot/grub
/grub.cfg is the target location.

The command will also take into account the microcode you
installed earlier and any other existing operating system on your
machine.

Congratulations, you now have a working Arch Linux installation. At

53 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

this point, you can exit the Arch-Chroot environment,Forum


unmount theDonate
partition, and reboot. But I would suggest you to stay a bit longer
Learn to code — free 3,000-hour curriculum
and set-up the graphical user interface as well.

How To Install Xorg


To run programs with graphical user interfaces on your system,
you'll have to install an X Window System implementation. The most
common one is Xorg.

To install Xorg, execute the following command:

pacman -S xorg-server

Wait until the installation is done and then move on to installing the
necessary graphics drivers.

How To Install Graphics Drivers


Installing graphics drivers on Arch Linux is very straightforward. You
just install the packages required by your graphics processing unit
and call it a day.

# for nvidia graphics processing unit


pacman -S nvidia nvidia-utils

# for amd discreet and integrated graphics processing unit


pacman -S xf86-video-amdgpu

# for intel integrated graphics processing unit


pacman -S xf86-video-intel

54 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum


If you need further assistance, feel free to check the ArchWiki page.

How To Install a Desktop


Environment
Now that you've installed Xorg and the necessary graphics drivers,
you're ready to install a desktop environment like GNOME, Plasma,
or XFCE.

Arch Linux supports a long list of desktop environments but I've


only tried out GNOME and Plasma. I'll demonstrate how you can
install either of these two.

How To Install GNOME


To install GNOME, you'll have to install the gnome package. To do so,
execute the following command:

pacman -S gnome

During the installation, you'll be offered multiple choices for


pipwire-session-manager and emoji-font packages. Accept the
defaults by hitting Enter in both prompts. The installation may take
some time to �nish.

The gnome package comes with GDM or Gnome Display Manager.


You can enable the service by executing the following command:

55 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
systemctl enable gdmcode — free 3,000-hour curriculum
Learn to

That's all you need to do to get GNOME up and running on your


Arch system.

How To Install Plasma


The KDE Plasma installation is not that different from GNOME.
You'll need to install Plasma related packages instead of GNOME.

pacman -S plasma plasma-wayland-session

If you have an NVIDIA graphics card, then avoid installing the


plasma-wayland-session and use plain old X11. I own two devices
with NVIDIA GPUs and both of them have shown instability when
using Wayland.

During the installation, you'll get multiple choices for ttf-font ,


pipwire-session-manager , and phonon-qt5-backend packages.
Make sure to pick noto-fonts as your ttf-font and accept the
defaults for the other two.

Like gdm in GNOME, Plasma comes with sddm as the default


display manager. Execute the following command to enable the
service:

systemctl enable sddm

56 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

systemctl
Forum Donate

Learn to code — free 3,000-hour curriculum


And that's all you need to do to get Plasma up and running on your
Arch Linux system.

How To Finalize The Installation


Now that you've installed Arch Linux and gone through all necessary
con�guration steps, you can reboot to your newly installed system.
To do so, �rst come out of the Arch-Chroot environment:

exit

Next, unmount the root partition to make sure there are no pending
operations:

umount -R /mnt

Now reboot the machine:

reboot

Wait until you see the GRUB menu.

57 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Choose Arch Linux from the list and wait until the system �nishes
booting up.

58 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Log in with your user credentials and voilà!

Your shiny new Arch Linux system is ready to do wonders.

How To Switch Between Desktop


Environments
Unlike other distributions coupled tightly with their default desktop
environment, Arch is �exible. You can switch to another desktop
environment whenever you feel like it.

59 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

To do so, �rst logout of your current session. Forum Donate

Learn to code — free 3,000-hour curriculum

As you can see, I'm currently using Plasma. Now switch to TTY2
press Ctrl + Alt + F2 key combination. You'll see a console login
prompt:

60 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Login with the root credentials and disable the sddm display
manager.

systemctl disable sddm

Then uninstall the Plasma related packages you installed earlier:

sudo pacman -Rns plasma plasma-wayland-session

Once the packages have been uninstalled, install the packages


needed for GNOME:

pacman -S gnome

Then perform the installation according to the section you read


earlier. After the gnome package has been installed, enable the gdm
display manager:

61 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
systemctl enable gdm
Learn to code — free 3,000-hour curriculum

Restart the computer.

reboot

Wait until the Arch Linux system �nishes booting.

Lo and behold, the gorgeous Gnome Display Manager. Login with


your credentials.

62 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

You can switch between the desktop environments as much as you


want to, but I would suggest on settling down with one of them.
Also, I wouldn't recommend having multiples of them installed at the
same time.

How To Manage Packages Using


Pacman
You've already installed a number of packages using pacman. It's
equivalent to package managers like apt in Ubuntu and dnf in
Fedora.

In this section, I'll introduce you to some of the common pacman


commands that you may need on a daily basis.

63 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
How To Install Packages Using Pacman
Learn to code — free 3,000-hour curriculum
To install a package using pacman, you can use the following
command syntax:

# sudo pacman -S <package name>

sudo pacman -S rust

You can install multiple packages as follows:

# sudo pacman -S <package name> <package name>

sudo pacman -S rust golang

You can also specify the repository you want to install the package
from like this:

# sudo pacman -S <package repository>/<package name>

sudo pacman -S extra/rust

In this command, the -S option means synchronize which is


equivalent to install in the case of apt or dnf package managers.

How To Remove Packages Using Pacman


To remove a package using pacman you can use the following

64 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

To remove a package using pacman you can use the following


syntax: Forum Donate

Learn to code — free 3,000-hour curriculum

# sudo pacman -R <package name>

sudo pacman -R rust

This will remove the package but will leave the dependencies. You
can remove the package with dependencies if they're not required
by any other package by executing the following command:

# sudo pacman -Rs <package name>

sudo pacman -Rs rust

Pacman often saves important con�guration �les when removing


certain applications. You can override this behavior by using the
following syntax:

# sudo pacman -Rn <package name>

sudo pacman -Rn rust

I usually use sudo pacman -Rns whenever I want to uninstall


something. One last thing that I want to show is how to remove
orphan packages.

In Ubuntu the sudo apt autoremove command uninstalls any

65 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

unnecessary package. The equivalent command in Arch is:


Forum Donate

Learn to code — free 3,000-hour curriculum

sudo pacman -Qdtq | pacman -Rs -

This will cleanup any leftover package from previously installed


packages.

How To Upgrade Packages Using Pacman


To upgrade all the packages in your system, you can use the
following syntax:

sudo pacman -Syu

In this command, the S option synchronizes the packages, y


refreshes the local package cache, and u updates the system. This is
like the ultimate upgrade command and I run it at least once
everyday.

How To Search for Packages Using Pacman


To search for a package in the database, you can use the following
syntax:

# sudo pacman -Ss <package name>

sudo pacman -Ss rust

66 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
This will print out all the packages found in the database with that
Learn to code — free 3,000-hour curriculum
search term and will also indicate if any of those are already
installed.

If you would like to check if a package is already installed or not, you


can use the following command:

# sudo pacman -Qs <package name>

sudo pacman -Qs rust

This is useful when you want to uninstall a package but do not know
its exact name.

How To Use AUR in Arch Linux


According to It's FOSS,

AUR stands for Arch User Repository. It is a community-


driven repository for Arch-based Linux distributions users. It
contains package descriptions named PKGBUILDs that allow
you to compile a package from source with makepkg and
then install it via pacman (package manager in Arch Linux).

AUR is one of the most attractive features of Arch Linux. It's due to
AUR that Arch Linux has a package count almost equal to Debian.
You've already used pacman to install various packages. Sadly, you
can not use that to install packages from AUR.

67 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

You'll have to install one of the AUR helpers instead. Arch Linux
Forum Donate
doesn't support any of these helpers and advises you to learn how to
Learn to code — free 3,000-hour curriculum
build packages manually. I'll explain both techniques here. If you
understand how a helper works, you'll be able to do it manually as
well.

How To Install Packages Using a Helper


Among the available and currently maintained AUR helpers, I like
the yay or yet another yogurt package. It's written in Go and is
quite solid.

You can not install yay like other packages. You'll have to get the
source code and compile the program. You'll need git and the
base-devel package to do so. Assuming you've already installed
base-devel during Arch Linux installation:

pacman -S git

Clone the yay repository from GitHub and cd into it:

git clone https://aur.archlinux.org/yay.git && cd yay

To build and install yay from source, execute the following


command:

makepkg -si

68 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum


The makepkg script automates the build process of packages. The
-si options stand for sync dependencies and install. The �rst
option will install required dependencies (Golang in this case) and
the later option will install the built package.

After the build process �nishes, makepkg will ask for installation
con�rmation and your password. Input your password carefully and
let the installation �nish.

Check if yay has been installed properly or not:

yay --version

# yay v11.1.0 - libalpm v13.0.1

Now let's install something using yay. One of the common packages
you may want to install is the visual-studio-code-bin package. To do
so, execute the following command:

yay -S visual-studio-code-bin

Unlike pacman, you shouldn't run yay with sudo. Yay will look for the
given package and will ask whether you would like to see the diff or
not:

69 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

All the repositories over at AUR comes with a PKGBUILD �le which
contains the instructions for building this package. Yay has this nice
feature where it shows you what has changed in the PKGBUILD �le
since the last time.

For now, I'll pick N for none and hit enter. Yay will now look for the
dependencies and ask for your password to install them.

70 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Con�rm the installation and provide your password. Yay will then
install the dependencies and start building the package. Once built,
yay will install the package and prompt for your password where
necessary.

After the installation �nishes, search for Visual Studio Code in the
application launcher:

71 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
Congratulations on installing your �rst package from AUR. Yay
Learn to code — free 3,000-hour curriculum
commands are almost identical to pacman, so if you can do
something with pacman, you should be able to do that with yay as
well.

In fact, yay can also install packages from of�cial Arch Linux
repositories like pacman. But I would suggest you to use yay only for
installing packages from AUR when necessary and pacman for
everything else.

How To Install Packages Manually


Like I said in the previous section, the ArchWiki suggests avoiding
any AUR helper and installing packages from AUR manually. I'll now
show you how to do it.

Make sure you have git and base-devel packages installed. If not,
use pacman to install them.

For the demonstration, let's install Spotify this time. First visit the
AUR page for the spotify package - https://aur.archlinux.org
/packages/spotify/ and copy the "Git Clone URL" from there.

72 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

The page even lists all the dependencies you'll need. Clone the
repository to your machine:

Every AUR repository comes with a PKGBUILD �le containing the


instructions for building the package. Whenever you're installing a
package from AUR, it's a great idea to checkout the PKGBUILD �le
using something like the cat command:

73 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

Make sure there's nothing harmful in the �le. Once you're satis�ed,
use makepkg to install any dependencies, build the package, and
install it. Ideally there shouldn't be any issues but sometimes, things
can take an unexpected turn.

74 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

In these cases, go back to the corresponding AUR page and check


the user comments. Like in this case, I found the following pinned
comment:

Turns out the package requires you to add the Spotify for Linux gpg
key to the user kyechain. This command downloads the gpg key
using curl and pipes it as the input of the gpg --import command:

75 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum


Try executing makepkg -si once again and everything should work
�ne this time:

See, told ya! Manually installing packages often involves such


troubleshooting but help is almost always around the comment
corner. Let's enjoy some music now.

How To Troubleshoot Common


Problems
Look, I've been using Arch as my primary on all my devices for some

76 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

years now but I still run into issues. Fortunately thereForum


are some Donate
great places to look for help when you're stuck:
Learn to code — free 3,000-hour curriculum
• ArchWiki

• Arch Linux Forum

• r/archlinux

For the most part, the wiki should have the information you're
looking for. In fact, if you're on a laptop and having dif�culty getting
something to work, there is an entire wiki category dedicated to
different laptops. So look around the wiki.

If the wiki fails to solve your problem, then ask other fellow users at
the forum as well as the subreddit. But whenever you're doing that,
make sure to do your research �rst and include as much description
as you can in the post. It's really annoying if other users have to keep
asking you for more information and it'll also lower the chance that
you'll get an answer.

How To Use the Live Arch ISO as a


Rescue Media
Whatever people may say, Arch Linux is very stable as long as you
know what you're doing. If you go about installing every funky
package you come across in the AUR or keep switching different
kernels without knowing what they're for, your system may fail to
boot.

In those cases, you can use your live USB drive as a rescue media. To
do so, reconnect the bootable USB to your computer and boot into
the live environment. Once there, con�gure the time, keymaps, and

77 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

fonts if you want to. Forum Donate

Learn
Then use fdisk to code
to list — free
out all your3,000-hour
partitionscurriculum
and locate the one
holding your Arch Linux installation. In my case it's the /dev/sda2
partition. Mount the partition like you did before:

mount /dev/sda2 /mnt

Now use Arch-Chroot to log in as the root user.

arch-chroot /mnt

Now uninstall the bad package you installed or go back to a kernel


version that used to work in the past and so on. Once done, exit the
Arch-Chroot environment, unmount the partition, and reboot:

exit
umount -R /mnt
reboot

If the computer boots �ne then congratulations. Otherwise try the


wiki, forum, or the subreddit. If nothing works, you may have to do a
fresh install.

Further Reading
If you've come this far then you've done a lot of reading already –
78 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

If you've come this far then you've done a lot of reading already –
Forum Donate
but that's not all. This entire handbook was written by combining
Learn
information from thetowiki,
codeforum,
— free 3,000-hour curriculum
and subreddit. I'm listing out some
wiki pages that I think you should read.

• Installation guide

• Network con�guration

• General recommendation

• Desktop environment

• pacman

• Arch Build System

• makepkg

• List of applications

Couldn't think of any more at the moment but I'll keep this list
updated.

Conclusion
I would like to thank you from the bottom of my heart for the time
you've spent on reading this article. I hope you've enjoyed your time
and have learned a lot about not only Arch but Linux in general

Apart from this one, I've written full-length handbooks on other


complicated topics available for free on freeCodeCamp.

These handbooks are part of my mission to simplify hard to


understand technologies for everyone. Each of these handbooks
takes a lot of time and effort to write.

79 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate
If you've enjoyed my writing and want to keep me motivated,
consider leaving starts
Learn on GitHub
to code and endorse
— free 3,000-hour me for relevant skills
curriculum
on LinkedIn.

I'm always open to suggestions and discussions on Twitter or


LinkedIn. Hit me with direct messages.

In the end, consider sharing the resources with others, because

In open source, we feel strongly that to really do something


well, you have to get a lot of people involved. — Linus
Torvalds

Till the next one, stay safe and keep learning.

Farhan Hasin Chowdhury


Software developer with a knack for learning new things and writing about
them

If you read this far, tweet to the author to show them you care.
Tweet a thanks

Learn to code for free. freeCodeCamp's open source curriculum has


helped more than 40,000 people get jobs as developers.
Get started

ADVERTISEMENT

80 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

Forum Donate

Learn to code — free 3,000-hour curriculum

freeCodeCamp is a donor-supported tax-exempt 501(c)(3) charity organization (United States


Federal Tax Identi�cation Number: 82-0779546)

Our mission: to help people learn to code for free. We accomplish this by creating thousands of
videos, articles, and interactive coding lessons - all freely available to the public. We also have
thousands of freeCodeCamp study groups around the world.

Donations to freeCodeCamp go toward our education initiatives, and help pay for servers,
services, and staff.

You can make a tax-deductible donation here.

Trending Guides

Hello World in Java Python Set

What is a 429 Error? What is REST?

Inline Style in HTML What is CRUD?

Python Absolute Value %.2f in Python

Java Switch Statement Git Reset Origin

Change Font with HTML What is Localhost?

502 Bad Gateway Error JS Array.includes()

Static Keyword in Java Compare Dates in JS

81 of 82 3/12/23, 15:04
The Arch Linux Handbook – Learn Arch Linux for Beginners https://www.freecodecamp.org/news/how-to-install-arch-linux/

String to Number in JS Python Split String Forum Donate

Python Global Variable Learn to code — free 3,000-hour


Python enumerate()
curriculum
Create a Set in Python What’s a Data Analyst Do?

Remove a Dir in Linux Refresh Page in JavaScript

What is Coding Used For? Remove Underline from Link

JavaScript String Format How to Clear an Array in JS

JavaScript String to Date Capitalize 1st Letter in JS

Our Charity

About Alumni Network Open Source Shop Support Sponsors Academic Honesty

Code of Conduct Privacy Policy Terms of Service Copyright Policy

82 of 82 3/12/23, 15:04

You might also like