Installing Arch Linux

1. Creating Live Media


Downloading an Arch Image File

Verify Image Integrity

Write Image to Bootable Media

Windows
  • Use a tool like Balena Etcher or Rufus to flash the downloaded ISO to a connected USB drive
Linux
  • Use a tool like fdisk, blkid, or fdisk -l to identify USB drive by device identifier and dd to directly write the ISO to a connected USB drive. For example:
    sudo dd bs=4M if=/path/to/filename.iso of=/dev/sdX status=progress && sync

Booting from Live Media

  • With the image written to the USB drive, boot from it by using BIOS to override primary boot sequence – selecting the USB drive
  • Once the live media’s bootloader appears, use the first option to load the Arch install environment in memory

2. Target Disk Preparation


Identify Target Disk


Use lsblk, blkid or fdisk –l to display disk details.
You will see various device identifiers, such as sda, sdb, nvme0n1, vda etc…
Use the provided information to determine the device identifier of your target disk.
In this guide, I’ll be using the device identifier /dev/nvme0n1 as the target disk. This will of course vary, replace /dev/nvme0n1 with your target disk identifier. Commands listed below that are enclosed in angle brackets are intended to act more as placeholders, requiring the user to input the appropriate option.

Structuring Disk Properties 

fdisk </dev/nvme0n1>

In our terminal, we are now interacting with the fdisk program and so the prompt will appear differently. We’re going to be setting up a small disk sector for the EFI system and a large sector for our primary install. 

Note: If you’re prompted to remove signatures, it indicates it’s not a fresh install. Make sure you’ve specified the correct disk before inadvertently wiping out the wrong disk. 

Partition Table

Use fdisk command g to create a new empty partition table using the GUID Partition Table scheme.

Partition 1 – Boot Partition / EFI Partition

  • Use fdisk command n to create a new partition
  • Partition Number – 1 (default)
  • Sector starting point – Use default
  • Sector ending point – Type +512M to specify the partition’s end point, which will reflect the overall size of the partition.
  • Partition Type – Use fdisk command t to set a partition’s type. If prompted, specify partition number 1. Use the uefi alias to change to EFI System.

Partition 2 – Primary Partition

  • Use fdisk command n to create a new partition
  • Partition Number – 2 (default)
  • Sector starting point – Use default
  • Sector ending point – Press the [Enter/Return] key to select the end of the disk or specify an size, such as +500G or +20G for example 
  • Partition Type – Use fdisk command t to set a partition’s type. Specify partition number 2. Use the lvm alias to change to Linux LVM. 

Verify and Write Changes to Disk

  • Use fdisk command p to display the partition table. Confirm target disk’s device name and the partition layout.
  • After confirming desired changes, use fdisk command w to write changes to disk 

Structuring Logical Volume Groups 

  1. pvcreate --dataalignment 1m /dev/nvme0n1p2
    This command creates a physical volume on the specified block device /dev/nvme0n1p2 with a data alignment of 1 MB. You should target partition 2 as the EFI System will not be set up for LVM.
  2. vgcreate <lvg0> /dev/nvme0n1p2
    This command creates a volume group named lvg0 on the physical volume /dev/nvme0n1p2. A volume group is a collection of physical volumes that can be used to create logical volumes.
  3. lvcreate –L <40GB> lvg0 -n <rootvol>
    This command creates a logical volume named rootvol with a size of 40 GB on the volume group lvg0. It’s intended to host the / directory. A logical volume is a virtual disk that can be created on a volume group and can be used as a normal block device.
  4. lvcreate –l 100%FREE lvg0 –n <homevol>
    This command creates a logical volume named homevol with a size equal to the remaining free space in the volume group lvg0. It’s intended to host the /home directory. The -l option specifies the size of the logical volume as a percentage of the total free space in the volume group.
  5. modprobe dm_mod
    This command loads the device-mapper module, which is required for creating and managing logical volumes.
  6. vgscan
    This command scans for all volume groups on the system and updates the system’s volume group metadata.
  7. vgchange –ay
    This command activates all volume groups on the system that are not already active. The –ay option stands for “activate yes”, which forces the activation of all volume groups.

Disk Formatting

  1. mkfs.fat -F32 /dev/nvme0n1p1
    Formats the EFI partition with Fat32 
  2. mkfs.ext4 /dev/lvg0/rootvol
    Formats the root logical volume with ext4 
  3. mkfs.ext4 /dev/lvg0/homevol
    Formats the home logical volume with ext4 

Mounting Target Filesystem

This is necessary so the live environment can interact with the target virtual filesystem 

  1. mount /dev/lvg0/rootvol /mnt 
  2. mkdir /mnt/home
  3. mount /dev/lvg0/homevol /mnt/home

Generate fstab file 

The fstab file is used to automatically mount the filesystem at startup using the UUID of the disk(s)

  1. mkdir /mnt/etc 
  2. genfstab –Up /mnt >> /mnt/etc/fstab

3. Main Install


  1. pacstrap /mnt
    Installs the base packages needed for the Arch Linux system in the /mnt directory. The /mnt directory is usually the mount point for the root partition of the target system.
  2. arch-chroot /mnt
    Changes the root filesystem environment to the /mnt directory.
  3. pacman –S linux linux-headers linux-lts linux-lts-headers
    Installs the Linux kernel and the kernel headers, as well as the LTS (Long-Term Support) version of the kernel and the kernel headers. Use the mkinitcpio repository for initramfs.
  4. pacman –S base-devel openssh sudo nano vi networkmanager wpa_supplicant wireless_tools netctl dialog gzip which
    Installs additional packages, including:
  • ssh for secure remote access
  • sudo for executing commands with root privileges
  • the nano text editor
  • The vi text editor
  • NetworkManager for managing network interfaces
  • wpa_supplicant for Wi-Fi support
  • wireless_tools for wireless configuration
  • netctl for network profiles
  • dialog for creating menus
  • gzip for compression
  • which for finding the location of executables.
  1. systemctl enable NetworkManager
    Enables NetworkManager to start automatically at boot time.
  2. systemctl enable sshd
    Enables the SSH daemon to start automatically at boot time.
  3. pacman –S lvm2
    Installs LVM (Logical Volume Manager) support.
  4. nano /etc/mkinitcpio.conf
    Opens the mkinitcpio configuration file for editing. It is used to build the initial ramdisk image initramfs. Find the following line (1) and change to match line (2)
    1. HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
      The original line in the file
    2. HOOKS=(base udev autodetect modconf block lvm2 filesystems keyboard fsck)
      The modified line in the file, which adds the lvm2 hook to the list of hooks.
  5. mkinitcpio –p linux
    Regenerates the initramfs image for the default Linux kernel.
  6. mkinitcpio –p linux-lts
    Regenerates the initramfs image for the LTS Linux kernel.
  7. nano /etc/locale.gen
    Opens the locale.gen file for editing. Uncomment your locale code by removing the leading #. This will be en_US.UTF-8 UTF-8 for English – US. Save and close.
  8. locale-gen
    Generates the locales that were uncommented in the locale.gen file.
  9. passwd
    Set the root account password.
  10. useradd –m –g users –G wheel <user>
    Creates a new user account and adds it to the users group and the wheel group, which allows the user to execute commands with root privileges using sudo.
  11. passwd <user>
    Set user account password
  12. EDITOR=nano visudo
    Opens the sudoers file for editing with the Nano text editor. Uncomment “# %wheel ALL=(ALL) ALL” and save. Remove the # symbol from the beginning of the %wheel ALL=(ALL) ALL line, which allows users in the sudo group to execute any command with root privileges using the sudo command.
  13. usermod -L root
    Locks root user account

4. Bootloader Configuration


Installing Grub and creating EFI directory

  1. pacman –S grub dosfstools os-prober mtools efibootmgr
    Installs tools that are necessary for this process
  • grub: This is the GRand Unified Bootloader, a widely used bootloader program for Linux systems that allows the user to choose which operating system or kernel to boot at startup.
  • dosfstools: This package includes utilities for creating, modifying, and checking FAT file systems, which are commonly used on bootable drives and disks.
  • os-prober: This is a tool for detecting other operating systems installed on the system, which can be useful for configuring the bootloader and multi-boot systems.
  • mtools: This package provides utilities for working with MS-DOS file systems, which are sometimes used for bootable media and disk images.
  • efibootmgr: This tool is used for managing the EFI Boot Manager, which is responsible for loading the operating system and other boot-related files on UEFI-based systems. It allows the user to view and modify the boot configuration, including adding or removing boot entries, changing the boot order, and setting boot parameters.
  1. mkdir /boot/efi
    Creates the efi directory needed to install the bootloader to
  2. mount /dev/nvme0n1p1 /boot/efi
    Mounts the EFI partition to the efi directory which is necessary to interact with that partition

Configuring Grub 

  1. grub-install --target=x86_64-efi --bootloader-id=<bootloaderID> --recheck
    Installs grub for UEFI systems. The bootloaderID is a placeholder for how you want to identify this partition.
  2. cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
    This file contains translated messages for the GRUB bootloader, which is used to configure the bootloader to display messages and menus in English.
  3. grub-mkconfig –o /boot/grub/grub.cfg
    Generates a new GRUB configuration file based on the current system configuration. This file is used by the GRUB bootloader to determine which operating system to boot and how to configure the boot process.

5. First Boot


Exiting Install Environment 

  1. exit
  2. reboot now

Setting Date and Time

  1. timedatectl list-timezones
  2. timedatectl set-timezone America/Dallas
  3. systemctl enable systemd-timesyncd

Setting Hostname

  1. sudo hostnamectl set-hostname <myhost>
  2. echo "127.0.0.1 localhost" | sudo tee -a /etc/hosts
  3. echo "::1 localhost ip6-localhost ip6-loopback" | sudo tee -a /etc/hosts
  4. echo "127.0.0.1 <myhost>" | sudo tee -a /etc/hosts

Installing CPU Microcode Support

pacman –S amd-ucode
or
pacman -S intel-ucode

6. Desktop Environment Setup


1. Display Server Install

X11

To install X11, run the following command:
pacman -S xorg-server

Wayland

To install Wayland, run the following command:
pacman -S wayland

2. Video Driver Install

AMD

To install the video driver for AMD, run the following command:
pacman -S mesa xf86-video-amdgpu

NVIDIA

To install the video driver for NVIDIA, run the following command:
pacman -S nvidia nvidia-lts

Intel

To install the video driver for Intel, run the following commands:
pacman -S mesa xf86-video-intel

Virtual Video Driver

To install the virtual video driver, run the following commands:
pacman -S virtualbox-guest-utils xf86-video-vmware systemctl enable vboxservice

Gnome

To install Gnome, run the following command:
pacman -S gnome gnome-tweaks

To enable Gnome Display Manager (GDM), run the following command:
systemctl enable gdm

Plasma KDE

To install Plasma KDE, run the following command:
pacman -S plasma-meta kde-applications

To enable SDDM Display Manager, run the following command:
systemctl enable sddm

XFCE

To install XFCE, run the following command:
pacman -S xfce4 xfce4-goodies

To enable recommended display manager for XFCE, run the following command:
systemctl enable lightdm

Mate

To install Mate, run the following command:
pacman -S mate mate-extra

To enable recommended display manager for Mate, run the following command:
systemctl enable lightdm


Leave a Reply

Your email address will not be published. Required fields are marked *

Comments

  1. […] Once installed, let’s first allow TCP traffic over your SSH port so that you don’t get locked out of…

  2. […] have the option to choose between Password and SSH key selection. Learn more about SSH keys here. It’s recommended…