Skip to content

hypergolang/arch-linux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Complete Arch Linux Installation Guide

Comprehensive step-by-step instructions based on the official Arch Linux Wiki and current best practices for 2025.


1. Pre-Installation Preparation

What you need:

  • USB drive (4GB minimum)
  • Stable internet connection
  • UEFI-capable system (recommended)
  • At least 20GB free disk space

Steps:

  1. Download the latest Arch Linux ISO from https://archlinux.org/download/
  2. Create bootable USB using tools like:
    • Ventoy (recommended - supports multiple ISOs)
    • Rufus (Windows)
    • Etcher (Cross-platform)
    • dd command (Linux/macOS)
# Example using dd (Linux/macOS)
sudo dd bs=4M if=archlinux.iso of=/dev/sdX status=progress oflag=sync

Boot preparation:

  1. Insert USB and restart computer
  2. Press F12, F11, DEL, or ESC (varies by manufacturer) during boot
  3. Select USB device from boot menu
  4. Choose "Arch Linux install medium (x86_64, UEFI)" from GRUB menu

2. Verify Boot Environment

Check you're in the live environment:

# You should see this prompt:
root@archiso ~ #

# Verify UEFI boot mode (should show directory listing)
ls /sys/firmware/efi/efivars

# Check available disks and partitions
lsblk -f

# Check internet connectivity (should work automatically for ethernet)
ping -c 3 archlinux.org

Example disk layout you might see:

NAME        FSTYPE LABEL     SIZE MOUNTPOINT
nvme0n1                     512G
├─nvme0n1p1 vfat   EFI       100M
├─nvme0n1p2                  16M
├─nvme0n1p3 ntfs   Windows   200G
├─nvme0n1p4 ntfs   DATA      100G
└─nvme0n1p5 ext4   Linux     100G

3. Connect to Internet

For Ethernet (usually automatic):

# Test connection
ping -c 3 archlinux.org

For Wi-Fi using iwctl:

# Start iwctl interactive mode
iwctl

# Inside iwctl:
device list                    # Find your wireless device (usually wlan0)
station wlan0 scan            # Scan for networks
station wlan0 get-networks    # List available networks
station wlan0 connect "Your-WiFi-Name"
# Enter password when prompted
exit

# Test connection
ping -c 3 archlinux.org

Update system clock:

timedatectl set-ntp true
timedatectl status

4. Disk Partitioning

⚠️ IMPORTANT: This will erase data. Backup important files first!

Option A: Clean installation (recommended for beginners)

# Use cfdisk for interactive partitioning
cfdisk /dev/nvme0n1  # or /dev/sda for SATA drives

# Create this layout:
# 1. EFI System: 512M, Type: EFI System
# 2. Linux filesystem: remainder, Type: Linux filesystem
# 3. Optionally: swap partition (2-8GB), Type: Linux swap

Option B: Dual boot (advanced users)

  • Keep existing EFI partition
  • Shrink Windows partition using Windows Disk Management first
  • Create Linux partition in free space

Partitioning commands for clean install:

# If using GPT (recommended for UEFI)
gdisk /dev/nvme0n1

# Create partitions:
# o (create new GPT)
# n (new partition 1: EFI, +512M, ef00)
# n (new partition 2: Linux root, remaining space, 8300)
# w (write changes)

5. Format Partitions

# Format EFI partition (FAT32)
mkfs.fat -F32 /dev/nvme0n1p1

# Format root partition (ext4)
mkfs.ext4 /dev/nvme0n1p2

# If you created a swap partition
mkswap /dev/nvme0n1p3
swapon /dev/nvme0n1p3

Verify formatting:

lsblk -f

6. Mount Filesystems

# Mount root partition
mount /dev/nvme0n1p2 /mnt

# Create EFI directory and mount EFI partition
mkdir -p /mnt/boot/efi
mount /dev/nvme0n1p1 /mnt/boot/efi

# Verify mounts
lsblk
df -h

7. Install Base System

This is the crucial step that was missing from your original guide!

Update mirrorlist for faster downloads (optional):

# Backup original mirrorlist
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

# Use reflector to find fastest mirrors
pacman -Sy reflector
reflector --country 'United States' --age 6 --protocol https --sort rate --save /etc/pacman.d/mirrorlist

Install essential packages:

# Install base system with essential packages
pacstrap /mnt base base-devel linux linux-firmware \
    networkmanager grub efibootmgr \
    vim nano sudo git wget curl \
    intel-ucode  # or amd-ucode for AMD processors

Package explanations:

  • base: Essential Arch Linux system
  • base-devel: Development tools for building packages
  • linux: Linux kernel
  • linux-firmware: Hardware firmware
  • networkmanager: Network management
  • grub efibootmgr: Bootloader for UEFI
  • vim nano: Text editors
  • sudo: Privilege escalation
  • git wget curl: Essential tools
  • intel-ucode/amd-ucode: CPU microcode updates

8. Generate fstab

# Generate filesystem table
genfstab -U /mnt >> /mnt/etc/fstab

# Verify fstab entries
cat /mnt/etc/fstab

9. Enter New System (chroot)

# Change root into new system
arch-chroot /mnt

From this point, you're working inside your new Arch installation!


10. Configure System

Set timezone:

# Replace Region/City with your timezone
ln -sf /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime

# Generate /etc/adjtime
hwclock --systohc

# Verify
timedatectl status

Configure localization:

# Edit locale configuration
nano /etc/locale.gen

# Uncomment your locale (e.g., en_US.UTF-8 UTF-8)
# For Vietnam, also uncomment: vi_VN UTF-8

# Generate locales
locale-gen

# Set system locale
echo "LANG=en_US.UTF-8" > /etc/locale.conf

Set hostname and hosts:

# Set your computer name
echo "arch-pc" > /etc/hostname

# Configure hosts file
cat <<EOF > /etc/hosts
127.0.0.1   localhost
::1         localhost
127.0.1.1   arch-pc.localdomain arch-pc
EOF

11. User Management

Set root password:

passwd
# Enter a strong password for root

Create user account:

# Create user with home directory and add to wheel group
useradd -m -G wheel,audio,video,storage -s /bin/bash yourusername

# Set user password
passwd yourusername

Enable sudo for wheel group:

# Edit sudoers file
EDITOR=nano visudo

# Uncomment this line:
%wheel ALL=(ALL:ALL) ALL

12. Configure Network

# Enable NetworkManager
systemctl enable NetworkManager

# Enable SSH (optional, for remote access)
systemctl enable sshd

13. Generate Initramfs

# Recreate initramfs (usually not needed, but ensures everything is correct)
mkinitcpio -P

14. Install and Configure Bootloader

Install GRUB for UEFI:

# Install GRUB to EFI directory
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=GRUB

# Generate GRUB configuration
grub-mkconfig -o /boot/grub/grub.cfg

For dual-boot with Windows:

# Install os-prober to detect Windows
pacman -S os-prober

# Enable os-prober in GRUB
echo "GRUB_DISABLE_OS_PROBER=false" >> /etc/default/grub

# Regenerate GRUB config
grub-mkconfig -o /boot/grub/grub.cfg

15. Exit and Reboot

# Exit chroot environment
exit

# Unmount all partitions
umount -R /mnt

# Reboot system
reboot

Remove USB drive when system restarts!


16. First Boot Configuration

Log in as your user account (not root!)

Update system:

sudo pacman -Syu

Install AUR helper (yay):

# Install dependencies
sudo pacman -S git base-devel

# Clone and install yay
cd /tmp
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

# Test yay
yay --version

17. Install Desktop Environment

KDE Plasma (full-featured):

# Install KDE Plasma desktop environment
sudo pacman -S plasma kde-applications

# Install display manager
sudo pacman -S sddm

# Enable display manager
sudo systemctl enable sddm

# Reboot to enter desktop
sudo reboot

GNOME (alternative):

sudo pacman -S gnome gnome-extras
sudo systemctl enable gdm
sudo reboot

Xfce (lightweight):

sudo pacman -S xfce4 xfce4-goodies lightdm lightdm-gtk-greeter
sudo systemctl enable lightdm
sudo reboot

18. Essential Post-Installation

Install essential software:

# Multimedia codecs
sudo pacman -S gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav

# Fonts
sudo pacman -S ttf-dejavu ttf-liberation noto-fonts

# Archive tools
sudo pacman -S unzip unrar p7zip

# Development tools (if needed)
sudo pacman -S code firefox thunderbird libreoffice-fresh

# System monitoring
sudo pacman -S htop neofetch

Enable firewall:

sudo pacman -S ufw
sudo ufw enable
sudo systemctl enable ufw

Configure audio:

# Install PipeWire (modern audio system)
sudo pacman -S pipewire pipewire-alsa pipewire-pulse pipewire-jack wireplumber

# Enable audio services
systemctl --user enable pipewire pipewire-pulse wireplumber

19. System Maintenance

Regular updates:

# Update system weekly
sudo pacman -Syu

# Clean package cache monthly
sudo pacman -Sc

# Remove orphaned packages
sudo pacman -Rns $(pacman -Qtdq)

Backup important files:

  • /etc/ (system configuration)
  • /home/yourusername/ (user data)
  • List of installed packages: pacman -Qqe > pkglist.txt

20. Troubleshooting

Boot issues:

# Boot from USB again and chroot to fix issues
mount /dev/nvme0n1p2 /mnt
mount /dev/nvme0n1p1 /mnt/boot/efi
arch-chroot /mnt

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

Network issues:

# Check NetworkManager status
sudo systemctl status NetworkManager

# Restart NetworkManager
sudo systemctl restart NetworkManager

# For Wi-Fi connection
nmcli device wifi list
nmcli device wifi connect "SSID" password "password"

Performance optimization:

# Enable SSD TRIM (for SSDs)
sudo systemctl enable fstrim.timer

# Check system services
systemctl --failed

21. Security Hardening (Optional)

Configure firewall:

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw enable

Disable root login:

sudo passwd -l root

Install microcode updates:

# Already installed during base installation
# Regenerate GRUB to ensure microcode is loaded
sudo grub-mkconfig -o /boot/grub/grub.cfg

What's Different in This Guide

Major improvements made:

  1. Added the crucial pacstrap step - This was completely missing from your original guide!
  2. Better network configuration with NetworkManager
  3. Comprehensive package installation with essential tools
  4. Proper user management and sudo configuration
  5. AUR helper installation (yay) for additional software
  6. Multiple desktop environment options
  7. Post-installation essentials and system maintenance
  8. Troubleshooting section for common issues
  9. Security hardening recommendations
  10. Better structure with clear explanations for each step

Critical fixes:

  • Added missing pacstrap command to actually install the base system
  • Proper NetworkManager setup instead of just iwd + dhcpcd
  • Essential packages included from the start
  • Better partition size recommendations
  • User creation with proper groups

This guide now follows current best practices and should result in a fully functional Arch Linux system with KDE Plasma desktop environment.


Based on the official Arch Linux Installation Guide: https://wiki.archlinux.org/title/Installation_guide

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published