Skip to content

Instantly share code, notes, and snippets.

@dev-math
Created December 20, 2021 14:02
Show Gist options
  • Select an option

  • Save dev-math/b1fdd353cfe4d3e43f53bb7050363bfc to your computer and use it in GitHub Desktop.

Select an option

Save dev-math/b1fdd353cfe4d3e43f53bb7050363bfc to your computer and use it in GitHub Desktop.
Arch Linux Install Guide (txt)
# Set the console keyboard layout. For example:
loadkeys br-abnt2
# Available layouts can be listed with:
ls /usr/share/kbd/keymaps/**/*.map.gz
# Connect to the internet
# Ensure your network interface is listed and enabled, for example with ip-link:
ip link
# For wireless and WWAN, make sure the card is not blocked with rfkill.
# Connect to the network:
# - 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.
# - Configure your network connection:
# - DHCP: dynamic IP address and DNS server assignment (provided by systemd-networkd and systemd-resolved) should work out of the box for Ethernet, WLAN, and WWAN network interfaces.
# - Static IP address: follow Network configuration#Static IP address.
# The connection may be verified with ping:
ping archlinux.org
# Verify the boot mode
ls /sys/firmware/efi/efivars
# Sync clock
timedatectl set-ntp true
# Partition the disks
# The following partitions are required for a chosen device:
# - One partition for the root directory /.
# - For booting in UEFI mode: an EFI system partition.
# Example layouts:
# (UEFI with GPT)
# Mount point Partition Partition type Suggested size
# /mnt/boot1 /dev/efi_system_partition EFI system partition At least 300 MiB
# [SWAP] /dev/swap_partition Linux swap More than 512 MiB
# /mnt /dev/root_partition Linux x86-64 root (/) Remainder of the device
# (BIOS with MBR)
# Mount point Partition Partition type Suggested size
# [SWAP] /dev/swap_partition Linux swap More than 512 MiB
# /mnt /dev/root_partition Linux Remainder of the device
# I create these partitions:
# 1 600MB EFI partition
# 2 Swap 6GB
# 3 Linux remainder
fdisk -l
fdisk /dev/the_disk_to_be_partitioned
# Format the partitions
mkswap /dev/swap_partition
mkfs.ext4 /dev/root_partition
mkfs.fat -F32 /dev/efi_system_partition
# Mount the file systems
# Mount the root volume to /mnt. For example, if the root volume is /dev/root_partition:
mount /dev/root_partition /mnt
# Create any remaining mount points (such as /mnt/efi) using mkdir and mount their corresponding volumes.
# For UEFI systems, mount the EFI system partition:
mount /dev/efi_system_partition /mnt/boot
# If you created a swap volume, enable it with swapon(8):
swapon /dev/swap_partition
# Select the mirrors (defined in /etc/pacman.d/mirrorlist)
# Install essential packages
pacstrap /mnt base linux linux-firmware
# Generate fstab (use -U or -L to define by UUID or labels, respectively):
genfstab -U /mnt >> /mnt/etc/fstab
# Check the resulting /mnt/etc/fstab file, and edit it in case of errors.
# Change root into the new system:
arch-chroot /mnt
# Set the time zone:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
# Run hwclock to generate /etc/adjtime:
hwclock --systohc
# Edit /etc/locale.gen and uncomment "en_US.UTF-8 UTF-8" and other needed locales. Generate the locales by running:
locale-gen
# Create the locale.conf file, and set the LANG variable accordingly. For example:
echo LANG=en_US.UTF-8 > /etc/locale.conf
# If you set the console keyboard layout, make the changes persistent in vconsole.conf. For example:
echo KEYMAP=br-abnt2 > /etc/vconsole.conf
# Create the hostname file:
echo myhostname > /etc/hostname
# Add to hosts /etc/hosts (optional)
# 127.0.0.1 localhost
# ::1 localhost
# 127.0.1.1 myhostname
# Initramfs (usually not required)
mkinitcpio -P
# Set the root password:
passwd
# Depending on the processor, install the following package:
# amd-ucode for AMD processors, intel-ucode for Intel processors. For example:
pacman -S intel-ucode
# Configuration: check https://wiki.archlinux.org/title/Microcode#Configuration
# install a bootloader. For example, I'm using grub (uefi system):
# First, install the packages grub and efibootmgr:
pacman -S grub efibootmgr
# esp = efi partition mount point
# choose a bootloader identifier, here named GRUB
# execute the following command to install the GRUB EFI application grubx64.efi to esp/EFI/GRUB/ and install its modules to /boot/grub/x86_64-efi/
grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id=GRUB
# Use the grub-mkconfig tool to generate /boot/grub/grub.cfg:
grub-mkconfig -o /boot/grub/grub.cfg
# Complete the network configuration for the newly installed environment. I'm using NetworkManager, install with:
pacman -S networkmanager
# Enable NetworkManager
systemctl enable NetworkManager.service
# Reboot
# Exit the chroot environment by typing exit or pressing Ctrl+d.
exit
# Optionally manually unmount all the partitions, this allows noticing any "busy" partitions, and finding the cause with fuser:
umount -R /mnt
# Finally, restart the machine by typing reboot: any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation medium and then login into the new system with the root account.
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment