Skip to content

Instantly share code, notes, and snippets.

@karhunenloeve
Created October 4, 2023 13:32
Show Gist options
  • Save karhunenloeve/7bd46012a6bfcf7cc14678f7b094e1bd to your computer and use it in GitHub Desktop.
Save karhunenloeve/7bd46012a6bfcf7cc14678f7b094e1bd to your computer and use it in GitHub Desktop.
Installing Archlinux.

Installing and Configuring Arch Linux

Prerequisites

  • Before you begin, make sure you have a bootable Arch Linux installation USB drive. You can create one following the official Arch Linux installation guide.

Installation Steps

  1. Boot from the Installation USB:

    • Insert the bootable Arch Linux USB drive into your computer.
    • Boot your computer from the USB drive. You may need to adjust the boot order in your BIOS/UEFI settings.
  2. Set the Keyboard Layout:

    • Use the loadkeys command to set your keyboard layout if it's not the default US layout. For example, to set the German layout, you can use: loadkeys de-latin1.
  3. Connect to the Internet:

    • Ensure you have an active internet connection. You can use Ethernet or Wi-Fi. To connect to Wi-Fi, use the wifi-menu or ip command as needed.
  4. Partition the Disk:

    • Use a tool like fdisk or cfdisk to partition your hard drive. Create at least two partitions: one for the root filesystem and, if desired, one for the swap space. Format the partitions with the appropriate filesystem (e.g., ext4 for the root partition).
  5. Mount the Partitions:

    • Mount the root partition to /mnt using the mount command. If you created a separate partition for the home directory, mount it to /mnt/home.
    • If you created a swap partition, activate it using swapon.
  6. Install the Base System:

    • Use the pacstrap command to install the base system and essential packages to the mounted root partition: pacstrap /mnt base base-devel.
  7. Generate an fstab File:

    • Generate an fstab file using the genfstab command: genfstab -U /mnt >> /mnt/etc/fstab.
  8. Chroot into the New System:

    • Change into the new system's root directory: arch-chroot /mnt.
  9. Set the Time Zone:

    • Use the timedatectl command to set your time zone: timedatectl set-timezone Zone/Subzone.
  10. Set the Locale:

    • Edit the /etc/locale.gen file and uncomment the desired locales.
    • Generate the locales with locale-gen.
    • Set the system-wide locale with echo LANG=your_locale > /etc/locale.conf.
  11. Create the Hostname:

    • Create a hostname file: echo your_hostname > /etc/hostname.
  12. Set the Root Password:

    • Set the root password with the passwd command.
  13. Install a Boot Loader:

    • Install a boot loader like GRUB with pacman -S grub and configure it according to your system.
  14. Exit Chroot and Reboot:

    • Exit the chroot environment with exit.
    • Unmount all partitions: umount -R /mnt.
    • Reboot your system: reboot.
  15. Post-Installation Configuration:

    • After rebooting into your new Arch Linux system, you can further configure your system by installing additional packages, setting up user accounts, and customizing system settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment