Gihan Chanaka Jayatilaka : Blog : Installing Arch Linux

This blog post is about installing Arch Linux on a PC. You can follow these steps to install the OS on a MBR PC. These instructions are compiled from my personal experience with the installation.

  1. Download arch linux ISO from the official website.
    For the sake of this installation, we assume the downloaded file is at home/user/Downloads/archlinux-2020-x86_64.iso
  2. Change to the superuser account. This will make the installation process easy.
    sudo su
  3. Connect the flash drive to your USB port and see the USB port address by using the command lsblk
    For the sake of this installation, we assume the flash drive is at /dev/sdc
  4. Write the iso file to the flash drive
    dd if=/home/user/Downloads/archlinux-2020-x86_64.iso of=/dev/sdc status="progress"
  5. Reboot the PC and boot from the flash drive.
  6. Switch to super user so you can easily do everything without typing sudo
    sudo su
  7. Check whether the system is booting through MBR.
    ls /sys/firmware/efi/efivars This command will not show any folder by this name is the system is on MBR.
    But the folder will be there is the system is on UEFI. In that case, go to the motherboard settings and change the system to MBR.
  8. Check whether the internet conneciton is working by pinging to google.
    ping If it is not working, you can use wifi-menu to setup wifi.
    If wifi is not working at all, try connecting through an ethernet cable.
  9. Get time and date from NTP (Network time protocol)
    timedatectl set-ntp true
  10. Check the partitions and hard disks by typing lsblk
    Assume that you get a partition list like this:
    Here, sda and sbd are hard disks or pen drives. sd1 and sd2 are partitions of sda. sd3 and sd4 are partitions of sdb.
  11. If you want to change the partitions in the hard disk sda
    fdisk /dev/sda
  12. We are going to assume that 3 partitions are being used for the installation. sd1 for / (root director, where everything is installed), sd2 for /home (the home directory for user files) and sd3 for swap.
  13. Format the partitions. It is advicable to format all partitions for storing files as ext4 and the swap partition as swap.
    mkfs.ext4 /dev/sd1
    mkfs.ext4 /dev/sd2
    mkswap /dev/sd3
  14. Make folders to mount the partitions. We can send the / partition to /mnt (/mnt folder is already there). mount /dev/sd1 /mnt
  15. We need a folder for /home partition.
    mkdir /mnt/home
    mount /dev/sd2 /mnt/home
  16. Install the base of arch-linux along with some important packages (linux-firmware is used for wifi and other drivers, base-devel has compilers for software development, vim and nano are useful text editors.)
    pacstrap /mnt base linux-lts linux-firmware base-devel vim nano
  17. Save the file system table by UUID
    genfstab /mnt -U >> /mnt/etc/fstab
  18. Until now, you are working on the OS on the flash drive. We have to change the root to the hard disk OS, which is at /mnt
    arch-chroot /mnt
  19. Install NetworkManager and enable the auto start. This is useful for internet connections.
    pacman -S networkmanager
    systemctl enable NetworkManager
  20. Install grub (which is the software that can create a bootloader that boots up archlinux and other operating systems). Please note that this step does not create the bootloader.
    pacman -S grub
  21. Since we are using sda hard disk for the computer, we have to install a bootloader on sda.
    grub-install --target=i386-pc /dev/sda
    grub-mkconfig -o /boot/grub/grub.cfg
  22. Add a sudo password for admin access
  23. Set up the locale. We pick en_US here. First, open the locale file by nano text editor.
    nano /etc/locale.gen
    You have to uncomment the following two lines (remove the HASH)
    en_US.UTF-8 UTF-8
    en_US ISO-8859-1
    Save the file by pressing CTRL + X and Y. Now, generate the locale
  24. Add the language to locale.conf file. First open it by nano text editor.
    nano /etc/locale.conf
    Add the following line
    Save the file by pressing CTRL + X and Y.
  25. Find your timezone name. If you are in Asia you have to first run
    ls /usr/share/zoneinfo/Asia/
    Then make a symbolic link from YOURTIMEZONE to /etc/localtime
    ln -sf /usr/share/zoneinfo/Asia/YOUR_TIME_ZONE /etc/localtime
  26. Put a name for your PC
    . First open the /etc/hostname file in nano text editor
    nano /etc/hostname Then type the name in the file. Close the file by saving CTRL+X and choose Y
  27. Create a user account for you. Assume that your name is abcxyz
    useradd abcxyz --home /home/abcxyz
  28. It is good to add abcxyz user account to SUDO users (so you can use the sudo command from this account).
    [To be added]
  29. Unmount the pen drive
    umount –R /mnt
  30. Exit chroot since you need to go back to the OS on the pen drive to reboot.
  31. Reboot the system (remove the pen drive before your system boots again)
  32. To be continued......

[Written on : 8th July, 2020. Last edited : 10th July, 2020]