How to Install Arch Linux

Introduction: The Arch Linux Philosophy

Arch Linux represents a distinct approach to Linux distribution. It is not pre-configured with defaults and aims to provide a lightweight, flexible, and user-centric operating system. The philosophy behind Arch is “Keep It Simple, Stupid” (KISS), which translates into a minimalist base system that the user builds upon to suit their exact needs. This makes it an excellent choice for those who want complete control over their environment, a deep understanding of their system, and the ability to tailor it for specific tasks, whether it be a powerful development workstation, a lean server, or a customized desktop experience.

This guide will walk you through the process of installing Arch Linux from scratch. It is designed for users who are comfortable with the command line and are eager to learn the inner workings of a Linux system. While it may seem daunting at first, the process is methodical and highly rewarding.

Prerequisites and Preparation

Before embarking on the Arch Linux installation, ensure you have the following in hand.

System Requirements

Arch Linux is known for its minimal resource requirements. However, to ensure a smooth installation and a functional system, consider these general guidelines:

  • Architecture: A modern x86-64 processor.
  • RAM: At least 512 MB is recommended for basic installation, but 1 GB or more is highly advisable for a graphical environment and general use.
  • Storage: A minimum of 10 GB of free disk space. More is recommended depending on your intended use and the software you plan to install.
  • Bootable Installation Medium: A USB drive or DVD containing the Arch Linux installation image.
  • Internet Connection: A stable internet connection is crucial for downloading packages during the installation process.

Downloading the Arch Linux ISO

The first step is to obtain the latest Arch Linux installation image.

  1. Visit the Official Arch Linux Download Page: Navigate to the official Arch Linux download page (https://archlinux.org/download/).
  2. Choose a Mirror: You will find a list of download mirrors around the world. Select a mirror geographically close to you for faster download speeds.
  3. Download the ISO: Download the .iso file for the latest release.

Creating a Bootable USB Drive

Once you have the ISO image, you need to write it to a USB drive to create a bootable installation medium.

For Linux Users:

The dd command is a powerful and straightforward way to achieve this.

  1. Identify your USB drive: Insert your USB drive and use a command like lsblk or sudo fdisk -l to identify its device name (e.g., /dev/sdX, where X is the drive letter). Be extremely careful to select the correct device, as writing to the wrong drive can erase all its data.
  2. Unmount the USB drive (if mounted):
    bash
    sudo umount /dev/sdX*

    Replace /dev/sdX with your USB drive’s device name.
  3. Write the ISO to the USB drive:
    bash
    sudo dd bs=4M if=/path/to/archlinux-*.iso of=/dev/sdX status=progress oflag=sync

    Replace /path/to/archlinux-*.iso with the actual path to your downloaded ISO file, and /dev/sdX with your USB drive’s device name. The bs=4M option specifies a block size of 4 megabytes for faster writing, status=progress shows the writing progress, and oflag=sync ensures data is physically written to the drive.

For Windows Users:

Tools like Rufus or balenaEtcher can be used to create bootable USB drives.

  1. Download Rufus: Get Rufus from its official website.
  2. Launch Rufus: Open Rufus and select your USB drive.
  3. Select the ISO: Click “Select” and choose the downloaded Arch Linux ISO file.
  4. Start the process: Click “Start” and confirm any prompts. Rufus will warn you that all data on the USB drive will be destroyed.

Booting from the Installation Medium

After creating the bootable USB drive, you need to configure your computer’s BIOS/UEFI to boot from it.

  1. Restart your computer: Insert the bootable USB drive and restart your computer.
  2. Enter BIOS/UEFI settings: Immediately upon startup, press the key to enter your system’s BIOS or UEFI settings. This key is usually displayed on the screen during boot and commonly is Del, F2, F10, F12, or Esc. Consult your motherboard or computer manufacturer’s documentation if unsure.
  3. Change boot order: Navigate to the “Boot” or “Boot Order” section. Prioritize booting from your USB drive.
  4. Save and Exit: Save your changes and exit the BIOS/UEFI setup. Your computer should now boot into the Arch Linux live environment.

The Arch Linux Installation Process

Once you have successfully booted into the Arch Linux live environment, you will be presented with a command-line prompt. This is where the installation begins.

Initial Setup and Network Configuration

The first steps involve ensuring your system is ready and connected to the internet.

  1. Verify Boot Mode:
    Arch Linux can be installed in either UEFI or BIOS mode. Check which mode your system is using:

    ls /sys/firmware/efi/efivars
    

    If this command shows files, you are in UEFI mode. If it returns an error or an empty directory, you are likely in BIOS mode. This is important for partitioning and bootloader installation.

  2. Set Keyboard Layout (Optional but Recommended):
    To ensure your keyboard layout is correct, especially if it’s not US English:

    loadkeys us
    

    Replace us with your desired layout (e.g., gb for British English).

  3. Connect to the Internet:
    Arch Linux installation requires an internet connection to download packages.

    • Wired Connection (Ethernet): If you have a wired connection, it should automatically be detected. You can verify your IP address with:

      ip link
      dhcpcd
      

      The dhcpcd command will try to obtain an IP address for your network interface.

    • Wireless Connection (Wi-Fi): For wireless connections, you’ll need to use the iwctl utility.
      bash
      iwctl
      [iwd]# device list
      [iwd]# station <device_name> scan
      [iwd]# station <device_name> get-networks
      [iwd]# station <device_name> connect <SSID>

      Replace <device_name> with your Wi-Fi adapter (e.g., wlan0), <SSID> with your Wi-Fi network name. You will be prompted for your Wi-Fi password.

  4. Update the System Clock:
    Ensure your system’s clock is accurate, which is important for package verification.
    bash
    timedatectl set-ntp true
    timedatectl status

Disk Partitioning

This is a critical step where you define how your hard drive will be used. The method of partitioning depends on whether you are using UEFI or BIOS mode.

UEFI System Partitioning

For UEFI systems, you’ll typically need at least three partitions:

  1. EFI System Partition (ESP): This partition is essential for booting UEFI systems. It should be formatted as FAT32 and is usually mounted at /boot. A size of 300-500 MB is generally sufficient.
  2. Root Partition (/): This is where the main Arch Linux system will be installed. You can choose the size based on your needs; 20-30 GB is a reasonable starting point.
  3. Swap Partition (Optional but Recommended): A swap partition acts as virtual RAM. A common recommendation is to set it equal to or double your physical RAM, though modern systems with ample RAM may need less.

BIOS System Partitioning

For BIOS systems, you typically need:

  1. Root Partition (/): Similar to UEFI, this is where the system is installed.
  2. Swap Partition (Optional but Recommended): Similar to UEFI, for virtual RAM.
  3. Home Partition (/home) (Optional but Recommended): Separating /home allows you to reinstall the system without losing your personal files.

Using fdisk or parted

We’ll use fdisk for this guide, as it’s widely used and straightforward. Replace /dev/sdX with your target drive (e.g., /dev/sda, /dev/nvme0n1).

  1. Launch fdisk:

    fdisk /dev/sdX
    
  2. Create Partitions:

    • For UEFI:

      • g to create a new GPT partition table (for UEFI).
      • n to create a new partition.
      • Press Enter to accept defaults for partition number, first sector, and last sector (for ESP, adjust size to ~500M).
      • Enter ef00 as the partition type for the ESP.
      • n to create the root partition. Accept defaults for partition number, first sector. For the last sector, specify a size (e.g., +30G).
      • n to create the swap partition. Accept defaults for partition number, first sector. For the last sector, specify a size (e.g., +4G).
      • t to change partition type. Select the swap partition number and enter 8200.
      • w to write changes and exit.
    • For BIOS:

      • o to create a new MBR partition table (for BIOS).
      • n to create a new partition (primary). Accept defaults for partition number, first sector. Specify size (e.g., +30G) for root.
      • n to create a new partition (primary or logical for swap). Accept defaults for partition number, first sector. Specify size (e.g., +4G) for swap.
      • t to change partition type. Select the swap partition number and enter 82.
      • w to write changes and exit.
  3. Format Partitions:

    • EFI System Partition (if applicable):
      bash
      mkfs.fat -F 32 /dev/sdX1
    • Root Partition:
      bash
      mkfs.ext4 /dev/sdX2

      (Replace /dev/sdX2 with your root partition, e.g., /dev/sda2)
    • Swap Partition:
      bash
      mkswap /dev/sdX3

      (Replace /dev/sdX3 with your swap partition, e.g., /dev/sda3)
      bash
      swapon /dev/sdX3

Mounting Partitions

Now, mount the newly formatted partitions to the live environment’s file system.

  1. Mount the Root Partition:

    mount /dev/sdX2 /mnt
    

    (Replace /dev/sdX2 with your root partition)

  2. Create and Mount EFI System Partition (if applicable):
    bash
    mkdir /mnt/boot
    mount /dev/sdX1 /mnt/boot

    (Replace /dev/sdX1 with your EFI partition)

Installing Essential Packages

The pacstrap script is used to install the base Arch Linux system and other essential packages onto your mounted root partition.

  1. Install Base System and Text Editor:

    pacstrap /mnt base linux linux-firmware nano
    
    • base: The essential Arch Linux packages.
    • linux: The Linux kernel.
    • linux-firmware: Firmware required by various hardware components.
    • nano: A simple text editor for configuration files. You can replace nano with your preferred editor, such as vim.
  2. Generate fstab:
    This file defines how partitions are mounted at boot.
    bash
    genfstab -U /mnt >> /mnt/etc/fstab

    Verify the contents of /mnt/etc/fstab to ensure it looks correct.

System Configuration

With the base system installed, you need to configure it to your liking.

Chrooting into the New System

To make changes to the installed system, you need to change the root directory to /mnt.

arch-chroot /mnt

You are now operating within your newly installed Arch Linux environment.

Time Zone Configuration

Set your system’s time zone.

  1. List available time zones:
    bash
    ls /usr/share/zoneinfo/
  2. Set your time zone:
    bash
    ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

    For example: ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime
  3. Synchronize the hardware clock:
    bash
    hwclock --systohc

Localization

Configure your system’s language settings.

  1. Edit locale.gen:
    Open /etc/locale.gen with your text editor (e.g., nano /etc/locale.gen). Uncomment the lines for your desired locales. For example, to enable English (US) and English (United Kingdom):

    en_US.UTF-8 UTF-8
    en_GB.UTF-8 UTF-8
    
  2. Generate Locales:

    locale-gen
    
  3. Create locale.conf:
    Set the default system locale.
    bash
    echo "LANG=en_US.UTF-8" > /etc/locale.conf

    (Replace en_US.UTF-8 with your preferred locale)

Hostname

Set the hostname for your computer.

  1. Edit hostname file:

    echo "myarchlinux" > /etc/hostname
    

    Replace "myarchlinux" with your desired hostname.

  2. Configure hosts file:
    Edit /etc/hosts and add the following lines:

    127.0.0.1 localhost
    ::1 localhost
    127.0.1.1 myarchlinux.localdomain myarchlinux

    Replace myarchlinux.localdomain and myarchlinux with your actual hostname.

Root Password

Set a strong password for the root user.

passwd

You will be prompted to enter and confirm the root password.

Bootloader Installation

A bootloader is necessary to boot your Arch Linux system. GRUB is a popular and robust choice.

For UEFI Systems (GRUB)

  1. Install GRUB and EFI support:

    pacman -S grub efibootmgr
    
  2. Install GRUB to the EFI partition:

    grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=ArchLinux
    
    • --efi-directory=/boot: Specifies the directory where the EFI System Partition is mounted.
    • --bootloader-id=ArchLinux: A unique identifier for your Arch Linux boot entry.
  3. Generate GRUB configuration file:
    bash
    grub-mkconfig -o /boot/grub/grub.cfg

For BIOS Systems (GRUB)

  1. Install GRUB:

    pacman -S grub
    
  2. Install GRUB to the Master Boot Record (MBR):

    grub-install /dev/sdX
    

    Replace /dev/sdX with your boot drive (e.g., /dev/sda). Do not specify a partition number here.

  3. Generate GRUB configuration file:
    bash
    grub-mkconfig -o /boot/grub/grub.cfg

Additional User Creation (Recommended)

It’s best practice to create a regular user account for daily use, rather than always operating as root.

  1. Add a new user:

    useradd -m -G wheel username
    

    Replace username with your desired username. The -m flag creates a home directory, and -G wheel adds the user to the wheel group, which is often used for administrative privileges.

  2. Set password for the new user:

    passwd username
    
  3. Configure sudo:
    To allow your new user to execute commands with root privileges, you need to configure sudo.

    • Install sudo:
      bash
      pacman -S sudo
    • Edit the sudoers file:
      bash
      visudo

      Uncomment the line %wheel ALL=(ALL:ALL) ALL to allow members of the wheel group to use sudo. Save and exit.

Installing a Desktop Environment (Optional)

If you want a graphical user interface, you’ll need to install a desktop environment and a display manager. Here’s an example for GNOME:

  1. Install GNOME and a display manager (GDM):

    pacman -S gnome gdm
    
  2. Enable GDM:

    systemctl enable gdm
    
  3. Other Desktop Environments: You can choose other popular desktop environments like KDE Plasma (plasma kde-applications), XFCE (xfce4 xfce4-goodies), or LXQt (lxqt). Remember to enable their respective display managers (e.g., sddm for KDE, lightdm for XFCE/LXQt).

Finalizing the Installation and Rebooting

Once all configuration steps are complete, you are ready to exit the chroot environment and reboot your system.

  1. Exit chroot:

    exit
    
  2. Unmount partitions:

    umount -R /mnt
    
  3. Reboot:
    bash
    reboot

Remove the installation medium (USB drive) when prompted or as your computer restarts.

Post-Installation Steps

Upon booting into your new Arch Linux system, you’ll likely be greeted by a login prompt (or the graphical login manager if you installed a desktop environment).

  • Login: Log in as the regular user you created.
  • Update System: It’s always a good practice to update your system after installation:
    bash
    sudo pacman -Syu
  • Install Additional Software: Now you can install any other applications you need using pacman. For example:
    bash
    sudo pacman -S firefox vlc git

Congratulations, you have successfully installed Arch Linux! This provides a solid foundation for a highly customized and efficient operating system. The Arch Wiki (https://wiki.archlinux.org/) is an invaluable resource for further customization and troubleshooting.

Leave a Comment

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

FlyingMachineArena.org is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. Amazon, the Amazon logo, AmazonSupply, and the AmazonSupply logo are trademarks of Amazon.com, Inc. or its affiliates. As an Amazon Associate we earn affiliate commissions from qualifying purchases.
Scroll to Top