Minimal Arch Linux Installation Guide
Arch Linux is a general-purpose rolling release Linux distribution and it is currently popular among linux enthusiasts and Intermediate/hardcore Linux users due to its versatility and minimal system requirements.
The default Arch Linux iso provides only a minimal base system and expects the end user to to configure and customize the distribution by themself.
Arch Linux uses a rolling release model, in which updates are frequently delivered to installed packages and system without any major release.
The pacman package manager is one of the major distinguishing features of Arch Linux which allows users to keep systems updated easily.
Requirements
- At least 1GB of RAM and 20GB of free hard-drive space
- An internet connection
- A USB drive with at least 2GB of free space
Install Arch Linux
This guide covers a minimal arch linux installation with a XFCE desktop enviornment. You can follow the steps as outlined below.
Step 1: Download arch linux
Arch Linux iso can be downloaded freely from their website. The installation process requires intenet connection to retrieve the package from Arch Linux mirrors.
Step 2: Create a live/bootable USB
Replace /path_to/archlinux.iso with your actual downloaded iso file and /dev/sdx with USB drive name.
$ dd bs=4M if=/path_to/archlinux.iso of=/dev/sdx status=progress && sync
Step 3: Boot from the newly created live USB.
- Insert the newly created live USB to the computer in which Arch Linux will be installed and restart the system.
- Depending upon your system, pressing F10, F11 or F12 on system startup will let you choose the device to boot from.
- In the boot settings choose the live USB that was created, which will trigger Arch Linux installer screen.
- Choose Boot Arch Linux (x86_64) and then press Enter.
(This guide assumes that your system is capable of UEFI booting, with minor changes this guide will be applicable to legacy boot as well)
Step 4: Check the network connection
The live usb will boot into a black terminal window (yup! there is no GUI, but follow the steps and you will be ok). The network will work out of the box for wired users you can use the below command to check network connectivity.
$ ping -c 3 archlinux.org
Those who are using WIFI during installation has to follow below steps to connect your device to internet.
- To check and connect to the available WIFI network we will use a program called iwctl.
$ iwctl
[iwd]# device list
example output: wlan0
- The device list command will provide the name of the network device available in your system. We will use this device to connect to the network. (Replace wlan0 with the output you got, it may be different in different systems)
$ iwctl
[iwd]# station wlan0 scan
[iwd]# station wlan0 get-networks
- The above commands will scan and list the available WIFI networks. You can connect to the desired network using below command.
[iwd]# station wlan0 connect SSID
(Replace SSID with the output you got, If Wifi password is required, you will be prompted to enter it.)
To disconnect from a network you can use disconnect command with the device name.
[iwd]# station wlan0 disconnect
Step 5: Partition the Disk
- Use the fdisk utility to list out your available disk drives.
$ fdisk -l
Find the name of the drive you want to partition, The name will be usually displayed as /dev/sdX format where X is the drive letter. (In this tutorial I am using sda as drive, replace it with the drive name in your system)
We will use cfdisk utility to partion the drive.
$ cfdisk /dev/sda
For this example I will be creating four partitions as below.
- boot (sda1: 500M)
- swap (sda2: 8G)
- root (sda3: 50G)
- home (sda4: Remaining space)
Step 6: Create Filesystem
To install Arch Linux we need to format the created partitions to currosponding file systems.
- EFI boot partiton
$ mkfs.fat -F32 /dev/sda1
- Swap partition
$ mkswap /dev/sda2
- Root and Home partitions
$ mkfs.ext4 /dev/sda3
$ mkfs.ext4 /dev/sda4
Step 7: Mount the partitions
Once the partitions are created we have to use the mount command to mount the partitions.
- Mount root partition
$ mount /dev/sda3 /mnt
- Mount home partition For mounting home partition we need to create /mnt/home and mount it.
$ mkdir /mnt/home
$ mount /dev/sda4 /mnt/home
- Mount swap partition
$ swapon /dev/sda2
- Check the mounted partion (Validating that everything is mounted correctly)
$ lsblk
Step 8: Install Arch Linux base system
Its time to install Arch Linux to bootable root partiton. pacstrap script is used to create the Arch Linux bootable partition.
$ pacstrap -i /mnt base linux linux-firmware sudo nano
Depending upon the network speed it will take some time to download all the required packages.
Step 9: Configuring the Arch Linux system
1. Generate the fstab file
File system table (fstab) is a configuration table designed to ease the burden of mounting and unmounting file systems to a machine.
To generate fstab file, we need to run the below command.
$ genfstab -U -p /mnt >> /mnt/etc/fstab
2. Arch-Chroot to the installed system
Change the root to the installed arch system, we can use arch-chroot command.
$ arch-chroot /mnt /bin/bash
3. Set the locale
The locale settings determines the language, date, numbering, and currency format for your system.
$ nano /etc/locale.gen
# uncomment #en_US for American English
#generate the locale. Run:
$ locale-gen
Create the locale.conf with corresponding language settings.
$ echo "LANG=en_US.UTF-8" > /etc/locale.conf
4. Set the Time Zone
First we need to list the timezone, enter the below command and press tab to see the available timezones.
$ ln -sf /usr/share/zoneinfo/
after selecting the required timezone press enter. Example:
$ ln -sf /usr/share/zoneinfo/Asia/Calcutta /etc/localtime
5. Set local time
This command will set your system time to your local time, validate by entering date after executing first command.
$ hwclock --systohc --utc
$ date
Tue Feb 1 07:04:04 PM IST 2022 # this will change according to your current local time
6. Set hostname
Create a hostname file and add your hostname
$ echo "myhostname" > /etc/hostname
# Example
$ echo my-pc > /etc/hostname
Add this name to /etc/hosts file
$ nano /etc/hosts
In the Nano editor, add this line at the end of the file: 127.0.1.1 localhost.localdomain “myhostname” Example: 127.0.1.1 localhost.localdomain my-pc
7. Install the network manager:
Better install network manager now so that once the system is rebooted you can enjoy the network connectivity.
$ pacman -S networkmanager
$ systemctl enable NetworkManager
#for wifi
$ pacman -S iwd
8. Set the root system password:
Enter passwd command and type the desired root password when prompted.
$ passwd
9. Setup the normal user account:
We won’t be using root account for our daily usage, better to create a normal user account.
$ useradd -m -g users -G wheel -s /bin/bash "your-desired-username"
$ passwd "your-desired-username"
# example
$ useradd -m -g users -G wheel -s /bin/bash john
$ passwd john
Enable sudo privileges for a newly created user.
$ EDITOR=nano visudo
%wheel ALL=(ALL) ALL # search for this line and uncomment by removing #
Enter the new password when prompted
10. Install the GRUB bootloader and EFI boot manager packages:
Arch Linux requires a boot loader to boot the system. You can install the grub boot loader using the below commands.
$ pacman -S grub efibootmgr
#Install the bootlader on your system and generate its configuration files
$ mkdir /boot/efi
$ mount /dev/sda1 /boot/efi
$ lsblk
# to check if everything is mounted correctly
$ grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --removable
$ grub-mkconfig -o /boot/grub/grub.cfg
Step 10: Reboot the system
Once the above steps are completed simply reboot the system and login using your new credentials.
$ exit
$ umount -R /mnt
$ reboot
The arch linux installation is finally completed, the below steps will install additional packages and GUI for you system.
Step 11: Install Xorg and pulseaudio packages
For graphical user interface we require Xorg package, similarly pulseaudio package is required for enabling audio.
$ sudo pacman -S pulseaudio pulseaudio-alsa xorg xorg-xinit xorg-server
Step 12: Install desktop environment
Linux system has various dektop enviornments to install according to user preference. We will be installing XFCE window manager with along with lightdm display manager for a traditional desktop look.
$ pacman -S xfce4 lightdm lightdm-gtk-greeter
$ echo "exec startxfce4" > ~/.xinitrc
$ systemctl enable lightdm
$ reboot
Now enjoy your own custom arch linux installation :)
<