Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JonnyMuff/6aa946876618384dc8119fc9a7659ad4 to your computer and use it in GitHub Desktop.
Save JonnyMuff/6aa946876618384dc8119fc9a7659ad4 to your computer and use it in GitHub Desktop.
Install Arch Linux using EFI and GRUB (dual-boot with Windows)

Installing Arch linux with EFI (dual-boot with Windows)

Just skip steps 22, 23 and 25 if dual-boot isn't your use case scenario

  1. Change keyboard layout (if needed, default is 'us')

    • to see all avaliable layouts: ls /usr/share/kbd/keymaps/**/*.map.gz
    • loadkeys us
  2. Verify boot mode:

    • ls /sys/firmware/efi/efivars (If the directory exist your computer supports EFI)
  3. Ping some site on the Internet to verify connection:

    • ping archlinux.org
  4. Update system clock:

    • timedatectl set-ntp true
    • You can verify the status with timedatectl status
  5. Go to https://archlinux.org/mirrorlist and find the closest mirror that supports HTTPS:

    • Add the mirrors on top of the /etc/pacman.d/mirrorlist file.
    • Server = https://mirror.yandex.ru/archlinux/$repo/os/$arch (Russia)
  6. Create EFI partition:

    • lsblk or fdisk -l to find the designation for the HDD. (Most likely /dev/sda)
    • fdisk /dev/sda
    • if partition(s) already exist, type d > enter
    • use p to list all partitions and other useful info
    • g (to create a new partition table)
    • n (to create a new partition)
    • 1
    • enter
    • +300M
    • t
    • 1 (for EFI)
  7. Create /root partition:

    • n
    • 2
    • enter
    • +30G
  8. Create /home partiton:

    • n
    • 3
    • enter
    • enter
    • w
      • (THIS WILL REMOVE EVERYTHING and write made changes! Make sure you selected the right drive before pressing w by pressing p, check the model number of your drive, it's size, etc. If you made a mistake, just press q and repeat the steps 6-8)
  9. Create the filesystems:

    • mkfs.fat -F32 /dev/sda1
    • mkfs.ext4 /dev/sda2
    • mkfs.ext4 /dev/sda3
  10. Create the /root and /home directories:

    • mount /dev/sda2 /mnt
    • mkdir /mnt/home
    • mount /dev/sda3 /mnt/home
  11. Install Arch linux packages:

    • pacstrap /mnt base base-devel linux linux-firmware (not a bad idea to include your editor of choice: vim, nano, emacs, etc)
  12. Generate the /etc/fstab file:

    • genfstab -U -p /mnt >> /mnt/etc/fstab
  13. Chroot into installed system:

    • arch-chroot /mnt
  14. Change root password

    • passwd
  15. Edit the hostname of your machine

    • "arch" > /etc/hostname (you can use anything instead of arch)
  16. Set the timezone:

    • ls /usr/share/zoneinfo/ (to see possible timezones)
    • ln -sf /usr/share/zoneinfo/Europe/Moscow /etc/localtime
  17. Update the Hardware clock:

    • hwclock --systohc --utc (make sure your Windows clock is set to UTC time for it to be synced with Arch)
  18. Install boot manager and other needed packages:

    • pacman -S grub efibootmgr dosfstools os-prober mtools
  19. Set locale:

    • vim /etc/locale.gen
    • uncomment en_US.UTF-8 and en_US ISO-8859-1 for US English
    • uncomment any other line you need, to enable your language
    • locale-gen
    • echo LANG=en_US.UTF-8 > /etc/locale.conf && export LANG=en_US.UTF-8
  20. Create EFI boot directory:

    • mkdir /boot/EFI
    • mount /dev/sda1 /boot/EFI
  21. Install GRUB on EFI mode:

    • grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
  22. Mount Windows EFI partition:

    • lsblk to locate Windows 100M partition (for example, /dev/sdb1)
    • mkdir /win && mount /dev/sdb1 /win
  23. Enable os-prober to detect Windows installation:

    • vim /etc/default/grub
    • uncomment line GRUB_DISABLE_OS_PROBER=false
  24. Write GRUB config:

    • grub-mkconfig -o /boot/grub/grub.cfg
    • efibootmgr -v make sure both Arch and Windows are in your boot options
  25. Unmount Windows partition:

    • umount -R /win
    • rm -r /win
  26. Create swap file (optional, but recommended):

    • fallocate -l 2G /swapfile
    • chmod 600 /swapfile
    • mkswap /swapfile
    • echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
  27. Create a new user:

    • useradd -mg wheel user (where user is your username)
    • passwd user (can be equal to root password)
    • vim /etc/sudoers
    • uncomment either %wheel ALL=(ALL) or %wheel ALL=(ALL) NOPASSWD: ALL to execute sudo commands
    • add Defaults !tty-tickets to do a passwordless sudo within the timeout period
  28. Configure Ethernet connection:

    • pacman -S networkmanager
    • systemctl enable NetworkManager to make it autostart
  29. Exit, unmount and reboot:

    • exit
    • umount -a
    • reboot
  30. Enjoy Arch Linux with dual-boot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment