4 June 2014

This step by step guide shows how to install Arch Linux from USB flash drive or cd. In my opinion the beginner tutorial from Arch wiki is too complicated for beginners. This is made simple and very practical, with some basic knowledge about partitions and Linux you should have no problems.

Create Arch USB flash drive:

Download Arch Linux latest dual iso from https://archlinux.org/download/.

Run this command to write the iso to your USB flash drive. Make sure /dev/sdb is your usb, this can be dangerous, you might overwrite some other disks. You can use gparted to find your usb and also delete any partitions beforehand.
Source code viewer
  1. sudo dd bs=4M if=~/Downloads/archlinux-2022.06.01-x86_64.iso of=/dev/sdb && sync
Programming Language: Bash

Install the base environment

 
Follow the official guide on how to install arch through command line.
https://wiki.archlinux.org/title/Installation_guide
 
Or follow my short installation guide (I suggest to use both, if you are a first timer):
 
  • Start Arch from USB to install it.
  • Pick 64 bit (x86_64) or 32 bit (i686) when you have old dual iso instead of x86_64.
 
Make sure you have internet connection by running ping (optional).
 
Set up your partitions:If you have a single drive, the process is simple and straightforward. If you have any trouble you can use testdisk utility.
Source code viewer
  1. # Your drive is probably /dev/sda or /dev/nvme0n1.
  2. sgdisk --zap-all /dev/sda
  3. cgdisk /dev/sda
  4. # NB: Create partitions based on the table below!
  5. # "Write" to apply the changes to disk.
  6. # "Quit".
Programming Language: Bash
Mount point Partition Partition type Suggested size
/mnt/boot /dev/efi_system_partition EFI system partition At least 300 MiB
SWAP (Optional) /dev/swap_partition Linux swap More than 512 MiB
/mnt /dev/root_partition Linux x86-64 root (/) Remainder of the device
 
Create filesystems (Don't know if needed any more):
Source code viewer
  1. # Single-partition setup:
  2. mkfs.ext4 /dev/root_partition
  3. mkswap /dev/swap_partition
  4. mkfs.fat -F 32 /dev/efi_system_partition
Programming Language: Bash
 
Mount:
Source code viewer
  1. # Single-partition setup:
  2. mount /dev/root_partition
  3. mount --mkdir /dev/efi_system_partition /mnt/boot
  4. swapon /dev/swap_partition
Programming Language: Bash
 
Connect to internet:
  • Ethernet—plug in the cable.
  • Wi-Fi—authenticate to the wireless network using iwctl.
  • Mobile broadband modem—connect to the mobile network with the mmcli utility.
 
Install the base system:
Source code viewer
  1. pacstrap /mnt base linux linux-firmware
Programming Language: Bash
 
Generate an fstab:
Source code viewer
  1. genfstab -U /mnt >> /mnt/etc/fstab
Programming Language: Bash
 
Next, chroot into your newly installed system:
Source code viewer
  1. arch-chroot /mnt
Programming Language: Bash
 
Set the time zone:
Source code viewer
  1. ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
Programming Language: Bash
 
Run hwclock(8) to generate /etc/adjtime:
Source code viewer
  1. hwclock --systohc
Programming Language: Bash
 
Create an initial ramdisk environment:
Source code viewer
  1. mkinitcpio -P
Programming Language: Bash
 
Set the root password with:
Source code viewer
  1. passwd
Programming Language: Bash
 
Install the bootloader and GRUB:
Source code viewer
  1. pacman -S grub efibootmgr
  2. grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
  3. grub-mkconfig -o /boot/grub/grub.cfg
Programming Language: Bash
 
Unmount the partitions and reboot:
Source code viewer
  1. exit
  2. reboot
Programming Language: Bash

Enable bash autocomplete (Recommended):

Source code viewer
  1. pacman -S bash-completion
Programming Language: Bash

Enable internet (Recommended):

Source code viewer
  1. ip link
  2. ip link set up dev enp2s0
  3. systemctl enable dhcpcd
  4. systemctl start dhcpcd
  5. systemctl enable NetworkManager
  6. systemctl start NetworkManager
Programming Language: Bash
 

Choose your drivers (Recommended):

Source code viewer
  1. # Detect your videocard.
  2. lspci -v | grep -A1 -e VGA -e 3D
  3.  
  4. # Nvidia - first search and then install the corresponding one
  5. pacman -Ss nvidia
  6. pacman -S nvidia
  7.  
  8. # Intel
  9. pacman -S xf86-video-intel
  10.  
  11. # Radeon
  12. pacman -S xf86-video-ati
Programming Language: Bash
 
Create user (Recommended):
Source code viewer
  1. pacman -S sudo
  2. useradd -m -g users -G wheel -s /bin/bash USERNAME
  3. passwd USERNAME
  4.  
  5. # If you wish to use sudo command:
  6. visudo
  7. # Uncomment "%wheel ALL=(ALL) ALL", if you wish to be added to sudoers since you have been added to group wheel.
Programming Language: Bash
 

Locale (Recommended):

Source code viewer
  1. nano /etc/locale.gen
  2. # Uncomment: en_US.UTF-8 UTF-8
  3.  
  4. locale-gen
  5.  
  6. echo LANG=en_US.UTF-8 > /etc/locale.conf
Programming Language: Bash
 

Set repositories (Recommended):

Final step would be to install yaourt and use it instead of pacman. It includes pacman + user repositories. You will be amazed what you can get from Arch User Repositories (AUR). Also enable multilib so you can download programs like skype or wine that require 32bit packages if you are using 64bit version.
Source code viewer
  1. # 1. Open repositories configuration.
  2. nano /etc/pacman.conf
  3.  
  4. # 2. Uncomment both two lines of the [multilib] section for 32-bit packages.
  5.  
  6. # 4. Refresh repositories.
  7. pacman -Syu
  8.  
  9. # 5. Install yay package manager for AUR package management.
  10. pacman -S git base-devel
  11. git clone https://aur.archlinux.org/yay.git
  12. cd yay
  13. makepkg -si
Programming Language: Bash

Pick your favourite desktop environment: (Optional):