Arch Linux installation methods are changing from time to time and as per the request of many, I’ll give you the recent method.
Connecting to WiFi
The first step is to connect your computer to the network. You can skip these steps if you are connected to the network with a network cable.
In the current Arch Linux installation images, iwctl is used to connect to the WiFi networks.
Get the Interactive Prompt
Use the following command to get the interactive prompt of iwctl.
root@archiso ~ # iwctl
Get the WiFi devices list
Use the following command to list the WiFi devices on your computer that you have to use in the rest of the commands.
[iwd]# device list
And you will get a result that looks like below.
Devices *
---------------------------------------------------------------------
Name Address Powered Adapter Mode
---------------------------------------------------------------------
wlan0 xx:xx:xx:xx:xx:xx on phy0 station
Your device name will be wlan0 which is going to be used from the next command.
Scan for WiFi networks
Use the following command to scan for WiFi networks around you.
[iwd]# station wlan0 scan
View scanned results
Use the following command to view the scanned networks around you.
[iwd]# station wlan0 get-networks
And you will be getting an output that looks like below.
Available Networks *
---------------------------------------------------------------------
Network name Security Signal
---------------------------------------------------------------------
Home LTE psk *****
AHCD psk *
Connect to the network
Use the following command to connect to the WiFi network that you found in the previous one.
[iwd]# station wlan0 connect 'Home LTE'
And type the passphrase for the network
Type the network passphrase for Home LTE psk.
Passphrase: ****
Exit from the iwd prompt.
[iwd]# exit
Verify
Try pinging google.com to verify if the connection is successful.
root@archiso ~ # ping google.com
Setting up the disk
Create root partition
Open your disk with gdisk from the following command.
root@archiso ~ # gdisk /dev/sdx
Create a new partition for the root.
Command (? for help): n
Enter to select default values
Partition number: [Enter]
First sector: [Enter]
Put your partition size as the last sector value. Here I have put 100GB.
Last sector: +100G
Put 8304 as the code to set the partition type to Linux x86-64 root (/).
Hex code or GUID: 8304
Create home partition
Repeat the same procedure to create a partition for the home. Put 8302 as the Hex code to set the partition type to Linux /home.
Command (? for help): n
Partition number: [Enter]
First sector: [Enter]
Last sector: +200G
Hex code or GUID: 8302
Create swap partition
Again repeat the same procedure to create a swap partition. It’s better if you use twice your RAM size for the partition size here. Also, put 8200 as the Hex code to set the partition type to Linux swap.
Command (? for help): n
Partition number: [Enter]
First sector: [Enter]
Last sector: +16G
Hex code or GUID: 8200
Write changes
Write the changes to the disk with the following command
Command (? for help): w
Do you want to proceed? (Y/N): Y
List partitions
Use the following command to print the list of the partitions. Note down the partition numbers for the EFI, Linux root, Linux home and Linux swap partitions.
root@archiso ~ # gdisk -l /dev/sdx
Format partitions
Format the root and home partitions with the following commands
root@archiso ~ # mkfs.ext4 -L "Arch Linux Root" /dev/sdxy
root@archiso ~ # mkfs.ext4 -L "Arch Linux Home" /dev/sdxy
Enable swap partition
Use the following commands to enable the swap partition.
root@archiso ~ # mkswap /dev/sdxy
root@archiso ~ # swapon /dev/sdxy
Mount partitions
Use the following commands to mount root and home partitions
root@archiso ~ # mount /dev/sdxy /mnt
root@archiso ~ # mkdir /mnt/home
root@archiso ~ # mount /dev/sdxy /mnt/home
Installation
Install essential packages
Use the following command to install the base and essential packages.
root@archiso ~ # pacstrap /mnt base linux linux-firmware
Mount boot partition
Use the following command to mount the EFI partition.
root@archiso ~ # mkdir /mnt/boot/efi
root@archiso ~ # mount /dev/sdxy /mnt/boot/efi
Configure fstab
root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab
Change root
Use the following command to change the root to the new installation.
root@archiso ~ # arch-chroot /mnt
Install packages
Install iwd, nano, dhcpcd packages to be used in the later of this article.
[root@archiso /]# pacman -S iwd nano dhcpcd
Setup the timezone
Use the following commands to set the timezone
[root@archiso /]# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
[root@archiso /]# hwclock --systohc
Setup Localization
Open the locale.gen file,
[root@archiso /]# nano /etc/locale.gen
and uncomment required languages
en_US.UTF-8 UTF-8
and, save and exit. Then use the following commands to set up the rest of the localization.
[root@archiso /]# echo LANG=en_US.UTF-8 > /etc/locale.conf
[root@archiso /]# export LANG=en_US.UTF-8
[root@archiso /]# locale-gen
Setup network configurations
Use the following command with your hostname to set up the hostname.
[root@archiso /]# echo yourHostName > /etc/hostname
Package Manager Configurations
Open /etc/pacman.conf,
[root@archiso /]# nano /etc/pacman.conf
Uncomment lines under [multilib] to enable 32bit packages in pacman and, save and exit. And use the following command to sync packages.
[root@archiso /]# pacman -Sy
Root password
Use the following command to set the root password.
[root@archiso /]# passwd
Setup the bootloader
Here I have used GRUB as the bootloader. Use the following command to install GRUB packages for EFI system.
[root@archiso /]# pacman -S grub efibootmgr
Use the following command to install grub bootloader to your system. Here my system is an x86_64 system.
[root@archiso /]# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB
If all success you will get a message saying that there’s no error is reported.
Write the settings to grub config file with the following command.
[root@archiso /]# grub-mkconfig -o /boot/grub/grub.cfg
Exit
Now the installation is finished. Unmount and reboot with the following commands.
[root@archiso /]# exit
root@archiso ~ # umount -R /mnt
root@archiso ~ # reboot
If there’s no issue, you’ll be able to see Linux is booting with the grub bootloader.
Post Installation
Once the system is booted login into the system using the previously created password.
yourHostName login: root
Password: <root password>
You’ll get,
[root@yourHostName ~]#
if the login is successful.
Start services
Use the following commands to start required services. If you are connected to the network with a cable, you won’t need to start the iwd service.
[root@yourHostName ~]# systemctl start dhcpcd
[root@yourHostName ~]# systemctl start iwd
Connect to the WiFi
Use the way at the beginning of this article to connect to the WiFi network.
Install required packages
Use the following command to install the X environment group.
[root@yourHostName ~]# pacman -S xorg
Use the following command to install other required packages.
[root@yourHostName ~]# pacman -S mesa ttf-dejavu alsa-utils pulseaudio sudo
Create a user
Use the following command with your user name.
[root@yourHostName ~]# useradd -m -s /bin/bash yourUserName
and add a password to the user that you have just created.
[root@yourHostName ~]# passwd yourUserName
Then add the user to the sudoers file. First, open the sudoers file,
[root@yourHostName ~]# EDITOR=nano visudo
add yourUserName ALL=(ALL) ALL after root ALL=(ALL) ALL line in the file. Then save and exit.
Install a Desktop Environment
I selected KDE as the DE here. Use the following command to install KDE.
[root@yourHostName ~]# pacman -S plasma plasma-wayland-session kde-applications
Enable services
Use the following commands to enable display manager and network-manager services.
[root@yourHostName ~]# systemctl enable sddm
[root@yourHostName ~]# systemctl enable NetworkManager
Dual boot with Windows
If you want to add Windows boot manager to grub, install the following package.
[root@yourHostName ~]# pacman -S os-prober
And then use the following command.
[root@yourHostName ~]# grub-mkconfig -o /boot/grub/grub.cfg
You’ll be able to see Windows Boot Manager during the process.
Other required packages
Following packages will make your life easier with the new installation.
[root@yourHostName ~]# pacman - ntfs-3g gst-libav
So that’s it
If you have any suggestions or questions about this guide, comment here or send me an email.