Beginners Guide For Arch Linux Installation

how to install arch linux

Arch Linux is an independent project behind a so-called GNU Linux distribution for the i686 (arch end support in November 2017) and X86-64 platforms. The first official version was released March 11, 2002, named Arch Linux 0.1. This distribution is presented as light and fast with as a great principle, the philosophy KISS (Keep It Simple, Stupid).

he packages are optimized for i686 processors and the new generation 64bits. Arch Linux uses its own package manager pacman which is unique, simple and efficient is one of its main assets.

On another side, it uses the Arch User Repository (AUR) which is a community repository to which all Arch users can participate to complement for example the Core and Extra repositories branches.

What you need to know about Arch Linux

Arch Linux is another Linux distribution like Centos, Ubuntu, Debian, Redhat etc. Unlike the others Linux OS that use discrete versions,

  • Arch Linux updates on a rolling release model which offers continuous, incremental upgrades to keep the system up-to-date.
  • Archlinux has a package manager named pacman, here everything is done on the command line. It combines a set of binary tools with a relatively simple system for building packages.
  • GUI configuration utilities are not officially provided on Arch Linux in order to encourage the users to perform most system configuration from the shell and a text editor.
  • Arch Linux does not automatically enable installed software/modules. You will be responsible for defining the modules and daemons you want to load at startup
  • This distro is completely customizable which allows you to install your desktop environments such as GNOME, KDE, LXDE and Xfce during the installation process.
This new version of Arch Linux 2018.01.01 aims to introduce the use of the Linux 4.14.9 kernel and add all published software updates and patches.

1) Download the Arch Linux ISO File

The Arch Linux 2018.01.01 is the actual latest released. Clearly, this version is at the moment, the most advanced iteration of the distribution. Iso file has a size of 522.0 MB and can be downloaded from the official page. You have some methods to download it: bittorent, netboot, http direct download.

2) Prepare the installation media

The ISO file of Arch Linux can be used to build an installation USB key or you can simply burn it to on a CD medium. So, write the image on flash media or optical disc, then boot from it. You must notice that the support for the 32-bit architecture (i686) is no longer present since the March 2017 ISO. You can make your USB Live bootable by using the command below:

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

You should replace the sdc by the value corresponding to your usb key and the Arch Linux path corresponding to yours.

3) The installation process

Now you can boot from your media drive in order to install Arch Linux. If you made your usb live bootable, make sure to boot from USB. You will see the page below

You can see that some options are available:

  • Boot Arch Linux (x86_64): you can choose this option if you want to have a fresh installation of Arch Linux or if you just want to use it for rescue
  • Boot existing OS: Supposing that you boot from the Arch Linux installation by mistake, instead of rebooting your machine, you can simply use this option to boot from your OS. If you have more than one OS installed, you can use the TAB key to choose the right OS by indicating the partition number to boot
  • Run Memtest86+ (RAM test): You can use it to test your memory such as the multithreading,
  • Hardware Information (HDT): This option gives you some information about your material such your memory size and bank, your processor (cpu core, cache, speed, etc), motherboard, etc.
  • Reboot and Power Off: as the name indicates, you can use these options to reboot of power off your machine.

In our case, we will choose the first option to install Arch Linux and we will only have the terminal as below

If you try to list the content of the current directory, you will a file which explain the procedure on the installation of arch. It's the official installation guide for Arch Linux. You see the content by using a text editor command

# vim install.txt

a) Verify the boot mode

Nowadays, it is possible to have the boot configured for the MBR or EFI mode. Some new machines support the EFI mode but you must check it before starting the installation steps. Normally you check it in the Bios but you can verify through the system the mode enabled. It is possible to do it via Arch Linux with the command

# ls /sys/firmware/efi/efivars

if you have don't have a result as in my case, it means that you don't have any existing EFI folder so you boot in MBR mode but if you have a result similar to the result below

# ls /sys/firmware/efi/efivars
AcpiGlobalVariable-c020489e-6db2-4ef2-9aa5-ca06fc11d36a IrsiInfo-5bce4c83-6a97-444b-63b4-672c014742ff
ActiveVgaDev-59d1c24f-50f1-401a-b101-f33e0daed443 KEK-8be4df61-93ca-11d2-aa0d-00e098032b8c
AdministerSecureBoot-59d1c24f-50f1-401a-b101-f33e0daed443 KEKDefault-8be4df61-93ca-11d2-aa0d-00e098032b8c

it means that you have the EFI mode

b) Configure the network

If you are connected through the network cable, you can test the connectivity by pinging a site as below:

A wired connection is definitely preferred as the bootable installation ISO is setup to automatically detect and connect to any wired network on bootup but if you have a wireless connection, the network configuration will require more steps. First, try to see the name of your wireless interface name as below

ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether a0:1d:48:6a:97:2a brd ff:ff:ff:ff:ff:ff
3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 9c:d2:1e:0e:5b:c4 brd ff:ff:ff:ff:ff:ff

My wireless device is wlo1. Now you can try to connect to your wireless network as below:

# wifi-menu -o wlo1

Then retry the ping connectivity

c) Configure the system time

Once connected to the internet, it is important to synchronize the system time. This can be done by turning on the Network Time Protocol (NTP). We will first check is the service is working and if not, we will activate it.

You can check the NTP service as below:

# timedatectl status

If the service is not working, you can set up it as below

# timedatectl set-ntp true

On the screenshot below, you will see that the system time is not synchronized but we will activate the synchronization

d) Prepare the disk

In order to install the system, you should check the disk present. So unplug all the others storage devices that you don't need from your system so you don’t end up formatting them by mistake. Plug only the one that you will format to install Arch Linux on it.

There are two kinds of partition tables: MBR and GPT. GPT is the modern partition table recommended to use because it is associated to the EFI mode and also because MBR has some limitation such as only working with disks up to 2 TB in size and only supporting up to four primary partitions. You need to have an MBR extended/logical partition to have more than four primary partitions. GPT doesn't have these limitations and offers a better data management. So, if you use the EFI boot mode and/or a disk size more than 2TB, use GPT although you can use MBR.

You can check the disk with the command below:

For the EFI mode, you can use the cgdisk command to manage the GPT disk as below

# cgdisk /dev/sda

Or you can use the cfdisk command iwhich is a graphical application designed to be more friendly to the novice. You can manage both MBR and GPT disk with this command more friendly as below:

# cfdisk /dev/sda

You will have the windows below to create a new partition

Notice that in my case I will create two (02) partitions: the root and home partitions. The swap can be important if you will use hibernation. With the new machine, you don't really need to create a swap partition because there is enough memory but, for those who need the swap, it is recommended to create a swap file after the installation and activate it instead of a swap partition.

For the EFI mode with GPT disk, it is recommended to create the bootable EFI partition with no more than 100 MB. For MBR disk, the root partition will be set as bootable.

You will use the MiB, GiB, TiB or S to indicate the size of your partitions. Reproduce the same procedure to create all your partitions. In our case the root partition is 7GiB and the home partition is 13GiB.

With the cgdisk command, when creating the new partition, you will be asked to enter the first sector value. The default value is 2048 but if you have SSD disks, you should use 4096 because SSD read chunks in 4M block, not in 2M block.

When you will finish creating the partitions with cfdisk command, you will the list of all your partitions. To make your root partition bootable, choose it, and select the bootable option where you will see the result as below

To save just go to the write option.

For those who use the GPT scheme and the swap partition, You must change the type of the EFI boot partition to efi and the type of the swap partition. You can use the corresponding table below to know the code of the partition type to use

You can check the partition as below

Now that our partitions have been created, we can format it as below:

# mkfs.ext4 /dev/sda1
# mkfs.ext4 /dev/sda2

To format the EFI boot partition, you should use the mkfs.fat -F32 command instead of mkfs.ext4

Now we should mount the partitions which have been created and formatted so that Arch Linux can point to them.  We will mount the root partition to the /mnt folder and the home partition to the /mnt/home folder which must be created. It means that for each partition created, you should create a corresponding /mnt sub-folder in order to mount it

We can check the result as below:

e) Select the mirror

During the installation, packages will be downloaded so we must configure the mirror to use for internet. We must choose the closest mirror for the repositories for the fastest download speed. The higher a mirror is placed on the list, the more priority it is given when downloading a package. You can edit the mirror list by editing the file /etc/pacman.d/mirrorlist to choose the mirror you want to use on the higher place depending on your location:

# vim /etc/pacman.d/mirrorlist

If you are using WiFi for connectivity, please also install these packages before you reboot the system otherwise you won’t be able to access wireless network:

# pacman -S iw wpa_supplicant dialog wpa-actiond

This will install the Wi-Fi menu, the software that allows you to automatically connect to known networks.

f) Install Arch Linux base system

Now that we have chosen our mirror, we can install the Arch Linux bases system with the command below:

# pacstrap /mnt base base-devel

g) Generate the fstab file

The fstab file is used to control what file systems are mounted automatically when the system boots so that the system will be able to boot into Arch Linux. We can first check it as below

# cat /mnt/etc/fstab

You can see that there is no entry in our file. We can generate this file with the command below:

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

h) Change the root system

We need to use the chroot command to access our newly-installed operating system.

# arch-chroot /mnt

i) Change the timezone

It is important to change the timezone to match it to your physical timezone. You can see the different timezones in the /usr/share/zoneinfo/. folder and select your appropriate timezone as below

In my case, my timezone will be as below:

# ln -sf /usr/share/zoneinfo/Africa/Douala /etc/localtime

Now it is important to set the hardware clock to UTC

# hwclock --systohc

j) Configure the system language

We can now select the default language of the system by editing the /etc/locale.gen file

# vi /etc/locale.gen

On the list of languages, uncomment the one that you need. We will uncomment en_US.UTF-8 UTF-8. Now we must generate the locale information with the command below

Now we must set the LANG variable in /etc/locale.conf

# echo LANG=en_US.UTF-8 > /etc/locale.conf

k) Configure the host

We must first configure our hostname

# echo archlinux > /etc/hostname

Now we need to configure the /etc/hosts file

# vi /etc/hosts

l) Create a new user and change root password

It is recommended to create a normal user account

# useradd -m -G wheel,users -s /bin/bash alain

Now we must change the password for the root user with the passwd command

We must edit the /etc/sudoers file with the visudo command to add the new user :

m) Configure network dynamically

If you want your OS be able to have automatically an IP address for your router or the dhcp server of your network, it is import to activate the dhcpd service at the system startup

# systemctl enable dhcpcd
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/dhcpcd.service.

This helps you to automatically receive an IP address when you will be connected to your network.

n) Install the bootloader

The grub and os-prober packages are important. Here grub is boot manager and os-prober detects if there are other operating systems installed on the system. We need to install it as below:

Now install the grub on the disk using the command below:

# grub-install --recheck --target=i386-pc /dev/sdX

If you don't specify the partition, it will search the bootable partition. Now we can generate the grub

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

o) Quit chroot, unmount the partition and reboot the system

Now we need to exit the chroot

# exit

unmount the root partition

# umount -R /mnt

Now remove the USB drive that you used to install Arch and reboot the system.

# reboot

Now we can log into the system with the new account

You see that we didn't use the root account but the new account. Now you have your Arch Linux system installed.

Wrapping up

You should notice that the base Arch Linux installation is about as basic as you can get. By default, there is no X Window System or graphical user interface. The installation process requires to have few bits of knowledge on Linux but it is not very hard to follow when you have the good installation guide. Once you install and configure a window manager or desktop environment Arch Linux can be as graphical as your heart desires. It is very customizable

6 Comments... add one

  1. Building Arch is not so much about building a Linux distro. Its just that it is a distro without a gui to install it, that forces the end user to build it from instructions in order to install and run it. Hard in simply a case of can you follow five page guide? If your patience runs thin just go with Ubuntu, Arch is mostly a useless project, want bleeding edge? Just compile the Kernel yourself for any Linux out there.


Leave a Comment