Installing Arch linux: Part 1

  1. 1. Create a bootable Installation medium
  2. 2. Boot into the installation medium
    1. 2.0.1. Connect to the Internet:
    2. 2.0.2. Update system clock:
    3. 2.0.3. Partition disks:
    4. 2.0.4. Format the partitions:
    5. 2.0.5. Mount the filesystems:
    6. 2.0.6. Installing base system:
    7. 2.0.7. Configuring base system:
      1. Fstab:
      2. Chroot:
      3. Time Zone:
      4. Locale:
      5. Network configuration:
      6. Set root password:
      7. Install intel microcode firmware:
      8. Install Boot Loader:
    8. 2.0.8. Reboot:
  • 3. Post Installation:

  • Arch Linux is a general purpose GNU/Linux based operating system which follows the rolling release model, which keeps the system up-to-date with the latest software. The design approach of Arch Linux is based on KISS Principle(Keep It Simple, Stupid) which focuses on elegance, code correctness, minimalism and simplicity, and expects the user to be willing to make some effort to understand the system’s operation. More information can be found on the Wikipedia page. Without further ado, lets get started.

    Create a bootable Installation medium

    I would personally recommend grabbing a USB pendrive, minimum 1 GB of size. Download the latest Arch Linux ISO file. Then, create a bootable USB drive with the following command:

    dd bs=4M if=/path/to/archlinux.iso of=/dev/sdX status=progress oflag=sync

    Remember to replace X with your device ID and Do not append partition number to the command. You can list available device using fdisk -l command.

    Boot into the installation medium

    After successfully creating the bootable drive, boot into the USB. You will be automatically logged into the root account of archiso. Follow the steps below to proceed with the installation:

    Connect to the Internet:

    Assuming you are on a UEFI based system[1], connect to the internet. If you have a LAN connection, you can skip this step. Otherwise, you can connect to your wireless network using:

    wifi-menu -o

    Test the connection using ping command.

    Update system clock:

    timedatectl set-ntp true

    Partition disks:

    fdisk provides a great interface for this purpose. Identify your hard drive on which you wish to install Arch Linux using fdisk -l and partition that drive using the following command:

    fdisk /dev/sdX

    Remember, you should’nt include any partition number as mentioned earlier. This command will take you to the fdisk shell. Type m to view help. More information can be found here.

    Minimum two partitions are required, one for EFI System Partition with mount point /boot, whereas the other for the root partition with mount point /. If dual-booting Arch Linux with Windows, please see [2]. A swap partition is optional, but recommended. You can refer to this table for deciding on the size. A swap file is more flexible way of creating this. We will cover the creation of swap file in the upcoming sections.

    Format the partitions:

    Ext4 is a stable and reliable filesystem. To format your partitions with ext4, run the following command, replacing N with the partition number:

    mkfs.ext4 /dev/sdXN  # Replace X with device number and N with partition number

    We will create and mount the swap file during mounting stage.

    Mount the filesystems:

    First, mount your root partition to /mnt:

    mount /dev/sdXN /mnt

    Next, create a boot folder inside /mnt to mount the EFI System partion:

    mkdir /mnt/boot
    mount /dev/sdXN /mnt/boot

    Follow the same steps for any other remaining partitions. For example, if you wish to mount another partition to /home, just run:

    mkdir /mnt/home
    mount /dev/sdXN /mnt/home

    Remember to substitute the appropriate values for X and N.

    Finally, create the swap partition and mount it[3] :

    fallocate -l size /mnt/swapfile
    chmod 600 /mnt/swapfile # Set appropriate permissions
    mkswap /mnt/swapfile # Format as swapfile
    swapon /mnt/swapfile # Activate the swap

    where size can be 512M for 512 MB, 2G for 2 GB and so on.

    Installing base system:

    Simple run the following to install a working base system:

    pacstrap /mnt base base-devel

    Configuring base system:

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

    Edit /mnt/etc/fstab to remove the /mnt entry prefixed in the swap field.

    arch-chroot /mnt
    Time Zone:
    ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
    hwclock --systohc # Set hardware clock to UTC

    Uncomment required locales in /etc/locale.gen and run:


    Set the LANG variable:

    Network configuration:

    Create the hostname file and matching entries in hosts:

    3	localhost
    ::1 localhost myhostname.localdomain myhostname

    Install netctl dependencies and enable systemd services:

    pacman -S dialog wpa_supplicant

    If you are planning to install full-blown Desktop Environments like Gnome, KDE, skip this step, else:

    pacman -S wpa_actiond ifplugd
    systemctl enable netctl-ifplugd@interface.service # For wired devices
    systemctl enable netctl-auto@interface.service # For wireless devices

    You can get the interface value for respective devices by running ip addr show.

    Set root password:
    Install intel microcode firmware:
    pacman -S intel-ucode
    Install Boot Loader:

    Assuming you are install Grub:

    pacman -S grub efibootmgr os-prober
    grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB # esp=EFI System Partition mount point
    grub-mkconfig -o /boot/grub/grub.cfg


    Umount all mounted partitions:

    umount -R /mnt

    Remove the installation media, enter your BIOS setup, make necessary changes to boot sequence, save and exit. You will now be booted into your freshly installed Arch Linux 😃

    Post Installation:

    Necessary configurations and tasks related to getting a working system such as creating user, installing Xorg, configuring drivers, etc will be covered in the second part of the post. Till then, stay tuned! Link to the follow-up post: Part 2

    1. Most of the modern systems are UEFI based. ↩︎

    2. For dual-booting with windows, you don’t need to create an EFI System Partion. Simply mount the Windows boot drive(generally formatted as FAT32) to /boot. Do not format this partition, else you will loose Windows boot data. ↩︎

    3. If you are using other filesystems except ext, please verify the compatibility of swap partition. ↩︎