Skip to content

Latest commit

 

History

History
278 lines (231 loc) · 8.68 KB

File metadata and controls

278 lines (231 loc) · 8.68 KB

Arch Linux Installation Guide for Windows / PC (Dual-Boot & Single-Boot)

This guide provides a comprehensive, step-by-step walkthrough for installing Arch Linux on standard PC hardware. It specifically covers dual-booting alongside Windows 10/11 using UEFI mode, as well as a clean single-boot installation.


Part 1: Pre-Installation Steps (In Windows)

Before flashing your USB or rebooting, prepare your system and Windows installation.

1. Partition Allocation (Shrink Windows C:)

To dual-boot, free up unallocated disk space for Arch Linux.

  1. Right-click the Windows Start menu and select Disk Management.
  2. Locate your Windows operating system partition (typically C:).
  3. Right-click it and choose Shrink Volume.
  4. Enter the amount of space to shrink (at least 40 GB / 40000 MB is highly recommended).
  5. Leave the shrunk space as Unallocated—do not format it.

2. Disable Fast Startup

Windows "Fast Startup" locks your drives, preventing Linux from safely reading or writing to them.

  1. Open Control Panel > Power Options > Choose what the power buttons do.
  2. Click Change settings that are currently unavailable (requires administrator privileges).
  3. Uncheck Turn on fast startup and click Save changes.

3. UEFI Settings (BIOS) Adjustments

Reboot your PC and enter your BIOS/UEFI settings utility (usually by pressing F2, F12, Del, or Esc during startup).

  • Boot Mode: Must be set to UEFI only. (Disable Legacy/CSM support).
  • SATA Controller Mode: Switch from IDE/RAID/RST to AHCI (otherwise the Linux installer might not see your SSD).
  • Secure Boot: Disable Secure Boot (some distributions support it, but it adds unnecessary hurdles during pure Arch installations).

Part 2: Booting the Live System

  1. Insert your flashed Arch Linux USB drive.
  2. Restart your PC and tap the boot menu key (e.g., F12 on Dell/Gigabyte, F11 on MSI, F8 on ASUS, Enter/F12 on Lenovo).
  3. Select Arch Linux install medium (UEFI).
  4. You will be greeted by the Arch Linux console prompt: root@archiso ~ #.

Part 3: Console Prep & Network

1. Verify Boot Mode

Confirm you are in UEFI mode:

ls /sys/firmware/efi/efivars

If directory contents are printed without error, your system is in UEFI mode.

2. Keyboard Layout

The default keyboard layout is US. To select a different one (e.g., UK, German):

# Example for UK layout:
loadkeys uk

3. Connect to the Internet

  • Ethernet: Plug in the cable; internet should automatically configure via DHCP.
  • Wi-Fi: Use the built-in tool iwctl:
    iwctl
    # Inside the iwd prompt:
    device list                   # Note your wi-fi device name (usually wlan0)
    station wlan0 scan            # Scan for networks
    station wlan0 get-networks    # List available networks
    station wlan0 connect SSID    # Enter network password when prompted
    exit
  • Verify connection:
    ping -c 3 archlinux.org

4. Update the System Clock

Enable Network Time Protocol (NTP) to ensure exact local timing:

timedatectl set-ntp true
timedatectl status

Part 4: Disk Partitioning

We need to partition our unallocated space. Identify your drives:

lsblk

Your main drive is likely /dev/nvme0n1 (NVMe SSD) or /dev/sda (SATA SSD/HDD). Note down this name.

Using cfdisk (Visual Console Partitioning)

# Replace /dev/sdX with your actual drive (e.g., /dev/nvme0n1 or /dev/sda)
cfdisk /dev/sdX

Dual-Boot Configuration (Sharing Windows EFI)

  1. Locate the existing Windows EFI System Partition (usually labeled EFI system partition, size ~100MB to 500MB). Keep it! We will mount it as /boot without formatting it.
  2. Scroll down to the Free Space you shrank in Windows.
  3. Create a Swap Partition (optional, recommended if you have low RAM or want Hibernation):
    • Select Free Space > New > Size: 4G (or matching your RAM size).
    • Change Type to Linux swap.
  4. Create the Root Partition (/):
    • Select remaining Free Space > New > Use all remaining size.
    • Ensure Type is set to Linux filesystem.
  5. Select Write, type yes, and then Quit.

Single-Boot Configuration (Erase Disk)

  1. Select your drive, choose gpt label layout.
  2. EFI Partition: New > Size 512M > Type EFI System.
  3. Swap Partition: New > Size 4G > Type Linux swap.
  4. Root Partition: New > Remaining Size > Type Linux filesystem.
  5. Select Write, type yes, then Quit.

Part 5: Formatting and Mounting

1. Format the Partitions

Assume /dev/sdX1 is EFI (single boot only), /dev/sdX2 is swap, and /dev/sdX3 is root.

  • Root Partition (ext4):
    mkfs.ext4 /dev/sdX3
  • Swap Partition:
    mkswap /dev/sdX2
    swapon /dev/sdX2
  • EFI Partition (ONLY format this if you did a Single-Boot clean install! Never format your Windows EFI partition!):
    # Run ONLY on a single-boot clean setup:
    mkfs.vfat -F 32 /dev/sdX1

2. Mount the Filesystems

Mount root:

mount /dev/sdX3 /mnt

Create the /boot folder and mount the EFI partition (For dual-boot, this is your existing Windows EFI partition; for single-boot, this is the EFI you formatted):

mkdir -p /mnt/boot
mount /dev/sdX1 /mnt/boot

Part 6: Installing the Base System

Run pacstrap to install the core operating system package set:

pacstrap -K /mnt base linux linux-firmware nano vim networkmanager sudo

Part 7: System Configuration

1. Generate Fstab

Create the filesystem table file:

genfstab -U /mnt >> /mnt/etc/fstab
# Verify fstab contents look clean:
cat /mnt/etc/fstab

2. Chroot into the New System

Log in as the root user inside your new Arch Linux environment:

arch-chroot /mnt

3. Time Zone

Set your local time zone (replace Region/City with your own, e.g., Europe/London or America/New_York):

ln -sf /usr/share/zoneinfo/Asia/Dhaka /etc/localtime
hwclock --systohc

4. Locale Localization

  1. Edit the locale generator file:
    nano /etc/locale.gen
  2. Uncomment en_US.UTF-8 UTF-8 (and any other desired locales). Save and exit (Ctrl+O, Enter, Ctrl+X).
  3. Generate the locales:
    locale-gen
  4. Set the system locale environment variable:
    echo "LANG=en_US.UTF-8" > /etc/locale.conf

5. Network Configuration

  1. Set your custom hostname (replace myarch with your preferred machine name):
    echo "myarch" > /etc/hostname
  2. Configure local hosts:
    nano /etc/hosts
    Add the following lines:
    127.0.0.1   localhost
    ::1         localhost
    127.0.1.1   myarch.localdomain myarch
    
  3. Enable NetworkManager so you have internet connectivity upon reboot:
    systemctl enable NetworkManager

6. User Accounts & Security

Set the administrative root password:

passwd

Create a personal user account (replace username with your chosen handle) and grant them administrative sudo privileges:

useradd -m -G wheel,storage,power -s /bin/bash username
passwd username

Allow the wheel group to use sudo:

EDITOR=nano visudo

Scroll down and uncomment this line by removing the # symbol:

%wheel ALL=(ALL:ALL) ALL

Save and exit.


Part 8: Installing Bootloader (GRUB)

GRUB is ideal for dual-booting as it detects Windows easily.

1. Install Essential Bootloader Packages

pacman -S grub efibootmgr os-prober mtools dosfstools

2. Configure GRUB for Dual-Boot Detection

If you are dual-booting with Windows, you must tell GRUB to look for other systems using os-prober.

  1. Open the GRUB configuration file:
    nano /etc/default/grub
  2. Scroll to the very bottom and add (or uncomment) the following line:
    GRUB_DISABLE_OS_PROBER=false
    
  3. Save and exit.

3. Install and Generate GRUB Configs

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg

Verify that the output displays: Found Windows Boot Manager on... (if dual booting).


Part 9: Finishing the Install

Exiting chroot and booting into your shiny new Arch Linux system:

exit                  # Exit the chroot console
umount -R /mnt        # Recursively unmount partitions
reboot                # Reboot system, remove USB installer!

Upon startup, the GRUB menu will allow you to select Arch Linux or Windows Boot Manager. Log in with your new user and proceed to desktop environment setup!