Back to Blog
Installing Arch Linux
A step-by-step guide to installing Arch Linux on your system.
This comprehensive guide explains how to install Arch Linux with the btrfs file system, either as a standalone operating system or in a dual-boot setup. It also covers using an ArchScript method for an automated and reproducible installation process.
Prerequisites
- A USB drive with at least 2GB capacity
- Download the latest Arch Linux ISO from https://archlinux.org
- An active internet connection
- Familiarity with basic Linux commands
Step 1: Create a Bootable USB
- Download the Arch Linux ISO file.
- Use the following command to create a bootable USB:
# Replace /dev/sdX with your USB device
sudo dd if=archlinux.iso of=/dev/sdX bs=4M status=progress && sync
- Boot from the USB drive by selecting it in your system's BIOS/UEFI menu.
Step 2: Setting Up the Environment
Connect to the Internet
To connect to the internet:
- Use iwctl for wireless connections.
- Verify the connection with ping.
# Connect to Wi-Fi
iwctl
> station wlan0 connect "SSID"
# Verify connection
ping archlinux.org
Step 3: Partitioning the Disk
For Standalone Installation
- Open the partition manager:
fdisk /dev/sdX
-
Create these partitions:
- EFI boot partition (512MB)
- btrfs root partition (remaining space)
-
Format the partitions:
# Format the EFI partition
mkfs.fat -F32 /dev/sdX1
# Format the root partition with btrfs
mkfs.btrfs /dev/sdX2
- Mount the partitions:
mount /dev/sdX2 /mnt
mkdir /mnt/boot
mount /dev/sdX1 /mnt/boot
For Dual Boot
- Shrink the existing partition (e.g., Windows) using a tool like:
gparted
- Create new partitions as described above and format them.
Step 4: Installing the Base System
- Install essential packages:
pacstrap /mnt base linux linux-firmware
- Generate the file system table:
genfstab -U /mnt >> /mnt/etc/fstab
Step 5: Configure the System
- Change root to the new system:
arch-chroot /mnt
- Set up the timezone:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
hwclock --systohc
- Configure locale:
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen
- Set the hostname:
echo "archlinux" > /etc/hostname
- Configure the hosts file:
cat <<EOF > /etc/hosts
127.0.0.1 localhost
::1 localhost
127.0.1.1 archlinux.localdomain archlinux
EOF
- Set the root password:
passwd
- Install and configure the bootloader:
pacman -S grub efibootmgr
# For EFI systems
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
Step 6: Using ArchScript for Installation
For an automated approach, use ArchScript:
- Download the script:
git clone https://github.com/archlinux/archscript.git
cd archscript
- Run the script:
./archscript.sh
- Follow the on-screen instructions to:
- Select your desired disk and partitioning scheme.
- Automatically set up btrfs subvolumes.
- Install essential packages and configure the system.
Step 7: Post-Installation Setup
Enable and start services:
# Enable NetworkManager
systemctl enable NetworkManager
systemctl start NetworkManager
Update the system:
pacman -Syu
Troubleshooting
If you encounter issues during installation or boot, use a snapshot (if set up) to restore your system:
btrfs subvolume list /
btrfs subvolume delete /@<snapshot_name>
Quote
Installing Arch is not just about the destination; it’s about the journey of learning.
Arch Enthusiast
Enjoy your Arch Linux experience!