Skip to content

Instantly share code, notes, and snippets.

@emildimitrov
Created September 18, 2022 17:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emildimitrov/95530e774bb72f2bccf61e815d99ca9c to your computer and use it in GitHub Desktop.
Save emildimitrov/95530e774bb72f2bccf61e815d99ca9c to your computer and use it in GitHub Desktop.
Arch linux install guide

Arch linux install guide

Easy arch linux setup for folks who want to keep it simple.

Prerequisites

  • UEFI firmware laptop/PC. This guid does not cover BIOS specific installation.
  • Internet connection. If you use cable make sure its plugged.
  • Flash drive.

System overview

  • No encryption
  • No fancy filesystems
  • No wayland
  • No fancy window managers
  • GNOME desktop environment

Installation

Note that this is just walk torugh guide to do MY installation. If you are really into installing the arch way read

Overview

  • GPT partition UEFI mode installation
  • Full disk encryption
  • EFI boot using GRUB
  • LVM on LUKS partition scheme
  • Minimal system configuration including intel-ucode or amd-ucode update

Create bootable medium

There is lots of information how to create bootable arch linux flash over the internet, but I find the official wiki the most complete.

In the end you want to end up having latest verified ISO flashed and ready to boot.

Boot

  1. Inser the USB into your PC/laptop.
  2. Enter boot selection menu. You need to press key combination specific for your device. Refer to your device manual.
  3. Select the USB as a device you wish to boot from the menu.

Now you will be presented with the arch linux menu. Select boot arch linux option.

After couple of seconds you should already be logged into the shell.

Set keyboard layout

By default we have the US layout, so if its fine by you skip this step.

There are 200+ keyboard layouts out there to choose from.

You can list them with

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

When you find the desired kayboard layout set it with

loadkeys <layout-name>

Ensure EFI

This step is to ensure that you actually have UEFI firmware

ls /sys/firmware/efi/efivars

If nothig lists then you can't proceed with this guide, because we'll be doing UEFI specific stuff.

Network configuration

Before proceeding make sure that your network interfaces are listed and working ip link

Ethernet

If you are using ethernet cable then it should be automatically connected. Verify by ping google.com.

Wifi

Enter the wifi shell with iwctl List available wifi devices with device list and remember the name of your deisred device. Usually its wlan0 Now scan all available access points with station <wifi-device-name> scan. This command does not return result, but instead populates in the file system list of available networks. You can see the networks in the list with station <wifi-device-name get-networks. Pick the desired network name and connect to it with you desired network device station <wifi-device-name> connect "<network-name>" Now exit the shell and verify connectivity by ping google.com.

Update system clock

We need to ensure that system clock is acurate and synchronisation is enabled timedatectl set-ntp true. This enables automatic synchronization of the system clock with a remote server using the NTP (Network Time Protocol).

Disk layout

We'r about to format, partition and mount our devices. The below layout will be used

Partitioning the disk

EFI Purpose: OS boots from here. Size: 550M Type: ESP FS: FAT32 Mount:

Root Purpose: The top-level directory of the filesystem. Contains all of the files required to boot the Linux system before other filesystems are mounted. Size: 30G (it might be lower in your case) Type: Linux filesystem FS: Ext4

Swap Purpose: Used when we don't have enough RAM to increase the virtual memory capacity. I'm using it only for hybernation, because swapping is slow. Size: 33G (RAM + 1G so we can hybernate) Type: Linux swap FS: N/A

Home Purpose: For user home directories. Contains user-specific configuration files, caches, application data and media files. Size: What is left Type: Linux filesystem FS: Ext4

First lets get the name of the disk we want to partition. List your disks with lsblk command and you can se what is the name of your device. In my case its nvme0n1. In your case it may be sda1 or something.

Lets create partitions using the cgdisk util. Type cgdisk /dev/<your fisk>.

Lets now create our EFI partition. Select the Free space and press [ NEW ] Press enter for default first sector. Input 550M and press enter for size. Input ef00 (ESP type) and press enter. Now type ESP for name and press enter.

Proceeding with Root partition. Select the Free space and press [ NEW ] Press enter for default first sector. Input 30G and press enter for size. Press enter for default Linux partition. Now type Root for name and press enter.

Proceeding with SWAP. Select the Free space and press [ NEW ] Press enter for default first sector. Input 33G and press enter for size. Input 8200 (Linux swap type) and press enter. Now type Swap for name and press enter.

Finally we create the Home. Select the Free space and press [ NEW ] Press enter for default first sector. Press enter to allocate all remaining size. Press enter for default Linux partition. Now type Home for name and press enter.

Now select [ Write ] then yes and [ Quit ]. Verify everything looks as we wanted by listing your devices with lsblk.

Formating the partitions

Now lets format the partitions we created

mkfs.fat -F32 /dev/<efi partition name> # formats fat 32 the EFI
mkfs.ext4 /dev/<root partition name> # formats ext4 the root
mkfs.ext4 /dev/<home partition name> # formats ext4 the home
mkswap /dev/<swap partition name> # creates swap

Mounting

mount /dev/<root partition name> /mnt # mount first the root
mkdir /mnt/home #make dir to mount the home onto
mount /dev/<home partition name> /mnt/home/ # mount the home
swapon /dev/<swap partition name> # activates swap

Install essential packages

pacstrap /mnt base linux linux-firmware vim

Create file system table

Create the table genfstab -U /mnt >> /mnt/etc/fstab. Verify recrods are written cat /mnt/etc/fstab.

Change root to /mnt

We want to start working in /mnt as root dir. arch-chroot /mnt

Set local timezone

Create symlink to localtime for the desired timezone. In my case it /Europe/Sofia. ln - sf /usr/share/zoneinfo/<Continent>/<City> /localtime.

Now sync the hardware clock. hwclock --systohc.

Generate & set desired locale

Edit locale gen and uncomment the desired locales for later generation. In my case i'm ucommenting en_US.UTF-8 UTF-8.

vim /etc/locale.get.

Generate the locale data locale-gen

Add you locale to the conf. In my case its LANG=en_US.UTF-8 vim /etc/locale

Set hostname

Pick you desired hostname eg myarch. echo <you hostname> >> /etc/hostname.

Configure hosts

Open hosts file vim etc/hosts

Add the following content

127.0.0.1   localhost
::1         localhost
127.0.1.1   <hostname>.localdomain <hostname>

Generate initial ram file system

Initramfs is an initial ram file system based on tmpfs. It contains the tools and scripts required to mount the file systems before the init binary on the real root file system is called.

Run the mkinitcpio -P script to create an initial ramdisk environment.

Install essential linux ackages

We'r going to install

  • grub Bootloader - loads OS kernels.
  • base-devel Tools for building (compiling, linking)
  • efibootmgr CLI tool to modify the EFI boot manager - can destroy, reorder etc boot entries.
  • linux-headers Headers are part of the kernel, but shipped separately. They are interface between user space and the kernel
  • networkmanager Network servcie for managing devices & connections
  • nm-connection-editor App to add, remove, and modify network connections stored by NetworkManager
  • pulseaudio Sound server & proxy.
  • pavucontrol Volume control tool for pulseaudio.
  • dialog Display messages from shell to dialog box
  • wireless_tools Utilities for wifi ^^ should be new ones for the new audio shit.. PAV pipiwire pulse..

mount EFI partition

mkdir /boot/EFI
mount /dev/<efi parition name> /boot/EFI

mount EFI partition

mkdir /boot/EFI
mount /dev/<efi parition name> /boot/EFI

Install boot loader

Here we'r using x86. Check yours. grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck

Generate grub config

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

Eenable network manager on start

systemctl enable NetworkManager

Add new user

useradd -a -G wheel <your user name>

Add new user to sudoers

EDUTIR=vim visudo Now uncomment wheel ALL=(ALL) ALL to enable users of this wheel to use sudo.

Set pass

passwd <your user name>

Set pass for the root user

passwd root

Install display dirvers

Now pick one of these depending on your video card vendor

  • xf86-video-intel for Intel
  • xf86-video-amdgpu for AMD
  • nvidia nvidia-utils for NVIDIA

Now install the driver with pacman -S <driver name>

Install display server

pacman -S xorg

Install desktop env

I'm preferring GNOME for this. pacman -S gnome pacman -S gnome-tweaks Enable the gnome display managetr systemctl enable gdm

Reboot

Exit root exit and unmount partitions umount -a and reboot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment