Ankit R Gadiya

Arch Linux Installation

A Step-by-step guide to install Archlinux.

September 06, 2016

This is a Step-by-step tutorial for installing Arch Linux.

Arch Linux

A Linux distro which is commonly considered for power users. It provides a lot of customisation right from the installation process. Its very light-weight distro, and it install very few core packages at the time of installation. Also one get all the latest packages as Arch Linux is rolling release distro. Also Arch users get access to Arch User Repository aka AUR which is a comprehensive repository with tons of packages. One can say that AUR contain all the packages that you can find on any other distro.

But the installation process is little complicated as you don’t get any GUI installer instead you’ve to install it from command line only. So, here’s the step by step guide to install Arch Linux on your machine.

Steps:


  • Download the Arch Linux iso from here.
    Note: The iso is common for both 64 bit and 32 bit.

  • Burn the iso into a CD or make a bootable usb from the iso downloaded and boot from it.

  • Choose your architecture from the boot menu.

  • Once you get to the commandline, check your internet connection.
    $ ping google.com
    
  • List the disks
    $ fdisk -l
    
  • Choose the disk you want to install Arch Linux in and partition it.
    $ cfdisk /dev/sdx
    

    Caution: This will erase all the data on that disk, choose wisely. I’m using “x” in sdx, you can replace it with variable corresponding to your disk.

  • Choose dos

  • Create one root partition, one swap partition, and more if you need them.

  • Make root partition bootable and change swap partition type to Linux Swap.

  • Write and quit

  • Change root partition to ext4 file system.
    $ mkfs.ext4 /dev/sdx1
    
  • Change swap partition file system to swap.
    $ mkswap /dev/sdx2
    
  • Mount swap partition.
    $ swapon /dev/sdx2
    
  • Mount all the partition.
    $ mount /dev/sdx1 /mnt
    

    Note: Mount all other partitions if any.

  • Update pacman repositories.
    $ pacman -Sy
    
  • Install Arch base packages.
    $ pacstrap -i /mnt base base-devel
    
  • Generate fstab
    $ genfstab -U -p /mnt >> /mnt/etc/fstab
    $ cat /mnt/etc/fstab
    
  • Change root into the new system
    $ arch-chroot /mnt
    
  • List all the regions and cities for time zone.
    $ ls /usr/share/zoneinfo/
    $ cd /usr/share/zoneinfo/REGION
    $ ls
    
  • Update your time zone using above information
    $ ln -s /usr/share/zoneinfo/REGION/CITY /etc/localtime
    $ hwclock --systohc --utc
    
  • Generate locale
    $ nano /etc/locale.gen
    

    Note: Uncomment your specific localization.

    $ locale-gen
    $ echo LANG=en_US.UTF-8 > /etc/locale.conf
    

    Replace en_US.UTF-8 with the one you uncommented previously.

  • Set hostname
    echo HOSTNAME > /etc/hostname
    

    Replace HOSTNAME with your hostname.

  • Set the network configuration
    $ systemctl enable [email protected]
    
  • Set root password
    $ passwd
    
  • Create a new initial RAM disk
    $ mkinitramfs -p linux
    
  • Install bootloader
    $ pacman -S grub os-prober
    $ grub-install -target=i386-pc -recheck /dev/sdx1
    $ grub-mkconfig -o /boot/grub.cfg
    
  • Exit the chroot environment
    $ exit
    
  • Unmount the disks
    $ umount -R /mnt
    
  • Reboot
    $ reboot
    
  • Done!