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.
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
Change to the superuser account. This will make the installation process easy.
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
Write the iso file to the flash drive
dd if=/home/user/Downloads/archlinux-2020-x86_64.iso of=/dev/sdc status="progress"
Reboot the PC and boot from the flash drive.
- Switch to super user so you can easily do everything without typing sudo
Check whether the system is booting through MBR.
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.
Check whether the internet conneciton is working by pinging to google.
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.
Get time and date from NTP (Network time protocol)
timedatectl set-ntp true
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.
- If you want to change the partitions in the hard disk sda
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.
Format the partitions. It is advicable to format all partitions for storing files as ext4 and the swap partition as swap.
Make folders to mount the partitions. We can send the / partition to /mnt (/mnt folder is already there).
mount /dev/sd1 /mnt
We need a folder for /home partition.
mount /dev/sd2 /mnt/home
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
- Save the file system table by UUID
genfstab /mnt -U >> /mnt/etc/fstab
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
Install NetworkManager and enable the auto start. This is useful for internet connections.
pacman -S networkmanager
systemctl enable NetworkManager
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
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
Add a sudo password for admin access
Set up the locale. We pick en_US here. First, open the locale file by nano text editor.
You have to uncomment the following two lines (remove the HASH)
Save the file by pressing CTRL + X and Y.
Now, generate the locale
Add the language to locale.conf file. First open it by nano text editor.
Add the following line
Save the file by pressing CTRL + X and Y.
Find your timezone name. If you are in Asia you have to first run
Then make a symbolic link from YOURTIMEZONE to /etc/localtime
ln -sf /usr/share/zoneinfo/Asia/YOUR_TIME_ZONE /etc/localtime
Put a name for your PC
First open the /etc/hostname file in nano text editor
Then type the name in the file. Close the file by saving CTRL+X and choose Y
Create a user account for you. Assume that your name is abcxyz
useradd abcxyz --home /home/abcxyz
It is good to add abcxyz user account to SUDO users (so you can use the sudo command from this account).
[To be added]
Unmount the pen drive
umount –R /mnt
Exit chroot since you need to go back to the OS on the pen drive to reboot.
Reboot the system (remove the pen drive before your system boots again)
To be continued......
[Written on : 8th July, 2020. Last edited : 10th July, 2020]