By installing the Arch Linux, you can learn a few things about operating systems. If you want to install Arch Linux or just want to follow along to see how the installation process goes, you can follow this guide.
Some processes during the Arch Linux installation might change in the future; therefore, you should also read the official Arch Linux installation guide for the most accurate and up-to-date information.
To disable the Safe Boot option, first enter the BIOS. I am using an MSI motherboard (MSI PRO Z690), and to enter the BIOS, I had to press the Del key. Once in the BIOS, choose Advanced Mode, navigate to the Security section at the bottom right corner of the BIOS UI, and set the Safe Boot option to Disabled.
This would allow Arch Linux to boot.
Go to the Arch Linux Download page and acquire an installation image. It is recommended to get it as a torrent. If that is not an option for you, download it through HTTP by choosing the country you are downloading from for the fastest download speed.
Once you have acquired the installation image, you can create an Arch Linux installer USB drive. Remember that once you write the Arch Linux ISO file onto the USB drive, the content of the USB drive will be irrevocably deleted, so make sure to save any important files from the USB drive before creating a bootable USB drive.
To create a bootable USB drive with the Arch Linux ISO file, run the following command on your current Linux distro:
dd bs=4M if=path/to/archlinux-version-x86_64.iso of=/dev/disk/by-id/usb-My_flash_drive conv=fsync oflag=direct status=progress
Where:
path/to/archlinux-version-x86_64.iso is the path to the Arch Linux ISO file you downloaded earlier
/dev/disk/by-id/usb-My_flash_drive is the location of yyur USB drive that will be made bootable
To find the location of your USB drive, run lsblk
in the terminal.
In my case I would run the following command:
dd bs=4M if=/andrija/Downloads/archlinux-version-x86_64.iso of=/dev/sda conv=fsync oflag=direct status=progress
Reboot the PC, and choose the USB installation medium from your Boot Menu. To access the Boot Menu, you may need to press a specific key (such as F12, Esc, or Del) during startup, depending on your motherboard. Once in the Boot Menu, select the USB drive to begin the Arch Linux installation process.
Once you’ve entered the live environment, check if you have access to the internet:
ping archlinux.org
if you’re using WiFi connection, check the iwctl Guide.
To identify the drive on which you will be installing Arch Linux, run the lsblk
command. If it is an NVMe SSD it will start with nvme.
Let’s say you will be installing Arch Linux on the nvme2n1 device. To create partitions on that disk run the following:
fdisk /dev/nvme2n1
Then to create an empty GPT partition table, press g and then Enter.
To create a new partition, press n, and leave the default values for the Partition number and the First sector. I will make this partition a BOOT partition, allocate 1 Gigabyte. To do so, type +1G for the Last sector.
If you get asked to remove the partition signature, you can say Yes.
To create the second, press n again, and leave the default values for the Partition number and the First sector. This will be my SWAP partition and I will allocate 32 Gigabytes for it, because I am running a 32 GB RAM configuration, and that should be sufficient for swapping. So I will type +32G for the Last sector.
If you get asked to remove the partition signature, you can say Yes.
To create the third partition, press n once again and leave all the default values. This means the Last sector will take up the remaining space, which will be used for the / partition.
If you get asked to remove the partition signature, you can say Yes.
Now, that partitions are created, let’s choose the correct partition types for each partition. To do this, enter t, and choose 1 as partition number. Since the first partition will be for BOOT, type 1 as a Partition type.
Next, to change the partition type for the SWAP partition, type t again, choose 2 as Partition number, and then 19 as the Partition type. This sets the second partition type to Linux swap.
Leave the type for the third partition unchanged, as it is set to Linux filesystem by default.
Each newly created partition must be formatted with an appropriate file system. For the root partition, I'll use the Ext4 file system.
mkfs.ext4 /dev/nvme2n1p3
To initialize the SWAP partition, run the following:
mkswap /dev/nvme2n1p2
And for the BOOT, run the following:
mkfs.fat -F 32 /dev/nvme2n1p1
Mount the root partitiono to /mnt
:
mount /dev/nvme2n1p3 /mnt
Create a mount point for the BOOT partition, and mount the BOOT partition:
mount --mkdir /dev/nvme2n1p1 /mnt/boot
To enable the SWAP partition, use the following command:
swapon /dev/nvme2n1p2
To install the base system and other packages that we’re going to use, run the following command:
pacstrap -K /mnt base linux linux-firmware neovim intel-ucode sof-firmware base-devel grub efibootmgr networkmanager
This command installs the base Arch Linux system, the Linux kernel, firmware, and additional utilities including:
neovim (a text editor)
intel-ucode (Intel CPU microcode updates)
sof-firmware (Sound Open Firmware for audio devices)
base-devel (development tools)
grub (bootloader)
efibootmgr (UEFI boot manager)
networkmanager (network management tool)
To generate a file system table (fstab) that will be used for mounting filesystems at boot, run the following command:
genfstab -U /mnt >> /mnt/etc/fstab
To chroot into the new Arch Linux installation, use the following command:
arch-chroot /mnt
Set the time zone for your region. Replace Europe
and Belgrade
with your appropriate region and city. Use the following commands:
ln -sf /usr/share/zoneinfo/Europe/Belgrade /etc/localtime
Synchronize the hardware clock:
hwclock --systohc
Uncomment en_US.UTF-8 UTF-8
in the /etc/locale.gen file. You can do this using the following command:
nvim /etc/locale.gen
To enter EDIT/INSERT mode in neovim(nvim), press i
. To exit EDIT/INSERT mode, press Esc
. To save your changes and exit, type :wq
and press Enter
.
Then generate the locale with:
locale-gen
Create the /etc/locale.conf file and set the language variable to LANG=en_US.UTF-8
:
nvim /etc/locale.conf
Open the /etc/hostname
file to add your hostname for the PC:
neovim /etc/hostname
Add your desired hostname (e.g., mycomputer) and save the file.
Set the root password by running:
passwd
Create a user and add that user to the wheel group with the following commands:
useradd -m -G wheel -s /bin/bash andrija
Where andrija
is the user.
Set a password for the new user using papsswd
:
passwd andrija
To allow members of the wheel group to use sudo, uncomment %wheel ALL=(ALL) ALL
in the /etc/sudoers. First set your editor to neovim:
EDITOR=nvim visudo
To enable the Network Manager, use the following command:
systemctl enable NetworkManager
This will configure Network Manager to start automatically on boot. To start it immediately without rebooting, run:
systemctl start NetworkManager
To Install the boot loader(GRUB in this case) for UEFI systems run:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --removable
And generate the GRUB configuration file:
grub-mkconfig -o /boot/grub/grub.cfg
Exit the chroot environment:
exit
Unmount all mounted partitions:
umount -R /mnt
Reboot the system:
reboot
After the reboot, Arch Linux should boot, but you will see a command line interface. Now that you have Arch Linux installed, in the next posts, we’ll cover how to install NVIDIA drivers, as well as the KDE Plasma Desktop environment and the Hyprland Window Manager.
Now that your Arch Linux installation is complete, you can proudly say: “I use Arch, BTW 😉”.
Once you have completed the installing of Arch Linux, you can enhance your experience by setting up a Desktop Environment. To do so, visit the following link: Install a Desktop Environment Guide. This guide will walk you through the process of installing a Desktop Environment, allowing you to enjoy a graphical user interface on your Arch Linux system.