Installation Guide for Arch Linux: A Comprehensive Step-by-Step Approach

Welcome to our exhaustive guide on installing Arch Linux. This tutorial will walk you through every step of the process, from preparing your system to configuring your desktop environment. We aim to provide a clear, concise, and complete installation guide for both beginners and experienced users. This guide focuses on the standard installation process using the official Arch Linux installation medium.

Prerequisites: Before You Begin

Before embarking on the Arch Linux installation, ensure you have the following:

  • A Compatible Computer: Ensure your hardware meets the minimum requirements for Arch Linux. This includes a 64-bit (x86_64) compatible system, a reasonable amount of RAM (at least 2GB is recommended), and sufficient storage space for the operating system and your applications.
  • A Bootable Arch Linux Installation Medium: Download the latest Arch Linux ISO image from the official website (https://archlinux.org/download/). Create a bootable USB drive using tools like dd, Rufus (for Windows), or BalenaEtcher.
  • Internet Connectivity: A stable internet connection is crucial for downloading packages during the installation process. Ensure you have a working Ethernet connection or a Wi-Fi adapter compatible with Arch Linux.
  • Time and Patience: The Arch Linux installation process is more involved than other distributions. Allocate sufficient time and patience to follow the instructions carefully.
  • Backup Your Data: Back up any important data from the storage device you intend to install Arch Linux on. The installation process will erase all data on the chosen drive.

Booting from the Installation Medium

Booting the Arch Linux ISO

  1. Insert the USB drive into your computer and restart it.
  2. Enter the Boot Menu: During startup, press the key that activates your computer’s boot menu. This key varies depending on your motherboard manufacturer (e.g., Esc, F2, F12, Del). Consult your motherboard’s documentation if you’re unsure.
  3. Select the USB Drive: From the boot menu, select the USB drive containing the Arch Linux installation medium.
  4. Boot into the Arch Linux Environment: The system will boot into the Arch Linux live environment. You will be presented with a root shell prompt.

Initial System Setup in the Live Environment

After booting into the live environment, the first steps involve basic system configuration before the actual installation of Arch Linux:

Keyboard Layout and Font

  1. Set Keyboard Layout: By default, the live environment uses a US keyboard layout. To change it to your preferred layout, use the loadkeys command. For example, to set a French keyboard layout:

    loadkeys fr-latin9
    

    To see available keyboard layouts, use ls /usr/share/kbd/keymaps/**/*.map.gz.

  2. Set Font: If you find the default font difficult to read, you can change it. For example:

    setfont lat2-term-16
    

    To list available fonts, use ls /usr/share/kbd/consolefonts/.

Verify Internet Connection

  1. Check Network Connectivity: Verify that you have an active internet connection. You can use the ping command to test connectivity to a known server like Google:

    ping archlinux.org -c 3
    

    If ping fails, you might need to configure your network manually.

Partitioning the Disk

This step involves creating partitions on your storage device. This is a crucial process in any Arch Linux installation.

  1. Identify Disks: Use the lsblk command to list available block devices (disks and partitions). Identify the disk you want to install Arch Linux on (e.g., /dev/sda, /dev/nvme0n1).

    lsblk
    
  2. Partitioning with fdisk or gdisk: We strongly recommend using gdisk for GPT partitioning on modern systems. fdisk is an alternative for MBR partitioning.

    # For GPT partitioning
    gdisk /dev/sdX # Replace sdX with your disk identifier
    

    or

    # For MBR partitioning
    fdisk /dev/sdX # Replace sdX with your disk identifier
    
    • Inside gdisk, type g to create a new GPT partition table.

    • Create the following partitions. The exact sizes can be adjusted based on your needs.

      • EFI System Partition (ESP): (Required for UEFI systems)
        • Size: 512MB or more
        • Type code: EF00 (for gdisk)
        • Partition number: 1
        • Filesystem: FAT32
      • Root Partition (/):
        • Size: At least 20GB (recommended)
        • Type code: 8300 (for gdisk)
        • Partition number: 2 (or the next available)
        • Filesystem: ext4 (recommended)
      • Swap Partition (Optional): Create a swap partition if you desire hibernation or if your system has limited RAM.
        • Size: Recommended to be at least the size of your RAM, or more.
        • Type code: 8200 (for gdisk)
        • Partition number: 3 (or the next available)
        • Filesystem: swap
    • Write the changes to the disk by typing w in gdisk and confirming.

  3. Formatting Partitions: Format the partitions with the appropriate filesystems.

    • Format the EFI System Partition (ESP) as FAT32:

      mkfs.fat -F32 /dev/sdX1 # Replace sdX1 with your ESP partition identifier
      
    • Format the root partition as ext4:

      mkfs.ext4 /dev/sdX2 # Replace sdX2 with your root partition identifier
      
    • Format the swap partition (if created):

      mkswap /dev/sdX3 # Replace sdX3 with your swap partition identifier
      swapon /dev/sdX3
      
  4. Mounting Partitions: Mount the partitions to prepare for the Arch Linux installation.

    mount /dev/sdX2 /mnt # Mount the root partition to /mnt
    mkdir /mnt/boot # Create boot directory
    mount /dev/sdX1 /mnt/boot # Mount the EFI partition to /mnt/boot if using UEFI
    

Installing the Base System

This is where the core Arch Linux packages are installed.

  1. Update the Pacman Mirror List: Before installing packages, update the pacman mirror list to ensure you have the latest package information and that you are connected to a fast mirror.

    pacman -Syy
    
  2. Install the Base System: Install the base system packages using pacstrap.

    pacstrap /mnt base linux linux-firmware nano
    

    This command installs the essential packages for Arch Linux. It also includes the Linux kernel and firmware, as well as a text editor, which will be valuable for configuration.

Configuring the System

After the base system installation, configure the system settings within the newly installed environment.

  1. Generate an fstab File: Generate an fstab file to define how your partitions should be mounted at boot.

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

    Review the generated fstab file using nano /mnt/etc/fstab and ensure the entries are correct. Correct any mistakes.

  2. Chroot into the System: Enter the newly installed system using the arch-chroot command. This allows you to configure the system as if you were running it from the installed hard drive.

    arch-chroot /mnt
    
  3. Set the Time Zone: Set your system’s timezone. For example, to set the timezone to America/Los_Angeles:

    ln -sf /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
    

    Use timedatectl status to verify the timezone setting. Synchronize the system clock.

    timedatectl set-ntp true
    
  4. Configure Localization: Edit the /etc/locale.gen file and uncomment your desired locales. Then, generate the locale files.

    nano /etc/locale.gen
    

    Uncomment the lines for your locales (e.g., en_US.UTF-8 UTF-8, fr_FR.UTF-8 UTF-8). Then, generate the locales:

    locale-gen
    

    Set the system locale by editing /etc/locale.conf:

    nano /etc/locale.conf
    

    Add the following line, replacing en_US.UTF-8 with your chosen locale:

    LANG=en_US.UTF-8
    
  5. Hostname: Set your system’s hostname by editing /etc/hostname:

    echo "myhostname" > /etc/hostname  # Replace "myhostname" with your desired hostname
    

    Modify /etc/hosts:

    nano /etc/hosts
    

    Add the following lines, replacing myhostname with your chosen hostname:

    127.0.0.1   localhost
    ::1         localhost
    127.0.1.1   myhostname.localdomain    myhostname
    
  6. Network Configuration: Configure your network. If you’re using Ethernet, the configuration is often straightforward. For Wi-Fi, additional steps are needed.

    • Ethernet: The systemd-networkd and systemd-resolved services are recommended for Ethernet configuration.

      systemctl enable systemd-networkd.service
      systemctl enable systemd-resolved.service
      

      Restart your system or use systemctl restart systemd-networkd to apply the changes.

    • Wi-Fi: Install iwctl and use it to connect to your Wi-Fi network:

      pacman -S iwctl
      iwctl
      

      Within iwctl:

      [iwctl] station wlan0 scan
      [iwctl] station wlan0 get-networks
      [iwctl] station wlan0 connect <your_wifi_network_name>
      [iwctl] exit
      
  7. Set a Root Password: Set a strong password for the root user:

    passwd
    
  8. Install a Bootloader: This step is crucial for booting into your Arch Linux installation. The bootloader loads the kernel and initial ramdisk (initramfs) to start the operating system. We’ll use GRUB as an example.

    • Install GRUB:

      pacman -S grub efibootmgr # efibootmgr is needed for UEFI systems
      
    • Install GRUB to the EFI System Partition (for UEFI systems)

      grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
      

      or install GRUB to the MBR (for BIOS systems):

      grub-install /dev/sdX # replace sdX with your disk identifier
      
    • Generate the GRUB configuration file:

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

Post-Installation and Customization

After completing the core installation, several steps are required to tailor your Arch Linux installation to your specific needs.

  1. User Creation: Create a regular user account for daily use.

    useradd -m -g users -G wheel <your_username>  # Replace <your_username>
    passwd <your_username>
    
  2. Enable Sudo (Optional): Grant your user sudo privileges.

    EDITOR=nano visudo
    

    Uncomment the line: %wheel ALL=(ALL) ALL Save the file.

  3. Install Desktop Environment/Window Manager (Choose One): Select and install a desktop environment or window manager.

    • GNOME:

      pacman -S gnome gnome-extra
      
    • KDE Plasma:

      pacman -S plasma kde-applications
      
    • XFCE:

      pacman -S xfce4 xfce4-goodies
      
    • i3 (Window Manager):

      pacman -S i3-gaps i3status i3lock
      
    • Other DEs/WMs: Research other available options.

  4. Install Display Manager (Recommended): A display manager provides a graphical login screen.

    • GDM (for GNOME):

      pacman -S gdm
      systemctl enable gdm.service
      
    • SDDM (for KDE Plasma):

      pacman -S sddm
      systemctl enable sddm.service
      
    • LightDM (works with various DEs/WMs):

      pacman -S lightdm lightdm-gtk-greeter
      systemctl enable lightdm.service
      
  5. Install Additional Software: Install essential and preferred applications such as web browsers, text editors, office suites, media players, etc.

    pacman -S firefox libreoffice gimp
    
  6. Configure Sound: Install and configure sound server.

    pacman -S pulseaudio pulseaudio-alsa pavucontrol
    

    Enable and start the PulseAudio service.

    systemctl --user enable pulseaudio.service
    systemctl --user start pulseaudio.service
    
  7. Configure Network Time Protocol (NTP):

    pacman -S ntpd
    systemctl enable ntpd.service
    systemctl start ntpd.service
    
  8. Configure Drivers:

    • Graphics Drivers: Install the appropriate drivers for your graphics card (e.g., xf86-video-ati for AMD, xf86-video-nvidia for NVIDIA, xf86-video-intel for Intel).
    • Wireless Drivers: If you are using a wireless network card, ensure that the necessary drivers are installed.

Reboot and Enjoy

  1. Exit chroot:

    exit
    
  2. Unmount Partitions:

    umount -R /mnt
    
  3. Reboot:

    reboot
    

Your Arch Linux installation should now be complete. After the reboot, you should be able to log in to your chosen desktop environment or window manager. Congratulations! You have successfully installed Arch Linux. Enjoy the flexibility and power it offers! Remember to consult the Arch Linux Wiki for further information and troubleshooting. The Wiki is your best resource for any Arch Linux related issues. This installation guide is a starting point, and the journey of customizing and learning Arch Linux is ongoing.