Step-by-Step Guide to Installing Arch Linux
Tags: tutorial, archlinux, linux
Published: 2022-11-10 13:12:44

## 💾 Iso Prep

Download the iso via the website and check the gpg signature

mount the iso in a usb via something like balena etcher

## 🚀 Launch Install

make sure the bios have the secure boot disable and boot on the iso

## 🎹 Set Up the Keyboard Layout

By default the layout is set to US.

If you want to list all the layouts available do `ls /usr/share/kbd/keymaps/**/*.map.gz`.

Use a layout with, for example, `loadkeys de-latin1` (here German layout).

## 🛰️ Go to the Internet

> Wifi dosent work out of the box but ethernet yes

Check your network interface name via `ip link`.

Check the status of your wifi card with `rfkill`. If your card is blocked, unblocked them with `rfkill unblock your-card-id`.

For the wifi connection you have to use the iwd package. Hopefully arch include the package in the iso.

Open the prompt with `iwctl` and :

- list all your device with `device list`
- launch a scan `station [device name] scan`
- get the list of the available network `station [device name] get-network`
- connect to the network with `station [device name] connect [SSID]`
- enter the password
- check the connection with `station [device name] show` and `ping archlinux.org`

done :)

`iwd` automatically stores network passphrases in the `/var/lib/iwd` directory and uses them to auto-connect in the future.

## 🕛 Update System Clock

Just do `timedatectl set-ntp true`. Check the service status with `timedatectl status`.

## 💽 Disk Partitioning

> warning : this step erase all the data in your disk if you confirm the operation !

List your drive with `fdisk -l` and note the one you want to use.

Open the prompt on the right disk with `fdisk /dev/[your disk]`.

> remind to delete the old partition before the following command. Do that with command `d` and the id of the partition.

Let's create the partition, in the open fdisk prompt :

Here we create a gpt partition because I do a EFI install

- create a new gpt label with `g`
- add the first partition with `n` (efi)
  - partition number is `1`
  - the first sector is the default one (just hit enter)
  - the last sector is `+550M` for 550mb
- add the second partition with `n` (swap)
  - partition number is `2`
  - the first sector is the default one
  - the last sector is `+4G` (handle the size of your swap like you want, minimum 2gb is ok)
- add the last partition with `n` (primary/data)
  - partition number is `3`
  - the first sector is the default one
  - the last sector is the default one

Ok now we need to change the partition type with the `t` command :
- chose for partition 1 the `1` type (list all the partition type with `L` if your are not sure)
- chose for partition 2 the `19` type
- don't change the partition 3

Just enter `w` to write the partition table.

## 🗃️ Make the File System

For the efi partition, we need to have a FAT32 file system, do it with 

```
mkfs.fat -F32 /dev/[your partition 1]
```

For the swap we need a swap filesystem, do it with

```
mkswap /dev/[your partition 2]
```

and activate the swap with 

```
swapon /dev/[your partition 2]
```

For the main partition we do a ext4 filesytem :

```
mkfs.ext4 /dev/[your partition 3]
```

## ⚡ Mount the Big Partition in the Live Environment

Simply do `mount /dev/[your partition 3] /mnt`

## 🧬 Install the Base System

We do it via `pacstrap /mnt base linux linux-firmware`. Here base is the arch system, linux the kernel.

## 🧫 Generate the fstab

Simply do `genfstab -U /mnt >> /mnt/etc/fstab`.

## 🔑 Log to the Newly Installed Arch

Do `arch-chroot /mnt`.

## 🌍 Set the Timezone

> here the region and city is in the `/usr/share/zoneinfo` file

do `ln -sf /usr/share/zoneinfo/_Region_/_City_ /etc/localtime`

and generate /etc/adjtime with `hwclock --systohc`

## 🏴‍☠️ Set the Locale

> you need to install nano if you want to use it

Edit the locale.gen file `nano /etc/locale.gen`, and uncomment the good option for you.

For example `en_US.UTF-8 UTF-8` for the generic qwerty.

And generate the local with `locale-gen`.

Add the following line to /etc/locale.conf : `LANG=en_US.UTF-8`.

## 👽 Set the Hostname and the Host

Just add the wanted hostname in `/etc/hostname`.

For the host open /etc/hosts and add the following line :

```
127.0.0.1 localhost
::1       localhost
127.0.1.1 [your-hostname].localdomain [your-hostname]
```

## 🤓 Create the User

- set the password the root password with `passwd`
- create a user with `useradd -m username`
- set the password of the new user `passwd username`
- set the group for the user `usermod -aG wheel,audio,video,optical,storage username`

## 🎛 Install Sudo and Authorize the User to Use Wheel Group

install with `pacman -S sudo` and open visudo with `EDITOR=nano visudo` and uncomment the `%whell ALL=(ALL) ALL` line.

Here we use nano but if you want to use vi remove `EDITOR=nano`, if you don’t want nano nor vi replace nano with your loved one

## 📟 Install Grub and Basic Package

just do `pacman -S grub efibootmgr dosfstools os-prober mtools`

## 🎬 Make the EFI Directory and Mount It

Do `mkdir /boot/EFI` and `mount /dev/[your efi partition] /boot/EFI`

## 🪃 Init grub

install grub (for efi) with

```
grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
```

create the config `grub-mkconfig -o /boot/grub/grub.cfg`

## 📦 The Other Stuff (Networking, etc...)

Here we install the networkmanager package, because after the final reboot the iwd package will no longer be available.

We install git too.

```
pacman -S networkmanager git
```

Enable network manager with `systemctl enable NetworkManager`.

## ♻️ Reboot

Before reboot exit and unmount :

```
exit
umount -R /mnt
```

And reboot !

## 📡 Reconnect WiFi after the Login

If the ping command failed after the installation you need to relogin to your wifi.

For that we use the previously installed `nmcli` package.

Check if the radio is on with `nmcli radio wifi`, if not open up with `nmcli radio wifi on`.

Check the wifi point with `nmcli dev wifi list`.

Check your device with `nmcli dev status`.

And connect with `sudo nmcli dev wifi connect [network-ssid] password [network-password]`.

If you want to look all the saved connection do `nmcli con show`.

## 📽️ Video Driver

For nvidia do `pacman -S nvidia nvidia-settings nvidia-utils`

For other check the wiki

## 🎞️ Xorg Server

> Actually we use xorg but if you want another display server check the wiki

Install with `xorg-server`.

If needed install `xorg-apps` check the wiki to know if you need it.

It usefull to install xmessage too `pacman -S xorg-xmessage`.

```
pacman -S xorg-xmessage xorg-server
```

## 🧮 Base Devel for Makepkg

Mandatory for the use of the AUR package via `paru`

Just do a `pacman -S --needed base-devel`

## 🍱 The Essential Package

List of, my, essential package to have on a fresh install :

- unzip `pacman -S unzip`
- nerd font **Warning: This is a large size repo**
  - clone the repo [https://github.com/ryanoasis/nerd-fonts.git](https://github.com/ryanoasis/nerd-fonts.git)
  - run ./install.sh for installing all the font
- bluetooth `pacman -S bluez-utils`
- paru (for easy gestion of the aur package)
  - clone [https://aur.archlinux.org/paru.git](https://aur.archlinux.org/paru.git)
  - cd into the repo
  - build it `makepkg -si`

## 🔏 Activate the Num Lock

> This method is good because is activate the numlock in the early bootup stage, usefull for the psw prompt in the full-disk encryption for example.

Install the `mkinitcpio-numlock` AUR package.

Add numlock in the HOOKS line (before encrypt if present) in `/etc/mkinitcpio.conf`.

_Usually between modconf and block_

## ⁉️ And Now What?

Now you have Arch and the minimum for booting correctly.

All you have to do is install the window manager or the desktop environment you want!

Check the wiki page for information.

For example, if you want KDE :

```
pacman -S plasma kde-applications
```

If you want some tutorial stuff for XMonad I'm writing a story in a few days, wait for the update!

Happy arching mate 🖖

---
[If you found this content useful, feel free to support me](https://www.buymeacoffee.com/a2nb)