Embarking on the journey to install Arch Linux can be both exciting and rewarding. Unlike many other Linux distributions, Arch provides users with the opportunity to build a bespoke system tailored to their preferences. In this guide, we’ll walk through the step-by-step process of installing Arch Linux, ensuring that you not only set up the system but also gain a deeper understanding of its inner workings.
Prerequisites
Before diving into the installation process, make sure you have the following:
- A bootable Arch Linux USB drive
- A computer with internet access
- A backup of any important data on your device
Step 1: Booting into the Arch Linux Live Environment
Insert the USB drive and boot your computer from it. Once booted, you’ll find yourself in the Arch Linux live environment.
Step 2: Verify Internet Connection
Before proceeding, ensure that your internet connection is working. You can use the ping command to test connectivity.
ping -c 3 google.com
Step 3: Partitioning the Disk
Use a tool like cfdisk or fdisk to partition your disk. Create partitions for the root filesystem, swap space, and any additional partitions you may need.
Step 4: Formating Partitions
Format the partitions using the mkfs command. For example:
mkfs.ext4 /dev/sdX1 # Format root partition
mkswap /dev/sdX2 # Format swap partition
swapon /dev/sdX2 # Activate swap
Replace /dev/sdX1 and /dev/sdX2 with your actual partition names.
Step 5: Mounting Partitions
Mount the root partition to /mnt:
mount /dev/sdX1 /mnt
Step 6: Installing the Base System
Use the pacstrap command to install the base system and essential packages:
pacstrap /mnt base linux linux-firmware
Step 7: Generating fstab
Generate an fstab file to define how disk partitions should be mounted:
genfstab -U /mnt >> /mnt/etc/fstab
Step 8: Chroot into the Installed System
Enter the newly installed system:
arch-chroot /mnt
Step 9: Configuring the System
Set the time zone, localisation, and create the initial RAM disk:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
Uncomment the desired locale(s) in /etc/locale.gen and run:
locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
Step 10: Setting Up Network
Create a hostname file and edit /etc/hosts:
echo "YourHostname" > /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 YourHostname.localdomain YourHostname" >> /etc/hosts
Install a network manager, such as NetworkManager:
pacman -S networkmanager
systemctl enable NetworkManager
Step 11: Installing a Boot Loader
Install a boot loader; for example, GRUB:
pacman -S grub
grub-install --target=i386-pc /dev/sdX
grub-mkconfig -o /boot/grub/grub.cfg
Replace /dev/sdX with your actual drive.
Step 12: Creating a User and Password
Create a user and set a password:
useradd -m -g users -G wheel username
passwd username
Edit the sudoers file to allow the wheel group to use sudo:
visudo
Uncomment the line:
%wheel ALL=(ALL) ALL
Step 13: Rebooting
Exit the chroot environment, unmount partitions, and reboot:
exit
umount -R /mnt
reboot
Congratulations! You’ve successfully installed Arch Linux. Take the time to explore the Arch Wiki for further customisation and optimisation options to make your Linux experience truly unique.