DEV Community

Alan Bouteiller
Alan Bouteiller

Posted on • Edited on • Originally published at hackernoon.com

Step-by-Step Guide to Installing Arch Linux

๐Ÿ’พ 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]
Enter fullscreen mode Exit fullscreen mode

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

mkswap /dev/[your partition 2]
Enter fullscreen mode Exit fullscreen mode

and activate the swap with

swapon /dev/[your partition 2]
Enter fullscreen mode Exit fullscreen mode

For the main partition we do a ext4 filesytem :

mkfs.ext4 /dev/[your partition 3]
Enter fullscreen mode Exit fullscreen mode

โšก 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]
Enter fullscreen mode Exit fullscreen mode

๐Ÿค“ 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Enable network manager with systemctl enable NetworkManager.

โ™ป๏ธ Reboot

Before reboot exit and unmount :

exit
umount -R /mnt
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

๐Ÿงฎ 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 :

๐Ÿ” 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
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)